Show More
@@ -1,47 +1,49 b'' | |||||
1 | // |
|
1 | // | |
2 | // Test shutdown of a kernel. |
|
2 | // Test shutdown of a kernel. | |
3 | // |
|
3 | // | |
4 | casper.notebook_test(function () { |
|
4 | casper.notebook_test(function () { | |
5 | // XXX: test.begin allows named sections but requires casperjs 1.1.0-DEV. |
|
5 | // XXX: test.begin allows named sections but requires casperjs 1.1.0-DEV. | |
6 | // We will put it back into place when the next version of casper is |
|
6 | // We will put it back into place when the next version of casper is | |
7 | // released. Following that, all instances of this.test can be changed |
|
7 | // released. Following that, all instances of this.test can be changed | |
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 | // Our shutdown test closes the browser window, which will delete the |
|
11 | // Our shutdown test closes the browser window, which will delete the | |
12 | // casper browser object, and the rest of the test suite will fail with |
|
12 | // casper browser object, and the rest of the test suite will fail with | |
13 | // errors that look like: |
|
13 | // errors that look like: | |
14 | // |
|
14 | // | |
15 | // "Error: cannot access member `evaluate' of deleted QObject" |
|
15 | // "Error: cannot access member `evaluate' of deleted QObject" | |
16 | // |
|
16 | // | |
17 | // So what we do here is make a quick popup window, and run the test inside |
|
17 | // So what we do here is make a quick popup window, and run the test inside | |
18 | // of it. |
|
18 | // of it. | |
19 | this.then(function() { |
|
19 | this.then(function() { | |
20 | this.evaluate(function(url){ |
|
20 | this.evaluate(function(url){ | |
21 | window.open(url); |
|
21 | window.open(url); | |
22 | }, {url : this.getCurrentUrl()}); |
|
22 | }, {url : this.getCurrentUrl()}); | |
23 | }) |
|
23 | }) | |
24 |
|
24 | |||
25 | this.waitForPopup(''); |
|
25 | this.waitForPopup(''); | |
26 | this.withPopup('', function () { |
|
26 | this.withPopup('', function () { | |
27 | this.thenEvaluate(function () { |
|
27 | this.thenEvaluate(function () { | |
28 | $('#kill_and_exit').click(); |
|
28 | $('#kill_and_exit').click(); | |
29 | }); |
|
29 | }); | |
30 |
|
30 | |||
31 | this.thenEvaluate(function () { |
|
31 | this.thenEvaluate(function () { | |
32 | var cell = IPython.notebook.get_cell(0); |
|
32 | var cell = IPython.notebook.get_cell(0); | |
33 | cell.set_text('a=10; print(a)'); |
|
33 | cell.set_text('a=10; print(a)'); | |
34 | cell.execute(); |
|
34 | cell.execute(); | |
35 | }); |
|
35 | }); | |
36 |
|
36 | |||
37 | this.then(function () { |
|
37 | this.then(function () { | |
38 | var result = this.get_output_cell(0); |
|
38 | var outputs = this.evaluate(function() { | |
39 | this.test.assertFalsy(result, "after shutdown: no execution results"); |
|
39 | return IPython.notebook.get_cell(0).output_area.outputs; | |
|
40 | }) | |||
|
41 | this.test.assertEquals(outputs.length, 0, "after shutdown: no execution results"); | |||
40 | this.test.assertNot(this.kernel_running(), |
|
42 | this.test.assertNot(this.kernel_running(), | |
41 | 'after shutdown: IPython.notebook.kernel.running is false '); |
|
43 | 'after shutdown: IPython.notebook.kernel.running is false '); | |
42 | }); |
|
44 | }); | |
43 | }); |
|
45 | }); | |
44 |
|
46 | |||
45 | //}); // end of test.begin |
|
47 | //}); // end of test.begin | |
46 | }); |
|
48 | }); | |
47 |
|
49 |
General Comments 0
You need to be logged in to leave comments.
Login now