##// END OF EJS Templates
Merge pull request #6371 from minrk/dashboard-test-quickfix...
Paul Ivanov -
r17718:7b9c8e0c merge
parent child Browse files
Show More
@@ -1,40 +1,41 b''
1
1
2
2
3 casper.get_list_items = function () {
3 casper.get_list_items = function () {
4 return this.evaluate(function () {
4 return this.evaluate(function () {
5 return $.makeArray($('.item_link').map(function () {
5 return $.makeArray($('.item_link').map(function () {
6 return {
6 return {
7 link: $(this).attr('href'),
7 link: $(this).attr('href'),
8 label: $(this).find('.item_name').text()
8 label: $(this).find('.item_name').text()
9 }
9 };
10 }));
10 }));
11 });
11 });
12 }
12 };
13
13
14 casper.test_items = function (baseUrl) {
14 casper.test_items = function (baseUrl) {
15 casper.then(function () {
15 casper.then(function () {
16 var items = casper.get_list_items();
16 var items = casper.get_list_items();
17 casper.each(items, function (self, item) {
17 casper.each(items, function (self, item) {
18 if (!item.label.match('.ipynb$')) {
18 if (!item.label.match(/\.ipynb$/)) {
19 var followed_url = baseUrl+item.link;
19 var followed_url = baseUrl+item.link;
20 if (!followed_url.match('/\.\.$')) {
20 if (!followed_url.match(/\/\.\.$/)) {
21 casper.thenOpen(followed_url, function () {
21 casper.thenOpen(followed_url, function () {
22 this.waitFor(this.page_loaded);
22 casper.wait_for_dashboard();
23 casper.wait_for_dashboard();
23 // getCurrentUrl is with host, and url-decoded,
24 // getCurrentUrl is with host, and url-decoded,
24 // but item.link is without host, and url-encoded
25 // but item.link is without host, and url-encoded
25 var expected = baseUrl + decodeURIComponent(item.link);
26 var expected = baseUrl + decodeURIComponent(item.link);
26 this.test.assertEquals(this.getCurrentUrl(), expected, 'Testing dashboard link: ' + expected);
27 this.test.assertEquals(this.getCurrentUrl(), expected, 'Testing dashboard link: ' + expected);
27 casper.test_items(baseUrl);
28 casper.test_items(baseUrl);
28 this.back();
29 this.back();
29 });
30 });
30 }
31 }
31 }
32 }
32 });
33 });
33 });
34 });
34 }
35 };
35
36
36 casper.dashboard_test(function () {
37 casper.dashboard_test(function () {
37 baseUrl = this.get_notebook_server();
38 baseUrl = this.get_notebook_server();
38 casper.test_items(baseUrl);
39 casper.test_items(baseUrl);
39 })
40 });
40
41
General Comments 0
You need to be logged in to leave comments. Login now