+ debug("show record pop up");
+ expect(mkws.$("div.mkwsRecords div.mkwsSummary: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 = mkws.$("div.mkwsRecords div.mkwsSummary:nth-child(" + record_number + ") div table tbody tr td a");
+ debug("number of extracted URL from record: " + urls.length);
+ // expect(urls.length).toBeGreaterThan(0); // LoC has records without links
+ for (var i = 0; i < urls.length; i++) {
+ var url = mkws.$(urls[i]);
+ debug("URL: " + url.attr('href') + " text: " + url.text());
+
+ expect(url.attr('href')).not.toBe(null);
+ expect(url.attr('href')).toMatch(/^https?:\/\/[a-z0-9\-]+\.[0-9a-z].*\//i);
+ expect(url.text()).not.toBe("");
+ }
+ });
+});
+
+describe("Check switch menu Records/Targets", function () {
+ it("check mkwsSwitch", function () {
+ expect(mkws.$("div.mkwsSwitch").length).toBe(1);
+
+ // expect 2 clickable links
+ expect(mkws.$("div.mkwsSwitch a").length).toBe(2);
+ });
+
+ it("switch to target view", function () {
+ mkws.$("div.mkwsSwitch").children('a').eq(1).trigger("click");
+
+ // now the target table must be visible
+ expect(mkws.$("div.mkwsTargets").is(":visible")).toBe(true);
+ expect(mkws.$("div.mkwsRecords").is(":visible")).toBe(false);
+
+ // wait a half second, to show the target view
+ var time = (new Date).getTime();
+ waitsFor(function () {
+ return (new Date).getTime() - time > 700 ? true : false;
+ }, "wait some miliseconds", 1 * jasmine_config.second);
+
+ // look for table header
+ runs(function () {
+ expect(mkws.$("div.mkwsTargets").html()).toMatch(/Target ID/);
+ });
+ });
+
+ it("switch back to record view", function () {
+ mkws.$("div.mkwsSwitch").children('a').eq(0).trigger("click");
+
+ // now the target table must be visible
+ expect(mkws.$("div.mkwsTargets").is(":visible")).toBe(false);
+ expect(mkws.$("div.mkwsRecords").is(":visible")).toBe(true);
+ });
+});
+
+describe("Check status client counter", function () {
+ function get_time() {
+ var date = new Date();
+ return date.getTime();
+ }
+ var time = get_time();
+
+ it("check status clients", function () {
+ if (!jasmine_status.source_click) {
+ debug("skip clients check due missing source click");
+ return;
+ }
+
+ waitsFor(function () {
+ var clients = mkws.$("div.mkwsStat span.mkwsClientCount");
+ debug("clients: " + clients.text());
+ if (clients.length == 1 && clients.text().match("0/1$")) {
+ return true;
+ } else {
+ return false;
+ }
+ }, "wait for Active clients: 0/1", 4 * jasmine_config.second);
+
+ runs(function () {
+ var clients = mkws.$("div.mkwsStat span.mkwsClientCount");
+ debug("span.mkwsClientCount: " + clients.text());
+ expect(clients.text()).toMatch("0/1$");