Show More
@@ -15,11 +15,8 casper.notebook_test(function () { | |||
|
15 | 15 | this.wait_for_output(0); |
|
16 | 16 | |
|
17 | 17 | this.then(function () { |
|
18 |
var result = this. |
|
|
19 | var cell = IPython.notebook.get_cell(0); | |
|
20 | return cell.output_area.outputs[0].ename; | |
|
21 | }) | |
|
22 | this.test.assertEquals(result, 'KeyboardInterrupt', 'keyboard interrupt (mouseclick)'); | |
|
18 | var result = this.get_output_cell(0); | |
|
19 | this.test.assertEquals(result.ename, 'KeyboardInterrupt', 'keyboard interrupt (mouseclick)'); | |
|
23 | 20 | }); |
|
24 | 21 | |
|
25 | 22 | // run cell 0 again, now interrupting using keyboard shortcut |
@@ -36,10 +33,7 casper.notebook_test(function () { | |||
|
36 | 33 | this.wait_for_output(0); |
|
37 | 34 | |
|
38 | 35 | this.then(function () { |
|
39 |
var result = this. |
|
|
40 | var cell = IPython.notebook.get_cell(0); | |
|
41 | return cell.output_area.outputs[0].ename; | |
|
42 | }); | |
|
43 | this.test.assertEquals(result, 'KeyboardInterrupt', 'keyboard interrupt (shortcut)'); | |
|
36 | var result = this.get_output_cell(0); | |
|
37 | this.test.assertEquals(result.ename, 'KeyboardInterrupt', 'keyboard interrupt (shortcut)'); | |
|
44 | 38 | }); |
|
45 | 39 | }); |
@@ -10,13 +10,10 casper.notebook_test(function () { | |||
|
10 | 10 | |
|
11 | 11 | this.wait_for_output(0); |
|
12 | 12 | |
|
13 | // refactor this into just a get_output(0) | |
|
13 | 14 | this.then(function () { |
|
14 |
var result = this. |
|
|
15 | var cell = IPython.notebook.get_cell(0); | |
|
16 | var output = cell.output_area.outputs[0].text; | |
|
17 | return output; | |
|
18 | }) | |
|
19 | this.test.assertEquals(result, '10\n', 'cell execute (using js)') | |
|
15 | var result = this.get_output_cell(0); | |
|
16 | this.test.assertEquals(result.text, '10\n', 'cell execute (using js)') | |
|
20 | 17 | }); |
|
21 | 18 | |
|
22 | 19 | |
@@ -31,12 +28,8 casper.notebook_test(function () { | |||
|
31 | 28 | this.wait_for_output(0); |
|
32 | 29 | |
|
33 | 30 | this.then(function () { |
|
34 |
var result = this. |
|
|
35 | var cell = IPython.notebook.get_cell(0); | |
|
36 | var output = cell.output_area.outputs[0].text; | |
|
37 | return output; | |
|
38 | }) | |
|
39 | this.test.assertEquals(result, '11\n', 'cell execute (using ctrl-enter)') | |
|
31 | var result = this.get_output_cell(0); | |
|
32 | this.test.assertEquals(result.text, '11\n', 'cell execute (using ctrl-enter)') | |
|
40 | 33 | }); |
|
41 | 34 | |
|
42 | 35 | // do it again with the keyboard shortcut |
@@ -50,11 +43,7 casper.notebook_test(function () { | |||
|
50 | 43 | this.wait_for_output(0); |
|
51 | 44 | |
|
52 | 45 | this.then(function () { |
|
53 |
var result = this. |
|
|
54 | var cell = IPython.notebook.get_cell(0); | |
|
55 | var output = cell.output_area.outputs[0].text; | |
|
56 | return output; | |
|
57 | }) | |
|
58 | this.test.assertEquals(result, '12\n', 'cell execute (using shift-enter)') | |
|
46 | var result = this.get_output_cell(0); | |
|
47 | this.test.assertEquals(result.text, '12\n', 'cell execute (using shift-enter)') | |
|
59 | 48 | }); |
|
60 | 49 | }); |
@@ -68,6 +68,16 casper.wait_for_output = function (cell_num) { | |||
|
68 | 68 | }); |
|
69 | 69 | }; |
|
70 | 70 | |
|
71 | // return the output of a given cell | |
|
72 | casper.get_output_cell = function (cell_num) { | |
|
73 | var result = casper.evaluate(function (c) { | |
|
74 | var cell = IPython.notebook.get_cell(c); | |
|
75 | return cell.output_area.outputs[0]; | |
|
76 | }, | |
|
77 | {c : cell_num}); | |
|
78 | return result; | |
|
79 | }; | |
|
80 | ||
|
71 | 81 | // Wrap a notebook test to reduce boilerplate. |
|
72 | 82 | casper.notebook_test = function(test) { |
|
73 | 83 | this.open_new_notebook(); |
General Comments 0
You need to be logged in to leave comments.
Login now