X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fspec%2Fmkws-pazpar2.js;h=8e7543d1487b2edaa122207a6bfffb58192360fb;hb=5bb37cdb165de8b6d607835ed9cf671628f9af41;hp=483bac7a4f4e3b06fbc800248045f1c5195a760c;hpb=33a89dada9b9a7c7cfc8c9a02f55fdd72fde5452;p=mkws-moved-to-github.git diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index 483bac7..8e7543d 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -28,7 +28,7 @@ function init_jasmine_config() { var jasmine_config_default = { search_query: "freebsd", - max_time: 16, + max_time: 17, // in seconds expected_hits: 80, // at least expected hit counter @@ -36,6 +36,7 @@ function init_jasmine_config() { // miliseconds to seconds show_record_url: true, // check for valid URL in records + check_motd: true, dummy: false }; @@ -62,9 +63,8 @@ var get_hit_counter = function () { if (RegExp.$1) { hits = parseInt(RegExp.$1); if (hits <= 0) { - debug("Oooops in get_hit_counter: " + RegExp.$1); + debug("Oooops in get_hit_counter: " + RegExp.$1 + " '" + found + "'"); } - expect(hits).toBeGreaterThan(0); } //debug("Hits: " + hits); @@ -139,6 +139,10 @@ describe("Check pazpar2 search", function () { describe("Check MOTD after search", function () { it("MOTD is hidden", function () { + if (!jasmine_config.check_motd) { + return; + } + expect($(".mkwsMOTD").length).toBe(1); expect($(".mkwsMOTD").is(":hidden")).toBe(true); debug("motd t=" + $(".mkwsMOTD").text()); @@ -277,7 +281,6 @@ describe("Check Author Facets", function () { runs(function () { var hits_single_target = get_hit_counter(); debug("get less hits for authors: " + hits_all_targets + " > " + hits_single_target); - expect(hits_all_targets).toBeGreaterThan(hits_single_target); }); }); }); @@ -285,15 +288,15 @@ describe("Check Author Facets", function () { describe("Check active clients author", function () { it("check for active clients after limited author search", function () { waitsFor(function () { - var clients = $("div#mkwsStat span.clients"); - //debug("clients: " + clients.text()); - return clients.length == 1 && clients.text().match("/[1-9]+[0-9]+$"); - }, "wait for Active clients: x/y", 5 * jasmine_config.second); + var clients = $("div.mkwsStat span.clients"); + // debug("clients: " + clients.text()); + return clients.length == 1 && clients.text().match("/[1-9]+[0-9]*$"); + }, "wait for Active clients: x/y", 5.5 * jasmine_config.second); runs(function () { - var clients = $("div#mkwsStat span.clients"); + var clients = $("div.mkwsStat span.clients"); debug("span.clients: " + clients.text()); - expect(clients.text()).toMatch("/[1-9]+[0-9]+$"); + expect(clients.text()).toMatch("/[1-9]+[0-9]*$"); // exact match of active clients (e.g. a SP misconfiguration) if (jasmine_config.active_clients) { @@ -367,7 +370,7 @@ describe("Check Source Facets", function () { runs(function () { var hits_single_target = get_hit_counter(); - debug("get less hits for sources: " + hits_all_targets + " > " + hits_single_target); + debug("get less hits for sources: " + hits_all_targets + " >= " + hits_single_target); expect(hits_all_targets).not.toBeLessThan(hits_single_target); jasmine_status.source_click = 1; @@ -385,13 +388,13 @@ describe("Check record list", function () { } waitsFor(function () { - var clients = $("div#mkwsStat span.clients"); + var clients = $("div.mkwsStat span.clients"); //debug("clients: " + clients.text()); return clients.length == 1 && clients.text().match("/1$"); }, "wait for Active clients: x/1", 5 * jasmine_config.second); runs(function () { - var clients = $("div#mkwsStat span.clients"); + var clients = $("div.mkwsStat span.clients"); debug("span.clients: " + clients.text()); expect(clients.text()).toMatch("/1$"); }); @@ -420,7 +423,7 @@ describe("Show record", function () { // wait until the record pops up waitsFor(function () { - var show = $("div.mkwsRecords div.record:nth-child(" + record_number + ") > div.details"); + var show = $("div.mkwsRecords div.record:nth-child(" + record_number + ") > div.mkwsDetails"); //debug("poprecord: " + (show ? show.length : -1) + " " + $("div.mkwsRecords div.record").text()); return show != null && show.length ? true : false; }, "wait some miliseconds to show up a record", 2 * jasmine_config.second); @@ -463,7 +466,7 @@ describe("Check switch menu Records/Targets", function () { $("div.mkwsSwitch").children('a').eq(1).trigger("click"); // now the target table must be visible - expect($("div.mkwsBytarget").is(":visible")).toBe(true); + expect($("div.mkwsTargets").is(":visible")).toBe(true); expect($("div.mkwsRecords").is(":visible")).toBe(false); // wait a half second, to show the target view @@ -474,7 +477,7 @@ describe("Check switch menu Records/Targets", function () { // look for table header runs(function () { - expect($("div.mkwsBytarget").html()).toMatch(/Target ID/); + expect($("div.mkwsTargets").html()).toMatch(/Target ID/); }); }); @@ -482,7 +485,7 @@ describe("Check switch menu Records/Targets", function () { $("div.mkwsSwitch").children('a').eq(0).trigger("click"); // now the target table must be visible - expect($("div.mkwsBytarget").is(":visible")).toBe(false); + expect($("div.mkwsTargets").is(":visible")).toBe(false); expect($("div.mkwsRecords").is(":visible")).toBe(true); }); }); @@ -501,7 +504,7 @@ describe("Check status client counter", function () { } waitsFor(function () { - var clients = $("div#mkwsStat span.clients"); + var clients = $("div.mkwsStat span.clients"); debug("clients: " + clients.text()); if (clients.length == 1 && clients.text().match("0/1$")) { return true; @@ -511,7 +514,7 @@ describe("Check status client counter", function () { }, "wait for Active clients: 0/1", 4 * jasmine_config.second); runs(function () { - var clients = $("div#mkwsStat span.clients"); + var clients = $("div.mkwsStat span.clients"); debug("span.clients: " + clients.text()); expect(clients.text()).toMatch("0/1$"); });