X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fspec%2Fmkws-pazpar2.js;h=61799125e2372b9365606b8cc69e5117cfef718c;hb=7d05d3f1514e1a8ee1dd97f648e05eb97e2fafe0;hp=cf60cf9d1eb752afe73e16709b9187ff276f09d7;hpb=cb61098a85bfd74a9d7a2df6a62d557de73fac71;p=mkws-moved-to-github.git diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index cf60cf9..6179912 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -4,11 +4,13 @@ * */ -function get_hit_counter() { +var debug = mkws.debug; + +var get_hit_counter = function () { if ($("#mkwsPager").length == 0) return -1; var found = $("#mkwsPager").text(); - var re = /found: ([0-9]+)/; + var re = /\([A-Za-z]+:\s+([0-9]+)\)/; re.exec(found); var hits = -1; @@ -35,12 +37,22 @@ describe("Check pazpar2 search", function () { }); it("run search query", function () { - $("input#mkwsQuery").val("freebsd"); - expect($("input#mkwsQuery").val()).toMatch(/^freebsd$/); + var search_query = "freebsd"; // short hit counter with some paging + + $("input#mkwsQuery").val(search_query); + debug("set search query: " + search_query) + expect($("input#mkwsQuery").val()).toMatch("^" + search_query + "$"); + + // wait for service proxy auth + waitsFor(function () { + return mkws.service_proxy_auth; + }, "SP auth done", 10 * 1000); - setTimeout(function () { - $("input#mkwsButton").trigger("click"); - }, 3 * 1000); + runs(function () { + debug("Submit search"); + var click = $("input#mkwsButton").trigger("click"); + expect(click.length == 1).toBe(true); + }) }); }); @@ -146,7 +158,7 @@ describe("Check Termlist", function () { expect(authors.length == 1).toBe(true); }); - it("Limit search to first source", function () { + it("limit search to first source", function () { var hits_all_targets = get_hit_counter(); var click = $("div#mkwsFacetSources div.term:nth-child(2) a").trigger("click"); @@ -172,7 +184,7 @@ describe("Check Termlist", function () { }); }); - it("Limit search to first author", function () { + it("limit search to first author", function () { var hits_all_targets = get_hit_counter(); var click = $("div#mkwsFacetAuthors div.term:nth-child(2) a").trigger("click"); @@ -190,7 +202,7 @@ describe("Check Termlist", function () { }); }); - it("Show record author", function () { + it("show record author", function () { show_record(); }); }); @@ -202,7 +214,7 @@ describe("Check status client counter", function () { } var time = get_time(); - it("Limit search to first author", function () { + it("check status clients", function () { waitsFor(function () { var clients = $("div#mkwsStat span.clients");