Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow JS test to run after shutdown test #4451

Merged
merged 2 commits into from Oct 31, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 31 additions & 15 deletions IPython/html/tests/casperjs/test_cases/shutdown_notebook.js
Expand Up @@ -8,22 +8,38 @@ casper.notebook_test(function () {
// to just test.
//this.test.begin("shutdown tests (notebook)", 2, function(test) {

this.thenEvaluate(function () {
$('#kill_and_exit').click();
});

this.thenEvaluate(function () {
var cell = IPython.notebook.get_cell(0);
cell.set_text('a=10; print(a)');
cell.execute();
});
// Our shutdown test closes the browser window, which will delete the
// casper browser object, and the rest of the test suite will fail with
// errors that look like:
//
// "Error: cannot access member `evaluate' of deleted QObject"
//
// So what we do here is make a quick popup window, and run the test inside
// of it.
this.then(function() {
this.evaluate(function(url){
window.open(url);
}, {url : this.getCurrentUrl()});
})

this.waitForPopup('');
this.withPopup('', function () {
this.thenEvaluate(function () {
$('#kill_and_exit').click();
});

this.thenEvaluate(function () {
var cell = IPython.notebook.get_cell(0);
cell.set_text('a=10; print(a)');
cell.execute();
});

// refactor this into just a get_output(0)
this.then(function () {
var result = this.get_output_cell(0);
this.test.assertFalsy(result, "after shutdown: no execution results");
this.test.assertNot(this.kernel_running(),
'after shutdown: IPython.notebook.kernel.running is false ');
this.then(function () {
var result = this.get_output_cell(0);
this.test.assertFalsy(result, "after shutdown: no execution results");
this.test.assertNot(this.kernel_running(),
'after shutdown: IPython.notebook.kernel.running is false ');
});
});

//}); // end of test.begin
Expand Down