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
This commit is contained in:
Paul Ivanov 2013-09-28 00:01:40 -07:00
parent d46a7d6b75
commit 6b2692aa4a

View File

@ -8,7 +8,18 @@ casper.notebook_test(function () {
cell.execute(); 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 () { this.then(function () {
var result = this.evaluate(function () { var result = this.evaluate(function () {