Show More
@@ -8,25 +8,39 b' casper.notebook_test(function () {' | |||||
8 | // to just test. |
|
8 | // to just test. | |
9 | //this.test.begin("shutdown tests (notebook)", 2, function(test) { |
|
9 | //this.test.begin("shutdown tests (notebook)", 2, function(test) { | |
10 |
|
10 | |||
11 | this.thenEvaluate(function () { |
|
11 | // Our shutdown test closes the browser window, which will delete the | |
12 | $('#kill_and_exit').click(); |
|
12 | // casper browser object, and the rest of the test suite will fail with | |
13 | }); |
|
13 | // errors that look like: | |
14 |
|
14 | // | ||
15 | this.thenEvaluate(function () { |
|
15 | // "Error: cannot access member `evaluate' of deleted QObject" | |
16 | var cell = IPython.notebook.get_cell(0); |
|
16 | // | |
17 | cell.set_text('a=10; print(a)'); |
|
17 | // So what we do here is make a quick popup window, and run the test inside | |
18 | cell.execute(); |
|
18 | // of it. | |
19 | }); |
|
19 | this.then(function() { | |
|
20 | this.evaluate(function(url){ | |||
|
21 | window.open(url); | |||
|
22 | }, {url : this.getCurrentUrl()}); | |||
|
23 | }) | |||
20 |
|
24 | |||
21 | // refactor this into just a get_output(0) |
|
25 | this.waitForPopup(''); | |
22 |
this. |
|
26 | this.withPopup('', function () { | |
23 | var result = this.get_output_cell(0); |
|
27 | this.thenEvaluate(function () { | |
24 | this.test.assertFalsy(result, "after shutdown: no execution results"); |
|
28 | $('#kill_and_exit').click(); | |
25 | this.test.assertNot(this.kernel_running(), |
|
29 | }); | |
26 | 'after shutdown: IPython.notebook.kernel.running is false '); |
|
|||
27 | }); |
|
|||
28 |
|
30 | |||
29 | this.thenOpen(this.get_notebook_server()); |
|
31 | this.thenEvaluate(function () { | |
|
32 | var cell = IPython.notebook.get_cell(0); | |||
|
33 | cell.set_text('a=10; print(a)'); | |||
|
34 | cell.execute(); | |||
|
35 | }); | |||
|
36 | ||||
|
37 | this.then(function () { | |||
|
38 | var result = this.get_output_cell(0); | |||
|
39 | this.test.assertFalsy(result, "after shutdown: no execution results"); | |||
|
40 | this.test.assertNot(this.kernel_running(), | |||
|
41 | 'after shutdown: IPython.notebook.kernel.running is false '); | |||
|
42 | }); | |||
|
43 | }); | |||
30 |
|
44 | |||
31 | //}); // end of test.begin |
|
45 | //}); // end of test.begin | |
32 | }); |
|
46 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now