From 8cc2a54fa86a01a9e154445115fb018d827dbdcc 2013-10-23 18:04:56 From: Paul Ivanov Date: 2013-10-23 18:04:56 Subject: [PATCH] eliminate hardcoded wait, now wait on outputs Note: this test still sometimes fails, though I don't understand why. Increasing the wait time to 30 seconds does not help, which leads me to believe that there's some race condition, or that we're genuinely dropping outputs sometimes (saved notebooks on these timeouts *do* contain an In[] number, but don't have any outputs attached). @ellisonbg and @minrk might now what's going on with that. To run just this test, fire up a notebook server on port 8888 and run: while true; do casperjs test --includes=util.js test_cases/execute_code_cell.js ; done --- diff --git a/IPython/html/tests/casperjs/test_cases/execute_code_cell.js b/IPython/html/tests/casperjs/test_cases/execute_code_cell.js index a013adc..3d208a8 100644 --- a/IPython/html/tests/casperjs/test_cases/execute_code_cell.js +++ b/IPython/html/tests/casperjs/test_cases/execute_code_cell.js @@ -8,7 +8,18 @@ casper.notebook_test(function () { cell.execute(); }); - this.wait(2000); + + this.waitFor(function () { + return this.evaluate(function get_output() { + var cell = IPython.notebook.get_cell(0); + return cell.output_area.outputs.length != 0; + }) + }, null, function on_timeout() { + this.echo( this.evaluate( function() { + IPython.notebook.save_notebook(); + return IPython.notebook.notebook_name; + }) + ".ipynb is the name of the notebook which failed"); + }); this.then(function () { var result = this.evaluate(function () {