1 /* Copyright (c) 2013-2014 Index Data ApS. http://indexdata.com
3 * perform papzpar2 / pz2.js search & retrieve request in the browser
7 // get references from mkws.js, lazy evaluation
8 var debug = function (text) {
9 // use a debug function with time stamps
10 mkws.teams["AUTO"].info("Jasmine: " + text);
12 //mkws.log("Jasmine: " + text)
15 // Define empty jasmine_config for simple applications that don't define it.
16 if (jasmine_config == null || typeof jasmine_config != 'object') {
17 var jasmine_config = {};
20 var jasmine_status = {
24 /* check config for jasmine test
26 * you can override the default values in the config
27 * object: jasmine_config = {};
30 function init_jasmine_config() {
32 var jasmine_config_default = {
33 // tune parameter for batch testing
36 search_query: "freebsd",
40 // at least expected hit counter
42 // miliseconds to seconds
43 show_record_url: true,
44 // check for valid URL in records
47 // check sort by and per page menu
53 // use default values for undefined values
54 for (var key in jasmine_config_default) {
55 if (!jasmine_config.hasOwnProperty(key)) {
56 jasmine_config[key] = jasmine_config_default[key];
58 debug("jasmine config: " + key + " => " + jasmine_config[key]);
61 // jenkins batch tests
62 if (jasmine_config.batch_tuning) {
63 var sec = mkws.getParameterByName("second", document.location);
66 if (!sec && document.location.href.match(/^http:\/\/localhost:4040/)) {
70 if (sec && parseInt(sec) >= 100) {
71 jasmine_config.second = parseInt(sec);
72 debug("longer timeouts for batch testing: " + jasmine_config.second);
76 mkws.jasmine_done = false;
79 function get_hit_counter() {
82 if ($(".mkws-pager").length == 0) return -1;
84 var found = $(".mkws-pager").text();
85 var re = /\([A-Za-z]+:\s+([0-9]+)\)/;
90 hits = parseInt(RegExp.$1);
92 debug("Oooops in get_hit_counter: " + RegExp.$1 + " '" + found + "'");
96 //debug("Hits: " + hits);
100 /******************************************************************************/
101 describe("Init jasmine config", function () {
102 it("jasmine was successfully initialized", function () {
103 init_jasmine_config();
105 expect(jasmine_config.search_query).toMatch(/\w/);
106 expect(jasmine_config.second).toBeGreaterThan(100);
107 expect(jasmine_config.max_time).toBeGreaterThan(1);
108 expect(jasmine_config.expected_hits).toBeGreaterThan(1);
113 xdescribe("Check MOTD before search", function () {
116 // Check that the MOTD has been moved into its container, and
117 // is visible before the search.
118 // the mkws-motd div was originally inside a testMOTD div, which should
120 // Note that the testMOTD is a regular div, and uses #testMOTD,
121 // since the automagic class-making does not apply to it.
122 it("MOTD is hidden", function () {
123 expect($(".mkws-motd").length).toBe(1);
124 expect($("#testMOTD").length).toBe(1);
125 expect($("#testMOTD").text()).toMatch("^ *$");
128 it("mkws-motd-container has received the text", function () {
129 expect($(".mkws-motd-container").length).toBe(1);
130 expect($(".mkws-motd-container").text()).toMatch(/MOTD/);
134 describe("Check pazpar2 search", function () {
137 it("pazpar2 was successfully initialized", function () {
138 expect(mkws.config.error).toBe(undefined);
141 it("validate HTML id's", function () {
142 expect($("input.mkws-query").length).toBe(1);
143 expect($("input.mkws-button").length).toBe(1);
145 expect($(".mkws-next").length).not.toBe(1);
146 expect($(".mkws-prev").length).not.toBe(1);
149 it("run search query", function () {
150 var search_query = jasmine_config.search_query; // short hit counter with some paging
151 $("input.mkws-query").val(search_query);
152 debug("set search query: " + search_query)
153 expect($("input.mkws-query").val()).toMatch("^" + search_query + "$");
155 if (mkws.config.use_service_proxy) {
156 // wait for service proxy auth
157 waitsFor(function () {
158 return mkws.authenticated;
159 }, "SP auth done", 10 * jasmine_config.second);
161 debug("running raw pp2, don't wait for mkws auth");
165 debug("Click on submit button");
166 $("input.mkws-button").trigger("click");
171 describe("Check MOTD after search", function () {
174 it("MOTD is hidden", function () {
175 if (!jasmine_config.check_motd) {
179 expect($(".mkws-motd").length).toBe(1);
180 expect($(".mkws-motd").is(":hidden")).toBe(true);
181 debug("motd t=" + $(".mkws-motd").text());
182 debug("motd v=" + $(".mkws-motd").is(":visible"));
188 * This part runs in background. It should be rewritten with
189 * async jasmine functions
192 describe("Check pazpar2 navigation", function () {
196 it("check running search next/prev", function () {
197 expect($(".mkws-pager").length).toBe(1);
199 function my_click(id, time) {
200 setTimeout(function () {
201 debug("trigger click on id: " + id);
202 $(id).trigger("click");
203 }, time * jasmine_config.second);
206 waitsFor(function () {
207 return $("div.mkws-pager div:nth-child(2) a").length >= 2 ? true : false;
208 }, "Expect next link 2", 10 * jasmine_config.second);
211 // click next/prev after N seconds
212 my_click(".mkws-next", 0);
215 waitsFor(function () {
216 return $("div.mkws-pager div:nth-child(2) a").length >= 3 ? true : false;
217 }, "Expect next link 3", 5 * jasmine_config.second);
220 // click next/prev after N seconds
221 my_click(".mkws-next", 0);
222 my_click(".mkws-prev", 0.2);
227 describe("Check pazpar2 hit counter", function () {
230 it("check running search hit counter", function () {
231 var max_time = jasmine_config.max_time; // in seconds
232 var expected_hits = jasmine_config.expected_hits; // at least expected hit counter
235 waitsFor(function () {
236 hits = get_hit_counter();
237 return hits > expected_hits;
238 }, "Expect " + expected_hits + " hits", max_time * jasmine_config.second);
241 debug("mkws pager found records: '" + hits + "'");
242 expect($(".mkws-pager").length).toBe(1);
243 expect(hits).toBeGreaterThan(expected_hits);
248 describe("Check Facets", function () {
251 it("found Facets", function () {
252 var facets = $("div.mkws-facets");
253 debug("Facet success: " + facets.length);
254 expect(facets.length).toBe(1);
256 waitsFor(function () {
257 return $("div.mkws-facet[data-mkws-facet='xtargets']").length == 1 ? true : false;
258 }, "check for facet sources", 4 * jasmine_config.second);
260 // everything displayed?
262 var sources = $("div.mkws-facet[data-mkws-facet='xtargets']");
263 debug("Facet sources success: " + sources.length);
264 expect(sources.length).toBe(1);
266 var subjects = $("div.mkws-facet[data-mkws-facet='subject']");
267 expect(subjects.length).toBe(1);
269 var authors = $("div.mkws-facet[data-mkws-facet='author']");
270 expect(authors.length).toBe(1);
273 waitsFor(function () {
274 return $("div.mkws-facet[data-mkws-facet='author'] div.mkws-term").length >= 2 ? true : false;
275 }, "At least two author link displayed", 4 * jasmine_config.second);
278 expect($("div.mkws-facet[data-mkws-facet='author'] div.mkws-term").length).toBeGreaterThan(1);
285 describe("Check Author Facets", function () {
288 it("limit search to first author", function () {
289 if (mkws.config.disable_facet_authors_search) {
290 debug("Facets: ignore limit search for authors");
294 var hits_all_targets = get_hit_counter();
295 var author_number = 2; // 2=first author
296 // do not click on author with numbers, e.g.: "Bower, James M. Beeman, David, 1938-"
297 // do not click on author names without a comma, e.g.: "Joe Barbara"
298 // because searching on such authors won't find anything.
300 var terms = $("div.mkws-facet[data-mkws-facet='author'] div.mkws-term a");
301 for (var i = 0; i < terms.length; i++) {
302 var term = $(terms[i]).text();
303 if (term.match(/[0-9].+[0-9]/i) || !term.match(/,/)) {
304 debug("ignore author facet: " + term);
310 if ($("div.mkws-facet[data-mkws-facet='author'] div.mkws-term:nth-child(" + author_number + ") a").text().length == 0) {
311 debug("No good authors found. Not clicking on the bad ones");
315 debug("Clicking on author (" + author_number + ") " + $("div.mkws-facet[data-mkws-facet='author'] div.mkws-term:nth-child(" + author_number + ") a").text());
316 $("div.mkws-facet[data-mkws-facet='author'] div.mkws-term:nth-child(" + author_number + ") a").trigger("click");
319 waitsFor(function () {
320 var hits_single_target = get_hit_counter();
321 // debug("hits_single_target='" + hits_single_target + "' cf. hits_all_targets='" + hits_all_targets + "'");
322 return hits_single_target > 0 && hits_single_target < hits_all_targets ? true : false;
323 }, "Limited author search for less than " + hits_all_targets + " hits", 4.5 * jasmine_config.second);
326 var hits_single_target = get_hit_counter();
327 debug("get less hits for authors: " + hits_all_targets + " > " + hits_single_target);
332 describe("Check active clients author", function () {
335 it("check for active clients after limited author search", function () {
336 waitsFor(function () {
337 var clients = $("div.mkws-stat span.mkws-client-count");
338 // debug("clients: " + clients.text());
339 return clients.length == 1 && clients.text().match("/[1-9]+[0-9]*$");
340 }, "wait for Active clients: x/y", 5.5 * jasmine_config.second);
343 var clients = $("div.mkws-stat span.mkws-client-count");
344 debug("span.mkws-client-count: " + clients.text());
345 expect(clients.text()).toMatch("/[1-9]+[0-9]*$");
347 // exact match of active clients (e.g. a SP misconfiguration)
348 if (jasmine_config.active_clients) {
349 debug("check for " + jasmine_config.active_clients + " active connections");
350 expect(clients.text()).toMatch(" [0-9]+/" + jasmine_config.active_clients + "$");
355 // avoid race conditions of source facets updates
356 it("wait a little bit for a source facets update", function () {
357 // wait a half second, to show the target view
359 var time = (new Date).getTime();
361 waitsFor(function () {
362 return (new Date).getTime() - time > (waittime * jasmine_config.second) ? true : false;
363 }, "wait some miliseconds", (waittime + 0.5) * jasmine_config.second);
365 runs(function () {});
369 describe("Check Source Facets", function () {
372 it("limit search to first source", function () {
373 var hits_all_targets = get_hit_counter();
374 var source_number = 2; // 2=first source
375 // wait for a stat response
377 // do not click on wikipedia link - no author or subject facets possible
378 var link = "div.mkws-facet[data-mkws-facet='xtargets'] div.mkws-term a";
380 // wait for a visible source link in facets
381 waitsFor(function () {
383 return terms && terms.length > 0;
384 }, "wait for source facets after author search", 5 * jasmine_config.second);
389 for (var i = 0; i < terms.length; i++) {
390 var term = $(terms[i]).text();
391 debug("check for good source: " + term);
393 if (term.match(/wikipedia/i)) {
394 debug("ignore source facet: " + term);
400 debug("Source counter: " + terms.length + ", select: " + (source_number - 1));
402 if ($("div.mkws-facet[data-mkws-facet='xtargets'] div.mkws-term:nth-child(" + source_number + ") a").text().length == 0) {
403 debug("No good source found. Not clicking on the bad ones");
407 debug("click on source link nth-child(): " + source_number);
408 $("div.mkws-facet[data-mkws-facet='xtargets'] div.mkws-term:nth-child(" + source_number + ") a").trigger("click");
410 $(".mkws-pager").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () {
412 debug("DOM change mkws-pager, for stat: " + waitcount);
416 waitsFor(function () {
417 if ($("div.mkws-navi").length && $("div.mkws-navi").text().match(/(Source|datenquelle|kilder): /i)) {
422 }, "Search for source in navi bar", 4 * jasmine_config.second);
424 // Note: it may happens that limited source search returns the same number of hits
425 // as before. Thats not really an error, but unfortunate
426 waitsFor(function () {
427 var hits_single_target = get_hit_counter();
429 return waitcount >= 2 && hits_single_target > 0 && hits_single_target <= hits_all_targets ? true : false;
430 }, "Limited source search for less than " + hits_all_targets + " hits", 5 * jasmine_config.second);
433 var hits_single_target = get_hit_counter();
434 debug("get less hits for sources: " + hits_all_targets + " >= " + hits_single_target);
435 expect(hits_all_targets).not.toBeLessThan(hits_single_target);
436 jasmine_status.source_click = 1;
438 $(".mkws-pager").unbind("DOMNodeInserted DOMNodeRemoved propertychange");
444 describe("Check record list", function () {
447 it("check for single active client", function () {
448 if (!jasmine_status.source_click) {
449 debug("skip clients check due missing source click");
453 waitsFor(function () {
454 var clients = $("div.mkws-stat span.mkws-client-count");
455 //debug("clients: " + clients.text());
456 return clients.length == 1 && clients.text().match("/1$");
457 }, "wait for Active clients: x/1", 5 * jasmine_config.second);
460 var clients = $("div.mkws-stat span.mkws-client-count");
461 debug("span.mkws-client-count: " + clients.text());
462 expect(clients.text()).toMatch("/1$");
466 it("got a record", function () {
467 var linkaddr = "div.mkws-records div.mkws-summary:nth-child(1) a";
469 waitsFor(function () {
470 // remove + insert node: must be at least 2
471 return $(linkaddr).length > 0;
472 }, "wait until we see a new record", 2.5 * jasmine_config.second);
475 expect($(linkaddr).length).toBeGreaterThan(0);
480 describe("Show record", function () {
483 var record_number = 1; // the Nth record in hit list
484 it("show record author", function () {
485 var click = $("div.mkws-records div.mkws-summary:nth-child(" + record_number + ") a").trigger("click");
486 debug("show record click is success: " + click.length);
487 expect(click.length).toBe(1);
489 // wait until the record pops up
490 waitsFor(function () {
491 var show = $("div.mkws-records div.mkws-summary:nth-child(" + record_number + ") > div.mkws-details");
492 //debug("poprecord: " + (show ? show.length : -1) + " " + $("div.mkws-records div.mkws-summary").text());
493 return show != null && show.length ? true : false;
494 }, "wait some miliseconds to show up a record", 2 * jasmine_config.second);
497 debug("show record pop up");
498 expect($("div.mkws-records div.mkws-summary:nth-child(" + record_number + ") div")).not.toBe(null);
502 it("extract URL", function () {
503 if (jasmine_config.show_record_url == false) {
504 debug("ignore test for URL in record")
508 var urls = $("div.mkws-records div.mkws-summary:nth-child(" + record_number + ") div table tbody tr td a");
509 debug("number of extracted URL from record: " + urls.length);
510 // expect(urls.length).toBeGreaterThan(0); // LoC has records without links
511 for (var i = 0; i < urls.length; i++) {
512 var url = $(urls[i]);
513 debug("URL: " + url.attr('href') + " text: " + url.text());
515 expect(url.attr('href')).not.toBe(null);
516 expect(url.attr('href')).toMatch(/^https?:\/\/[a-z0-9\-]+\.[0-9a-z].*\//i);
517 expect(url.text()).not.toBe("");
522 describe("Check switch menu Records/Targets", function () {
525 it("check mkws-switch", function () {
526 expect($("div.mkws-switch").length).toBe(1);
528 // expect 2 clickable links
529 expect($("div.mkws-switch > a").length).toBe(2);
532 it("switch to target view", function () {
533 $("div.mkws-switch > a").eq(1).trigger("click");
535 // now the target table must be visible
536 expect($("div.mkws-targets").is(":visible")).toBe(true);
537 expect($("div.mkws-records").is(":visible")).toBe(false);
539 // wait a half second, to show the target view
541 var time = (new Date).getTime();
542 waitsFor(function () {
543 return (new Date).getTime() - time > (waittime * jasmine_config.second) ? true : false;
544 }, "wait some miliseconds", (waittime + 0.3) * jasmine_config.second);
546 // look for table header
548 expect($("div.mkws-targets").html()).toMatch(/Target ID/);
552 it("switch back to record view", function () {
553 $("div.mkws-switch > a").eq(0).trigger("click");
555 // now the target table must be visible
556 expect($("div.mkws-targets").is(":visible")).toBe(false);
557 expect($("div.mkws-records").is(":visible")).toBe(true);
561 describe("Check translations", function () {
564 // handle html entities, "Zurück" => "Zurück"
565 var M = function (string) {
566 var text = $("<span/>").html(mkws.M(string)).text()
567 debug("translate check for: " + text);
570 var lang = function () {
571 return mkws.config.lang
574 function check_translation(list, text) {
575 expect(list.length).toBe(text.length);
577 for (var i = 0; i < text.length; i++) {
578 expect($(list[i]).text()).toBe(M(text[i]));
582 it("check language", function () {
583 var lang = mkws.config.lang;
584 debug("lang: " + lang);
585 expect(lang).toMatch(/^(de|da|)$/);
591 "Authors": "Autoren",
592 "Subjects": "Schlagwörter",
593 "Sources": "Daten und Quellen",
594 "source": "datenquelle",
595 "Facets": "Termlisten",
597 "Prev": "Zurück",
599 "Sort by": "Sortieren nach",
600 "and show": "und zeige",
601 "per page": "pro Seite",
602 "Displaying": "Zeige",
610 "Subject": "Schlagwort",
611 "subject": "schlagwort",
613 "Records": "Datensätze",
614 "Targets": "Datenbanken",
615 "relevance": "Relevanz",
618 "oldest": "Älteste",
624 it("search button", function () {
625 var list = $(".mkws-pager-desc > span");
626 expect($("form > input[type=submit]").attr("value")).toBe(M("Search"));
629 it("switch", function () {
630 var list = $(".mkws-switch > a")
631 var text = ["Records", "Targets"];
633 check_translation(list, text);
637 it("ranking form", function () {
638 var list = $(".mkws-ranking > form > span");
639 var text = ["Sort by", "and show", "per page"];
641 check_translation(list, text);
645 expect("Sortieren nach").toBe(M("Sort by"));
646 expect("Sortieren nach").toBe($(list[0]).text());
647 } else if (lang == "da") {
648 expect("Sorter efter").toBe(M("Sort by"));
649 expect("Sorter efter").toBe($(list[0]).text());
653 expect($("select.mkws-sort > option[selected=selected]").text()).toBe(M("relevance"));
656 it("facets sidebar", function () {
657 var list = $(".mkws-facet-title");
658 var text = ["Sources", "Subjects", "Authors"];
660 check_translation(list, text);
663 it("facets navigation/filter", function () {
664 var list = $(".mkws-navi > span");
665 var text = ["source", "author"];
667 check_translation(list, text);
670 it("navigation", function () {
671 var list = $(".mkws-pager-desc > span");
672 var text = ["Displaying", "to", "of", "found"];
674 check_translation(list, text);
676 expect($(".mkws-next").text()).toBe(M("Next"));
677 expect($(".mkws-prev").text()).toBe(M("Prev"));
680 it("record details", function () {
681 var text = ["Title", "Date", "Author"]; // , "Subject", "Locations"];
682 var list = $("div.mkws-details table > tbody > tr > th");
684 // compare only the first 3 elements
685 list = list.splice(0, text.length)
687 check_translation(list, text);
692 * Status line: -- Active clients : 0/1 -- Retrieved records : 4/4
697 describe("Check status client counter", function () {
700 function get_time() {
701 var date = new Date();
702 return date.getTime();
704 var time = get_time();
706 it("check status clients", function () {
707 if (!jasmine_status.source_click) {
708 debug("skip clients check due missing source click");
712 waitsFor(function () {
713 var clients = $("div.mkws-stat span.mkws-client-count");
714 debug("clients: " + clients.text());
715 if (clients.length == 1 && clients.text().match("0/1$")) {
720 }, "wait for Active clients: 0/1", 4 * jasmine_config.second);
723 var clients = $("div.mkws-stat span.mkws-client-count");
724 debug("span.mkws-client-count: " + clients.text());
725 expect(clients.text()).toMatch("0/1$");
730 /* remove the "source" and "author" facet link to get more records again */
731 describe("Check removable facets links", function () {
734 it("remove links for source and author", function () {
736 if (!jasmine_config.check_sortby) {
737 debug("ignore check for removable facets");
743 var click = $("a.mkws-removable").eq(0).trigger("click");
744 debug("Removed first facets link: " + click.length);
745 expect(click.length).toBe(1);
749 $("div.mkws-records").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () {
751 if (waitcount <= 5 || (waitcount % 5 == 0)) {
752 debug("DOM change mkws-records for removeable: " + waitcount);
757 waitsFor(function () {
758 return waitcount >= 2 && $("a.mkws-removable").length == 1 ? 1 : 0;
759 }, "Records DOM change mkws-records, removable", 2 * jasmine_config.second);
762 debug("unbind removable");
763 $("div.mkws-records").unbind("DOMNodeInserted DOMNodeRemoved propertychange");
766 $("div.mkws-records").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () {
768 if (waitcount <= 5 || (waitcount % 5 == 0)) {
769 debug("DOM change mkws-records for removeable2: " + waitcount);
773 var click = $("a.mkws-removable").eq(0).trigger("click");
774 debug("Removed second facets link: " + click.length);
775 expect(click.length).toBe(1);
778 waitsFor(function () {
779 return waitcount >= 2 && $("a.mkws-removable").length == 0 ? true : false;
780 }, "DOM change mkws-records, removable2", 2 * jasmine_config.second);
783 debug("unbind removable2");
784 $("div.mkws-records").unbind("DOMNodeInserted DOMNodeRemoved propertychange");
790 describe("Check per page options", function () {
793 it("show per page", function () {
794 if (!jasmine_config.check_sortby) {
795 debug("ignore check for per page select");
799 var per_page_number = 20;
803 var select = $("select.mkws-perpage option[selected='selected']");
804 debug("per page default is: " + select.text() + " and unselect it");
805 select.removeAttr('selected');
807 select = $("select.mkws-perpage option[value='" + per_page_number + "']").attr('selected', true);
808 debug("per page is set to: " + select.text());
809 select.trigger("change");
811 $("div.mkws-records").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () {
813 if (waitcount <= 5 || (waitcount % 10 == 0)) {
814 debug("DOM change mkws-records, per page: " + waitcount);
819 waitsFor(function () {
820 // debug("per page waitcounter: " + waitcount)
821 return waitcount >= (per_page_number + 10) ? true : false;
822 }, "DOM change mkws-records, by per page", 3 * jasmine_config.second);
825 debug("unbind per page");
826 $("div.mkws-records").unbind("DOMNodeInserted DOMNodeRemoved propertychange");
828 var records = $("div.mkws-records > div.mkws-summary");
829 debug("Per page got now " + records.length + " records");
830 expect(records.length).toBe(per_page_number);
835 describe("Check SortBy options", function () {
838 it("sort by title", function () {
839 if (!jasmine_config.check_sortby) {
840 debug("ignore check for sort by");
845 var sort_value = 'title:1';
846 var per_page_number = 20;
848 // keep current title list
849 var title_list_old = title_list("xxx ");
851 function title_list(prefix) {
853 var terms = $("div.mkws-records > div.mkws-summary > div.mkws-field-data span.mkws-field-title");
854 for (var i = 0; i < terms.length; i++) {
855 var term = $(terms[i]).text().trim();
857 // debug(prefix + "title: " + term);
863 $("div.mkws-records").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () {
865 if (waitcount <= 5 || (waitcount % 10 == 0)) {
866 debug("DOM change mkws-records, sort by: " + waitcount);
870 var select = $("select.mkws-sort option[selected='selected']");
871 debug("Sort by default is: " + select.text() + " and unselect it");
872 select.removeAttr('selected');
874 select = $("select.mkws-sort option[value='" + sort_value + "']").attr('selected', true);
875 debug("sort by is set to: " + select.text());
876 select.trigger("change");
879 waitsFor(function () {
880 //debug("wait for2: " + waitcount);
881 return waitcount >= (per_page_number + 10) ? true : false;
882 }, "DOM change mkws-records, by sort page", 3 * jasmine_config.second);
885 $("div.mkws-records").unbind("DOMNodeInserted DOMNodeRemoved propertychange");
886 debug("unbind by sort");
888 var records = $("div.mkws-records > div.mkws-summary");
889 debug("Sort by got now " + records.length + " records");
890 expect(records.length).toBe(per_page_number);
894 var title_list_new = title_list("yyy ");
896 for (var i = 0; i < title_list_old.length; i++) {
897 debug((i + 1) + ". " + title_list_old[i] + " :: " + title_list_new[i]);
899 if (title_list_old[i] != title_list_new[i]) {
903 debug("Title changes: " + diff_flag + " out of " + per_page_number);
904 expect(diff_flag).not.toBe(0);
910 xdescribe("Check async widget discovery", function () {
912 it("initialises a new widget", function () {
913 $("div.mkws-search").after('<div id="asyncSearch"><div class="mkws-search mkws-team-async"></div></div>');
914 mkws.init("Another search box", "#asyncSearch");
915 waitsFor(function () {
916 return $("#asyncSearch input").length >= 1 ? true : false;
917 }, "Call init() to build an .mkws-search", 750);
919 var numInput = $("div.mkws-search input").length;
920 debug("Input elements present: " + numInput);
921 expect(numInput).toBe(4);
922 var numRec = $("div.mkws-records > div.mkws-summary").length;
923 debug("Records should still be present. There are: " + numRec);
924 expect(numRec).toBeGreaterThan(0);
930 describe("All tests are done", function () {
931 it(">>> hooray <<<", function () {
932 mkws.jasmine_done = true;
933 debug(">>> hooray <<<");