projects
/
mkws-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7ad647d
)
nearly working version
author
Wolfram Schneider
<wosch@indexdata.dk>
Thu, 22 Aug 2013 15:29:01 +0000
(17:29 +0200)
committer
Wolfram Schneider
<wosch@indexdata.dk>
Thu, 22 Aug 2013 15:29:01 +0000
(17:29 +0200)
test/spec/mkws-pazpar2.js
patch
|
blob
|
history
diff --git
a/test/spec/mkws-pazpar2.js
b/test/spec/mkws-pazpar2.js
index
491db0f
..
fe05c51
100644
(file)
--- a/
test/spec/mkws-pazpar2.js
+++ b/
test/spec/mkws-pazpar2.js
@@
-4,6
+4,11
@@
*
*/
*
*/
+// global state object
+var jasmine_state = {
+ time: 0
+};
+
function my_click(id, time) {
setTimeout(function () {
debug("trigger click on id: " + id);
function my_click(id, time) {
setTimeout(function () {
debug("trigger click on id: " + id);
@@
-11,10
+16,26
@@
function my_click(id, time) {
}, time * 1000);
}
}, time * 1000);
}
-function found(time) {
+function found(time, none) {
setTimeout(function () {
setTimeout(function () {
+ jasmine_state.time = time;
+
var found = $("#mkwsPager").html().match(/found: ([0-9]+)/);
var found = $("#mkwsPager").html().match(/found: ([0-9]+)/);
- debug("mkws pager found records: " + (found != null ? found[0] : "unknown"));
+
+ describe("pazpar2 hit count", function () {
+ if (none) {
+ it("no results yet", function () {
+ expect(found).toBe(null);
+ });
+ } else {
+ it("got results", function () {
+ expect(found[0]).toMatch(/^[0-9]+$/);
+ });
+ }
+ debug("mkws pager found records: " + (found != null ? found[0] : "unknown"));
+ debug("time state: " + jasmine_state.time);
+ });
+
}, time * 1000);
}
}, time * 1000);
}
@@
-41,21
+62,39
@@
describe("Check pazpar2 search", function () {
});
});
+ // Asynchronous part
it("check running search", function () {
it("check running search", function () {
- my_click("#mkwsNext", 10);
- my_click("#mkwsNext", 13);
- my_click("#mkwsPrev", 15);
+ var max_time = 10;
+
+ expect($("#mkwsPager").length == 1).toBe(true);
- if ($("#mkwsPager").length) {
- found(0);
+ runs(function () {
+ // click next/prev after N seconds
+ my_click("#mkwsNext", 10);
+ my_click("#mkwsNext", 13);
+ my_click("#mkwsPrev", 15);
+
+ // check hit counter after N seconds
+ found(0, true);
found(5);
found(10);
found(15);
found(5);
found(10);
found(15);
- found(25);
+ found(max_time);
+ });
- } else {
- debug("no mkws page found");
- }
- });
+/*
+ waitsFor(function () {
+ return jasmine_state.time == max_time ? true : false;
+ }, "The Value should be 20 seconds", 30 * 1000); // (max_time + 1) * 1000);
+ runs(function () {
+ expect($("#mkwsPager").length == 1).toBe(true);
+ })
+ */
+
+/* runs(function () {
+ expect(jasmine_state.time).toEqual(max_time);
+ });
+ */
+ });
});
});