##// END OF EJS Templates
test keyboard interrupt shortcuts
Paul Ivanov -
Show More
@@ -1,23 +1,47 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
12 // interrupt using menu item (Kernel -> Interrupt)
11 this.thenClick('li#int_kernel');
13 this.thenClick('li#int_kernel');
12
14
13 this.wait_for_output(0);
15 this.wait_for_output(0);
14
16
15 this.then(function () {
17 this.then(function () {
16 var result = this.evaluate(function () {
18 var result = this.evaluate(function () {
17 var cell = IPython.notebook.get_cell(0);
19 var cell = IPython.notebook.get_cell(0);
18 var output = cell.output_area.outputs[0].ename;
20 var output = cell.output_area.outputs[0].ename;
19 return output;
21 return output;
20 })
22 })
21 this.test.assertEquals(result, 'KeyboardInterrupt', 'keyboard interrupt')
23 this.test.assertEquals(result, 'KeyboardInterrupt', 'keyboard interrupt (mouseclick)');
24 });
25
26 // run cell 0 again, now interrupting using keyboard shortcut
27 this.thenEvaluate(function () {
28 cell.clear_output();
29 cell.execute();
30 });
31
32 // interrupt using Ctrl-M I keyboard shortcut
33 this.thenEvaluate( function() {
34 IPython.utils.press_ghetto(IPython.utils.keycodes.I)
35 });
36
37 this.wait_for_output(0);
38
39 this.then(function () {
40 var result = this.evaluate(function () {
41 var cell = IPython.notebook.get_cell(0);
42 var output = cell.output_area.outputs[0].ename;
43 return output;
44 });
45 this.test.assertEquals(result, 'KeyboardInterrupt', 'keyboard interrupt (shortcut)');
22 });
46 });
23 });
47 });
General Comments 0
You need to be logged in to leave comments. Login now