From: Wolfram Schneider Date: Thu, 22 Aug 2013 14:48:45 +0000 (+0200) Subject: check running pazpar2 X-Git-Tag: 0.9.1~202^2~75 X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=d0638d5cb4d9222b6928e52219ca86181d8193fc;hp=0eea35112a21e54312e88c62afc5afb0160010da;p=mkws-moved-to-github.git check running pazpar2 --- diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js new file mode 100644 index 0000000..491db0f --- /dev/null +++ b/test/spec/mkws-pazpar2.js @@ -0,0 +1,61 @@ +/* Copyright (c) 2013 IndexData ApS. http://indexdata.com + * + * perform papzpar2 / pz2.js search & retrieve request in the browser + * + */ + +function my_click(id, time) { + setTimeout(function () { + debug("trigger click on id: " + id); + $(id).trigger("click"); + }, time * 1000); +} + +function found(time) { + setTimeout(function () { + var found = $("#mkwsPager").html().match(/found: ([0-9]+)/); + debug("mkws pager found records: " + (found != null ? found[0] : "unknown")); + }, time * 1000); +} + +describe("Check pazpar2 search", function () { + it("pazpar2 was successfully initialize", function () { + expect(mkws_config.error).toBe(undefined); + }); + + it("validate HTML id's", function () { + expect($("input#mkwsQuery").length == 1).toBe(true); + expect($("input#mkwsButton").length == 1).toBe(true); + + expect($("#mkwsNext").length == 1).toBe(false); + expect($("#mkwsPrev").length == 1).toBe(false); + }); + + it("run search query", function () { + $("input#mkwsQuery").val("freebsd"); + expect($("input#mkwsQuery").val()).toMatch(/^freebsd$/); + + setTimeout(function () { + $("input#mkwsButton").trigger("click"); + }, 3 * 1000); + }); + + + it("check running search", function () { + my_click("#mkwsNext", 10); + my_click("#mkwsNext", 13); + my_click("#mkwsPrev", 15); + + if ($("#mkwsPager").length) { + found(0); + found(5); + found(10); + found(15); + found(25); + + } else { + debug("no mkws page found"); + } + }); + +});