+ // 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");
+ return show != null && show.length ? true : false;
+ }, "wait some miliseconds to show up a record", 2 * jasmine_config.second);
+
+ runs(function () {
+ debug("show record pop up");
+ expect($("div.mkwsRecords div.record:nth-child(" + record_number + ") div")).not.toBe(null);
+ });
+ });
+
+ it("extract URL", function () {
+ if (jasmine_config.show_record_url == false) {
+ debug("ignore test for URL in record")
+ return;
+ }
+
+ var urls = $("div#mkwsRecords div.record:nth-child(" + record_number + ") div table tbody tr td a");
+ debug("number of extracted URL from record: " + urls.length);
+ for (var i = 0; i < urls.length; i++) {
+ var url = $(urls[i]);
+ debug("URL: " + url.attr('href'));
+ expect(url.attr('href')).not.toBe(null);
+ expect(url.attr('href')).toMatch(/^https?:\/\/[a-z0-9]+\.[0-9a-z].*\//i);
+ expect(url.attr('href')).toBe(url.text());
+ }