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 source facets", 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
540 var time = (new Date).getTime();
541 waitsFor(function () {
542 return (new Date).getTime() - time > 700 ? true : false;
543 }, "wait some miliseconds", 1 * jasmine_config.second);
545 // look for table header
547 expect($("div.mkws-targets").html()).toMatch(/Target ID/);
551 it("switch back to record view", function () {
552 $("div.mkws-switch > a").eq(0).trigger("click");
554 // now the target table must be visible
555 expect($("div.mkws-targets").is(":visible")).toBe(false);
556 expect($("div.mkws-records").is(":visible")).toBe(true);
560 describe("Check translations", function () {
563 // handle html entities, "Zurück" => "Zurück"
564 var M = function (string) {
565 var text = $("<span/>").html(mkws.M(string)).text()
566 debug("translate check for: " + text);
569 var lang = function () {
570 return mkws.config.lang
573 function check_translation(list, text) {
574 expect(list.length).toBe(text.length);
576 for (var i = 0; i < text.length; i++) {
577 expect($(list[i]).text()).toBe(M(text[i]));
581 it("check language", function () {
582 var lang = mkws.config.lang;
583 debug("lang: " + lang);
584 expect(lang).toMatch(/^(de|da|)$/);
590 "Authors": "Autoren",
591 "Subjects": "Schlagwörter",
592 "Sources": "Daten und Quellen",
593 "source": "datenquelle",
594 "Facets": "Termlisten",
596 "Prev": "Zurück",
598 "Sort by": "Sortieren nach",
599 "and show": "und zeige",
600 "per page": "pro Seite",
601 "Displaying": "Zeige",
609 "Subject": "Schlagwort",
610 "subject": "schlagwort",
612 "Records": "Datensätze",
613 "Targets": "Datenbanken",
614 "relevance": "Relevanz",
617 "oldest": "Älteste",
623 it("search button", function () {
624 var list = $(".mkws-pager-desc > span");
625 expect($("form > input[type=submit]").attr("value")).toBe(M("Search"));
628 it("switch", function () {
629 var list = $(".mkws-switch > a")
630 var text = ["Records", "Targets"];
632 check_translation(list, text);
636 it("ranking form", function () {
637 var list = $(".mkws-ranking > form > span");
638 var text = ["Sort by", "and show", "per page"];
640 check_translation(list, text);
644 expect("Sortieren nach").toBe(M("Sort by"));
645 expect("Sortieren nach").toBe($(list[0]).text());
646 } else if (lang == "da") {
647 expect("Sorter efter").toBe(M("Sort by"));
648 expect("Sorter efter").toBe($(list[0]).text());
652 expect($("select.mkws-sort > option[selected=selected]").text()).toBe(M("relevance"));
655 it("facets sidebar", function () {
656 var list = $(".mkws-facet-title");
657 var text = ["Sources", "Subjects", "Authors"];
659 check_translation(list, text);
662 it("facets navigation/filter", function () {
663 var list = $(".mkws-navi > span");
664 var text = ["source", "author"];
666 check_translation(list, text);
669 it("navigation", function () {
670 var list = $(".mkws-pager-desc > span");
671 var text = ["Displaying", "to", "of", "found"];
673 check_translation(list, text);
675 expect($(".mkws-next").text()).toBe(M("Next"));
676 expect($(".mkws-prev").text()).toBe(M("Prev"));
679 it("record details", function () {
680 var text = ["Title", "Date", "Author"]; // , "Subject", "Locations"];
681 var list = $("div.mkws-details table > tbody > tr > th");
683 // compare only the first 3 elements
684 list = list.splice(0, text.length)
686 check_translation(list, text);
691 * Status line: -- Active clients : 0/1 -- Retrieved records : 4/4
696 describe("Check status client counter", function () {
699 function get_time() {
700 var date = new Date();
701 return date.getTime();
703 var time = get_time();
705 it("check status clients", function () {
706 if (!jasmine_status.source_click) {
707 debug("skip clients check due missing source click");
711 waitsFor(function () {
712 var clients = $("div.mkws-stat span.mkws-client-count");
713 debug("clients: " + clients.text());
714 if (clients.length == 1 && clients.text().match("0/1$")) {
719 }, "wait for Active clients: 0/1", 4 * jasmine_config.second);
722 var clients = $("div.mkws-stat span.mkws-client-count");
723 debug("span.mkws-client-count: " + clients.text());
724 expect(clients.text()).toMatch("0/1$");
729 /* remove the "source" and "author" facet link to get more records again */
730 describe("Check removable facets links", function () {
733 it("remove links for source and author", function () {
735 if (!jasmine_config.check_sortby) {
736 debug("ignore check for removable facets");
742 var click = $("a.mkws-removable").eq(0).trigger("click");
743 debug("Removed first facets link: " + click.length);
744 expect(click.length).toBe(1);
748 $("div.mkws-records").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () {
750 if (waitcount <= 5 || (waitcount % 5 == 0)) {
751 debug("DOM change mkws-records for removeable: " + waitcount);
756 waitsFor(function () {
757 return waitcount >= 2 && $("a.mkws-removable").length == 1 ? 1 : 0;
758 }, "Records DOM change mkws-records, removable", 2 * jasmine_config.second);
761 debug("unbind removable");
762 $("div.mkws-records").unbind("DOMNodeInserted DOMNodeRemoved propertychange");
765 $("div.mkws-records").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () {
767 if (waitcount <= 5 || (waitcount % 5 == 0)) {
768 debug("DOM change mkws-records for removeable2: " + waitcount);
772 var click = $("a.mkws-removable").eq(0).trigger("click");
773 debug("Removed second facets link: " + click.length);
774 expect(click.length).toBe(1);
777 waitsFor(function () {
778 return waitcount >= 2 && $("a.mkws-removable").length == 0 ? true : false;
779 }, "DOM change mkws-records, removable2", 2 * jasmine_config.second);
782 debug("unbind removable2");
783 $("div.mkws-records").unbind("DOMNodeInserted DOMNodeRemoved propertychange");
789 describe("Check per page options", function () {
792 it("show per page", function () {
793 if (!jasmine_config.check_sortby) {
794 debug("ignore check for per page select");
798 var per_page_number = 20;
802 var select = $("select.mkws-perpage option[selected='selected']");
803 debug("per page default is: " + select.text() + " and unselect it");
804 select.removeAttr('selected');
806 select = $("select.mkws-perpage option[value='" + per_page_number + "']").attr('selected', true);
807 debug("per page is set to: " + select.text());
808 select.trigger("change");
810 $("div.mkws-records").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () {
812 if (waitcount <= 5 || (waitcount % 10 == 0)) {
813 debug("DOM change mkws-records, per page: " + waitcount);
818 waitsFor(function () {
819 // debug("per page waitcounter: " + waitcount)
820 return waitcount >= (per_page_number + 10) ? true : false;
821 }, "DOM change mkws-records, by per page", 3 * jasmine_config.second);
824 debug("unbind per page");
825 $("div.mkws-records").unbind("DOMNodeInserted DOMNodeRemoved propertychange");
827 var records = $("div.mkws-records > div.mkws-summary");
828 debug("Per page got now " + records.length + " records");
829 expect(records.length).toBe(per_page_number);
834 describe("Check SortBy options", function () {
837 it("sort by title", function () {
838 if (!jasmine_config.check_sortby) {
839 debug("ignore check for sort by");
844 var sort_value = 'title:1';
845 var per_page_number = 20;
847 // keep current title list
848 var title_list_old = title_list("xxx ");
850 function title_list(prefix) {
852 var terms = $("div.mkws-records > div.mkws-summary > div.mkws-field-data span.mkws-field-title");
853 for (var i = 0; i < terms.length; i++) {
854 var term = $(terms[i]).text().trim();
856 // debug(prefix + "title: " + term);
862 $("div.mkws-records").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () {
864 if (waitcount <= 5 || (waitcount % 10 == 0)) {
865 debug("DOM change mkws-records, sort by: " + waitcount);
869 var select = $("select.mkws-sort option[selected='selected']");
870 debug("Sort by default is: " + select.text() + " and unselect it");
871 select.removeAttr('selected');
873 select = $("select.mkws-sort option[value='" + sort_value + "']").attr('selected', true);
874 debug("sort by is set to: " + select.text());
875 select.trigger("change");
878 waitsFor(function () {
879 //debug("wait for2: " + waitcount);
880 return waitcount >= (per_page_number + 10) ? true : false;
881 }, "DOM change mkws-records, by sort page", 3 * jasmine_config.second);
884 $("div.mkws-records").unbind("DOMNodeInserted DOMNodeRemoved propertychange");
885 debug("unbind by sort");
887 var records = $("div.mkws-records > div.mkws-summary");
888 debug("Sort by got now " + records.length + " records");
889 expect(records.length).toBe(per_page_number);
893 var title_list_new = title_list("yyy ");
895 for (var i = 0; i < title_list_old.length; i++) {
896 debug((i + 1) + ". " + title_list_old[i] + " :: " + title_list_new[i]);
898 if (title_list_old[i] != title_list_new[i]) {
902 debug("Title changes: " + diff_flag + " out of " + per_page_number);
903 expect(diff_flag).not.toBe(0);
909 xdescribe("Check async widget discovery", function () {
911 it("initialises a new widget", function () {
912 $("div.mkws-search").after('<div id="asyncSearch"><div class="mkws-search mkws-team-async"></div></div>');
913 mkws.init("Another search box", "#asyncSearch");
914 waitsFor(function () {
915 return $("#asyncSearch input").length >= 1 ? true : false;
916 }, "Call init() to build an .mkws-search", 750);
918 var numInput = $("div.mkws-search input").length;
919 debug("Input elements present: " + numInput);
920 expect(numInput).toBe(4);
921 var numRec = $("div.mkws-records > div.mkws-summary").length;
922 debug("Records should still be present. There are: " + numRec);
923 expect(numRec).toBeGreaterThan(0);
929 describe("All tests are done", function () {
930 it(">>> hooray <<<", function () {
931 mkws.jasmine_done = true;
932 debug(">>> hooray <<<");