Class mkwsTerm replaces term in several places in testing.
[mkws-moved-to-github.git] / test / spec / mkws-pazpar2.js
index 3433115..21d0ea3 100644 (file)
@@ -232,11 +232,11 @@ describe("Check Termlist", function () {
         });
 
         waitsFor(function () {
-            return $("div.mkwsFacet[data-mkws-facet='author'] div.term").length >= 2 ? true : false;
+            return $("div.mkwsFacet[data-mkws-facet='author'] div.mkwsTerm").length >= 2 ? true : false;
         }, "At least one author link displayed", 4 * jasmine_config.second);
 
         runs(function () {
-            expect($("div.mkwsFacet[data-mkws-facet='author'] div.term").length).toBeGreaterThan(1);
+            expect($("div.mkwsFacet[data-mkws-facet='author'] div.mkwsTerm").length).toBeGreaterThan(1);
         });
     });
 });
@@ -254,7 +254,7 @@ describe("Check Author Facets", function () {
         // do not click on author names without a comma, e.g.: "Joe Barbara"
         // because searching on such authors won't find anything.
         runs(function () {
-            var terms = $("div.mkwsFacet[data-mkws-facet='author'] div.term a");
+            var terms = $("div.mkwsFacet[data-mkws-facet='author'] div.mkwsTerm a");
             for (var i = 0; i < terms.length; i++) {
                 var term = $(terms[i]).text();
                 if (term.match(/[0-9].+[0-9]/i) || !term.match(/,/)) {
@@ -264,13 +264,13 @@ describe("Check Author Facets", function () {
                     break;
                 }
             }
-            if ($("div.mkwsFacet[data-mkws-facet='author'] div.term:nth-child(" + author_number + ") a").text().length == 0) {
+            if ($("div.mkwsFacet[data-mkws-facet='author'] div.mkwsTerm:nth-child(" + author_number + ") a").text().length == 0) {
                 debug("No good authors found. Not clicking on the bad ones");
                 return;
             }
 
-            debug("Clicking on author (" + author_number + ") " + $("div.mkwsFacet[data-mkws-facet='author'] div.term:nth-child(" + author_number + ") a").text());
-            $("div.mkwsFacet[data-mkws-facet='author'] div.term:nth-child(" + author_number + ") a").trigger("click");
+            debug("Clicking on author (" + author_number + ") " + $("div.mkwsFacet[data-mkws-facet='author'] div.mkwsTerm:nth-child(" + author_number + ") a").text());
+            $("div.mkwsFacet[data-mkws-facet='author'] div.mkwsTerm:nth-child(" + author_number + ") a").trigger("click");
         });
 
         waitsFor(function () {
@@ -288,14 +288,14 @@ 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");
+            var clients = $("div.mkwsStat span.mkwsClientCount");
             // 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");
-            debug("span.clients: " + clients.text());
+            var clients = $("div.mkwsStat span.mkwsClientCount");
+            debug("span.mkwsClientCount: " + clients.text());
             expect(clients.text()).toMatch("/[1-9]+[0-9]*$");
 
             // exact match of active clients (e.g. a SP misconfiguration)
@@ -314,7 +314,7 @@ describe("Check Source Facets", function () {
         // wait for a stat response
         var waitcount = 0;
         // do not click on wikipedia link - no author or subject facets possible
-        var link = "div.mkwsFacet[data-mkws-facet='xtargets'] div.term a";
+        var link = "div.mkwsFacet[data-mkws-facet='xtargets'] div.mkwsTerm a";
 
         // wait for a visible source link in facets
         waitsFor(function () {
@@ -338,13 +338,13 @@ describe("Check Source Facets", function () {
             }
             debug("Source counter: " + terms.length + ", select: " + (source_number - 1));
 
-            if ($("div.mkwsFacet[data-mkws-facet='xtargets'] div.term:nth-child(" + source_number + ") a").text().length == 0) {
+            if ($("div.mkwsFacet[data-mkws-facet='xtargets'] div.mkwsTerm:nth-child(" + source_number + ") a").text().length == 0) {
                 debug("No good source found. Not clicking on the bad ones");
                 return;
             }
 
             debug("click on source link nth-child(): " + source_number);
-            $("div.mkwsFacet[data-mkws-facet='xtargets'] div.term:nth-child(" + source_number + ") a").trigger("click");
+            $("div.mkwsFacet[data-mkws-facet='xtargets'] div.mkwsTerm:nth-child(" + source_number + ") a").trigger("click");
 
             $(".mkwsPager").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () {
                 waitcount++;
@@ -388,20 +388,20 @@ describe("Check record list", function () {
         }
 
         waitsFor(function () {
-            var clients = $("div.mkwsStat span.clients");
+            var clients = $("div.mkwsStat span.mkwsClientCount");
             //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");
-            debug("span.clients: " + clients.text());
+            var clients = $("div.mkwsStat span.mkwsClientCount");
+            debug("span.mkwsClientCount: " + clients.text());
             expect(clients.text()).toMatch("/1$");
         });
     });
 
     it("got a record", function () {
-        var linkaddr = "div.mkwsRecords div.record:nth-child(1) a";
+        var linkaddr = "div.mkwsRecords div.mkwsSummary:nth-child(1) a";
 
         waitsFor(function () {
             // remove + insert node: must be at least 2
@@ -417,20 +417,20 @@ describe("Check record list", function () {
 describe("Show record", function () {
     var record_number = 1; // the Nth record in hit list
     it("show record author", function () {
-        var click = $("div.mkwsRecords div.record:nth-child(" + record_number + ") a").trigger("click");
+        var click = $("div.mkwsRecords div.mkwsSummary:nth-child(" + record_number + ") a").trigger("click");
         debug("show record click is success: " + click.length);
         expect(click.length).toBe(1);
 
         // wait until the record pops up
         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());
+            var show = $("div.mkwsRecords div.mkwsSummary:nth-child(" + record_number + ") > div.mkwsDetails");
+            //debug("poprecord: " + (show ? show.length : -1) + " " + $("div.mkwsRecords div.mkwsSummary").text());
             return show != null && show.length ? true : false;
         }, "wait some miliseconds to show up a record", 2 * jasmine_config.second);
 
         runs(function () {
             debug("show record pop up");
-            expect($("div.mkwsRecords div.record:nth-child(" + record_number + ") div")).not.toBe(null);
+            expect($("div.mkwsRecords div.mkwsSummary:nth-child(" + record_number + ") div")).not.toBe(null);
         });
     });
 
@@ -440,7 +440,7 @@ describe("Show record", function () {
             return;
         }
 
-        var urls = $("div.mkwsRecords div.record:nth-child(" + record_number + ") div table tbody tr td a");
+        var urls = $("div.mkwsRecords div.mkwsSummary:nth-child(" + record_number + ") div table tbody tr td a");
         debug("number of extracted URL from record: " + urls.length);
         // expect(urls.length).toBeGreaterThan(0); // LoC has records without links
         for (var i = 0; i < urls.length; i++) {
@@ -466,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
@@ -477,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/);
         });
     });
 
@@ -485,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);
     });
 });
@@ -504,7 +504,7 @@ describe("Check status client counter", function () {
         }
 
         waitsFor(function () {
-            var clients = $("div.mkwsStat span.clients");
+            var clients = $("div.mkwsStat span.mkwsClientCount");
             debug("clients: " + clients.text());
             if (clients.length == 1 && clients.text().match("0/1$")) {
                 return true;
@@ -514,8 +514,8 @@ describe("Check status client counter", function () {
         }, "wait for Active clients: 0/1", 4 * jasmine_config.second);
 
         runs(function () {
-            var clients = $("div.mkwsStat span.clients");
-            debug("span.clients: " + clients.text());
+            var clients = $("div.mkwsStat span.mkwsClientCount");
+            debug("span.mkwsClientCount: " + clients.text());
             expect(clients.text()).toMatch("0/1$");
         });
     });