##// END OF EJS Templates
don't delete casper instance on shutdown test...
don't delete casper instance on shutdown test a lunch conversation with @minrk and @takluyver lead me to just make a popup and have it be closed, instead of having to reorder the test suite so that this test always runs last. Now it doesn't matter what order the test suite runs in, and gives us a pattern for testing window closing behavior should we need it elsewhere.

File last commit:

r13299:b4062264
r13416:4c4050a7
Show More
check_interrupt.js
39 lines | 1.1 KiB | application/javascript | JavascriptLexer
Paul Ivanov
test kernel interrupt
r13289 //
// Test kernel interrupt
//
casper.notebook_test(function () {
this.evaluate(function () {
var cell = IPython.notebook.get_cell(0);
cell.set_text('import time\nfor x in range(3):\n time.sleep(1)');
cell.execute();
});
Paul Ivanov
test keyboard interrupt shortcuts
r13297
// interrupt using menu item (Kernel -> Interrupt)
Paul Ivanov
test kernel interrupt
r13289 this.thenClick('li#int_kernel');
Paul Ivanov
use wait_for_output util function
r13295 this.wait_for_output(0);
Paul Ivanov
test kernel interrupt
r13289
this.then(function () {
Paul Ivanov
refactor of get_output_cell
r13299 var result = this.get_output_cell(0);
this.test.assertEquals(result.ename, 'KeyboardInterrupt', 'keyboard interrupt (mouseclick)');
Paul Ivanov
test keyboard interrupt shortcuts
r13297 });
// run cell 0 again, now interrupting using keyboard shortcut
this.thenEvaluate(function () {
cell.clear_output();
cell.execute();
});
// interrupt using Ctrl-M I keyboard shortcut
this.thenEvaluate( function() {
IPython.utils.press_ghetto(IPython.utils.keycodes.I)
});
this.wait_for_output(0);
this.then(function () {
Paul Ivanov
refactor of get_output_cell
r13299 var result = this.get_output_cell(0);
this.test.assertEquals(result.ename, 'KeyboardInterrupt', 'keyboard interrupt (shortcut)');
Paul Ivanov
test kernel interrupt
r13289 });
});