##// END OF EJS Templates
eliminate hardcoded wait, now wait on outputs...
Paul Ivanov -
Show More
@@ -1,21 +1,32 b''
1 //
1 //
2 // Test code cell execution.
2 // Test code cell execution.
3 //
3 //
4 casper.notebook_test(function () {
4 casper.notebook_test(function () {
5 this.evaluate(function () {
5 this.evaluate(function () {
6 var cell = IPython.notebook.get_cell(0);
6 var cell = IPython.notebook.get_cell(0);
7 cell.set_text('a=10; print a');
7 cell.set_text('a=10; print a');
8 cell.execute();
8 cell.execute();
9 });
9 });
10
10
11 this.wait(2000);
11
12 this.waitFor(function () {
13 return this.evaluate(function get_output() {
14 var cell = IPython.notebook.get_cell(0);
15 return cell.output_area.outputs.length != 0;
16 })
17 }, null, function on_timeout() {
18 this.echo( this.evaluate( function() {
19 IPython.notebook.save_notebook();
20 return IPython.notebook.notebook_name;
21 }) + ".ipynb is the name of the notebook which failed");
22 });
12
23
13 this.then(function () {
24 this.then(function () {
14 var result = this.evaluate(function () {
25 var result = this.evaluate(function () {
15 var cell = IPython.notebook.get_cell(0);
26 var cell = IPython.notebook.get_cell(0);
16 var output = cell.output_area.outputs[0].text;
27 var output = cell.output_area.outputs[0].text;
17 return output;
28 return output;
18 })
29 })
19 this.test.assertEquals(result, '10\n', 'stdout output matches')
30 this.test.assertEquals(result, '10\n', 'stdout output matches')
20 });
31 });
21 });
32 });
General Comments 0
You need to be logged in to leave comments. Login now