Show More
@@ -1,47 +1,45 b'' | |||||
1 | // |
|
1 | // | |
2 | // Test kernel interrupt |
|
2 | // Test kernel interrupt | |
3 | // |
|
3 | // | |
4 | casper.notebook_test(function () { |
|
4 | casper.notebook_test(function () { | |
5 | this.evaluate(function () { |
|
5 | this.evaluate(function () { | |
6 | var cell = IPython.notebook.get_cell(0); |
|
6 | var cell = IPython.notebook.get_cell(0); | |
7 | cell.set_text('import time\nfor x in range(3):\n time.sleep(1)'); |
|
7 | cell.set_text('import time\nfor x in range(3):\n time.sleep(1)'); | |
8 | cell.execute(); |
|
8 | cell.execute(); | |
9 | }); |
|
9 | }); | |
10 |
|
10 | |||
11 |
|
11 | |||
12 | // interrupt using menu item (Kernel -> Interrupt) |
|
12 | // interrupt using menu item (Kernel -> Interrupt) | |
13 | this.thenClick('li#int_kernel'); |
|
13 | this.thenClick('li#int_kernel'); | |
14 |
|
14 | |||
15 | this.wait_for_output(0); |
|
15 | this.wait_for_output(0); | |
16 |
|
16 | |||
17 | this.then(function () { |
|
17 | this.then(function () { | |
18 | var result = this.evaluate(function () { |
|
18 | var result = this.evaluate(function () { | |
19 | var cell = IPython.notebook.get_cell(0); |
|
19 | var cell = IPython.notebook.get_cell(0); | |
20 |
|
|
20 | return cell.output_area.outputs[0].ename; | |
21 | return output; |
|
|||
22 | }) |
|
21 | }) | |
23 | this.test.assertEquals(result, 'KeyboardInterrupt', 'keyboard interrupt (mouseclick)'); |
|
22 | this.test.assertEquals(result, 'KeyboardInterrupt', 'keyboard interrupt (mouseclick)'); | |
24 | }); |
|
23 | }); | |
25 |
|
24 | |||
26 | // run cell 0 again, now interrupting using keyboard shortcut |
|
25 | // run cell 0 again, now interrupting using keyboard shortcut | |
27 | this.thenEvaluate(function () { |
|
26 | this.thenEvaluate(function () { | |
28 | cell.clear_output(); |
|
27 | cell.clear_output(); | |
29 | cell.execute(); |
|
28 | cell.execute(); | |
30 | }); |
|
29 | }); | |
31 |
|
30 | |||
32 | // interrupt using Ctrl-M I keyboard shortcut |
|
31 | // interrupt using Ctrl-M I keyboard shortcut | |
33 | this.thenEvaluate( function() { |
|
32 | this.thenEvaluate( function() { | |
34 | IPython.utils.press_ghetto(IPython.utils.keycodes.I) |
|
33 | IPython.utils.press_ghetto(IPython.utils.keycodes.I) | |
35 | }); |
|
34 | }); | |
36 |
|
35 | |||
37 | this.wait_for_output(0); |
|
36 | this.wait_for_output(0); | |
38 |
|
37 | |||
39 | this.then(function () { |
|
38 | this.then(function () { | |
40 | var result = this.evaluate(function () { |
|
39 | var result = this.evaluate(function () { | |
41 | var cell = IPython.notebook.get_cell(0); |
|
40 | var cell = IPython.notebook.get_cell(0); | |
42 |
|
|
41 | return cell.output_area.outputs[0].ename; | |
43 | return output; |
|
|||
44 | }); |
|
42 | }); | |
45 | this.test.assertEquals(result, 'KeyboardInterrupt', 'keyboard interrupt (shortcut)'); |
|
43 | this.test.assertEquals(result, 'KeyboardInterrupt', 'keyboard interrupt (shortcut)'); | |
46 | }); |
|
44 | }); | |
47 | }); |
|
45 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now