check status field
[mkws-moved-to-github.git] / test / spec / mkws-pazpar2.js
index 20bc067..a3a9983 100644 (file)
@@ -68,16 +68,14 @@ describe("Check pazpar2 hit counter", function () {
             expect(hits).toBeGreaterThan(0);
         }
 
-        debug("Hits: " + hits);
+        //debug("Hits: " + hits);
         return hits;
     }
 
     function show_record() {
-        it("Show record", function () {
-            var click = $("div#mkwsRecords div.record:nth-child(3) :nth-child(2)").trigger("click");
-            debug("show click is success: " + click.length);
-            expect(click.length == 1).toBe(true);
-        });
+        var click = $("div#mkwsRecords div.record:nth-child(3) :nth-child(2)").trigger("click");
+        debug("show click is success: " + click.length);
+        expect(click.length == 1).toBe(true);
     }
 
     it("check running search hit counter", function () {
@@ -145,7 +143,6 @@ describe("Check pazpar2 hit counter", function () {
         expect(authors.length == 1).toBe(true);
     });
 
-    // show_record();
     it("Limit search to first source", function () {
         var hits_all_targets = get_hit_counter();
 
@@ -172,7 +169,6 @@ describe("Check pazpar2 hit counter", function () {
         });
     });
 
-    // show_record();
     it("Limit search to first author", function () {
         var hits_all_targets = get_hit_counter();
 
@@ -191,5 +187,35 @@ describe("Check pazpar2 hit counter", function () {
         });
     });
 
-    // show_record();
+    it("Show record author", function () {
+        show_record();
+    });
+});
+
+describe("Check status client counter", function () {
+    function get_time() {
+        var date = new Date();
+        return date.getTime();
+    }
+    var time = get_time();
+
+    it("Limit search to first author", function () {
+
+        waitsFor(function () {
+            var clients = $("div#mkwsStat span.clients");
+            if (clients.length == 1 && clients.text() == "0/1") {
+                return true;
+            } else {
+                return false;
+            }
+
+        }, "wait for status", 4 * 1000);
+
+    });
+    runs(function () {
+        var clients = $("div#mkwsStat span.clients");
+        debug("span.clients: " + clients.text());
+        expect(clients.text()).toEqual("0/1");
+    });
+
 });