X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fspec%2Fmkws-pazpar2.js;h=9ffcda2dba55b509161808f6b4634ebafe8bc235;hb=816044f39ec687ea6c645a22bfe7dbb98b8637bd;hp=2dab391abc300d6d4ca9c2ece32ad360651dec84;hpb=016f2007ab90d0f3d0a8bcb552b7a8b1607081de;p=mkws-moved-to-github.git diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index 2dab391..9ffcda2 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -9,11 +9,15 @@ var debug = function (text) { mkws.log("Jasmine: " + text) } -// Define empty jasmine_config for simple applications that don't define it. + // Define empty jasmine_config for simple applications that don't define it. if (jasmine_config == null || typeof jasmine_config != 'object') { var jasmine_config = {}; } +var jasmine_status = { + source_click: 0 +}; + /* check config for jasmine test * * you can override the default values in the config @@ -268,6 +272,26 @@ describe("Check Termlist", function () { }); }); + it("check for active clients", 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); + + runs(function () { + var clients = $("div#mkwsStat span.clients"); + debug("span.clients: " + clients.text()); + expect(clients.text()).toMatch("/[1-9]+[0-9]+$"); + + // exact match of active clients (e.g. a SP misconfiguration) + if (jasmine_config.active_clients) { + debug("check for " + jasmine_config.active_clients + " active connections"); + expect(clients.text()).toMatch(" [0-9]+/" + jasmine_config.active_clients + "$"); + } + }); + }); + it("limit search to first source", function () { var hits_all_targets = get_hit_counter(); var source_number = 2; // 2=first source @@ -314,6 +338,7 @@ describe("Check Termlist", function () { var hits_single_target = get_hit_counter(); 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; $(".mkwsPager").unbind("DOMNodeInserted DOMNodeRemoved propertychange"); }); @@ -323,10 +348,14 @@ describe("Check Termlist", function () { describe("Check record list", function () { it("check for single active client", function () { + if (!jasmine_status.source_click) { + debug("skip clients check due missing source click"); + return; + } + waitsFor(function () { 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); @@ -362,7 +391,6 @@ describe("Show record", function () { waitsFor(function () { var show = $("div.mkwsRecords div.record:nth-child(" + record_number + ") > div.details"); //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); @@ -436,6 +464,11 @@ describe("Check status client counter", function () { var time = get_time(); it("check status clients", function () { + if (!jasmine_status.source_click) { + debug("skip clients check due missing source click"); + return; + } + waitsFor(function () { var clients = $("div#mkwsStat span.clients"); debug("clients: " + clients.text());