From: Wolfram Schneider Date: Mon, 10 Mar 2014 13:59:01 +0000 (+0000) Subject: wait for new records HTML data before we click on a record, MKWS-137 X-Git-Tag: 1.0.0~1318^2~12 X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=commitdiff_plain;h=629f916bd15890ad6ac22d79fe45dbbd0286620c;hp=30d4c34eebe574801b03fb88293c74728d9aaf82 wait for new records HTML data before we click on a record, MKWS-137 If we click on a limit source link we have to wait until the pz2 show() record request returns fresh data from the new result set. This is implemented by the DOMSubtreeModified event. --- diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index cb5ba41..7e180c3 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -318,24 +318,26 @@ describe("Check Termlist", function () { }); }); + describe("Check record list", function () { it("got a record", function () { - // make sure we have a link. - var linkaddr = "div.mkwsRecords div.record:nth-child(1) a"; var waitcount = 0; - waitsFor(function () { + // wait for new records + $("div.mkwsRecords").bind("DOMSubtreeModified", function () { waitcount++; - debug("waiting for the link " + waitcount + " " + $(linkaddr) + " =" + $(linkaddr).length + " " + $(linkaddr).text()); - return ($(linkaddr).length > 0); - }, "wait until we see a link", 1 * jasmine_config.second); + debug("DOM div.mkwsRecords changed"); + }); + + waitsFor(function () { + return waitcount; + }, "wait until we see a record", 1.5 * jasmine_config.second); runs(function () { - var link = $(linkaddr); - debug("== waited (" + waitcount + ") for the link..." + $(linkaddr) + " =" + $(linkaddr).length + " " + $(linkaddr).text()); - expect(link.length).toBe(1); - // link.trigger("click"); + expect(waitcount).toBeGreaterThan(0); + $("div.mkwsRecords").unbind("DOMSubtreeModified"); }); + }); });