From 6b2692aa4a63fa4eac80f798ca97e5e839e205ca Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Sat, 28 Sep 2013 00:01:40 -0700 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 --- .../tests/casperjs/test_cases/execute_code_cell.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 a013adc1b..3d208a8b5 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 () {