function my_click(id, time) {
setTimeout(function () {
debug("trigger click on id: " + id);
- $(id).trigger("click");
- expect(time >= 0).toBeTruthy();
+ var click = $(id).trigger("click");
+
+ debug("next click is success: " + click.length);
+ expect(click.length == 1).toBe(true);
+
}, time * 1000);
}
runs(function () {
// click next/prev after N seconds
my_click("#mkwsNext", 7);
- my_click("#mkwsNext", 10);
- my_click("#mkwsPrev", 12);
+ my_click("#mkwsNext", 8);
+ my_click("#mkwsPrev", 9);
});
});
});
describe("Check pazpar2 hit counter", function () {
it("check running search hit counter", function () {
- var max_time = 10;
+ var max_time = 10; // in seconds
+ var expected_hits = 116; //
var j_time = 0;
var j_hits = 0;
runs(function () {
expect(j_time <= max_time).toBeTruthy();
- expect(j_hits).toBeGreaterThan(80);
+ expect(j_hits).toBeGreaterThan(expected_hits);
});
});
+
+ 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);
+ });
+
+ it("found Termlist", function () {
+ var termlist = $("div#mkwsTermlists");
+ debug("Termlist success: " + termlist.length);
+ expect(termlist.length == 1).toBe(true);
+
+ var sources = $("div#mkwsFacetSources");
+ expect(sources.length == 1).toBe(true);
+
+ var subjects = $("div#mkwsFacetSubjects");
+ expect(subjects.length == 1).toBe(true);
+
+ var authors = $("div#mkwsFacetAuthors");
+ expect(authors.length == 1).toBe(true);
+ });
+
+ it("Limit search to first source", function () {
+ var click = $("div#mkwsFacetSources div.term:nth-child(2) a").trigger("click");
+ debug("limit source click is success: " + click.length);
+ expect(click.length == 1).toBe(true);
+ });
+
+/*
+ it("Final success message in search input field", function () {
+ $("input#mkwsQuery").val("jasmine test is done");
+ expect($("input#mkwsQuery").val()).toMatch(/done/);
+ });
+ */
});