X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fspec%2Fmkws-pazpar2.js;h=50dfa94020092d9c7c50f1cb033f6e3f21cbcad4;hb=4028a2d1508ac4ce5734a6842ac16423eee327b2;hp=66437914b70e2936fee6427af3b302b8d7716a5c;hpb=3e2d556873ff8f507caea7a6918ad630b634daf1;p=mkws-moved-to-github.git diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index 6643791..50dfa94 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -312,12 +312,24 @@ describe("Check Termlist", function () { describe("Show record", function () { var record_number = 1; // the Nth record in hit list it("show record author", function () { - $("div.mkwsRecords div.record:nth-child(" + record_number + ") a").trigger("click"); -/* debug("### click=" + typeof(click) + " " + click ); - debug("### len=" + click.length ); - debug("show record click is success: " + click.length); - expect(click.length).toBe(1); -*/ + // make sure we have a link. + var linkaddr = "div.mkwsRecords div.record:nth-child(1) a"; + var waitcount = 0; + waitsFor(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); + + runs(function(){ + var link = $(linkaddr); + debug("== waited (" + waitcount + ") for the link..." + $(linkaddr) + + " =" + $(linkaddr).length + " " + $(linkaddr).text() ); + expect(link.length).toBe(1); + link.trigger("click"); + }); + // wait until the record pops up waitsFor(function () { var show = $("div.mkwsRecords div.record:nth-child(" + record_number + ") div");