execute_code_cell.js
32 lines
| 1013 B
| application/javascript
|
JavascriptLexer
David Wyde
|
r13249 | // | ||
// Test code cell execution. | ||||
// | ||||
Paul Ivanov
|
r13275 | casper.notebook_test(function () { | ||
David Wyde
|
r13249 | this.evaluate(function () { | ||
Paul Ivanov
|
r13260 | var cell = IPython.notebook.get_cell(0); | ||
Thomas Kluyver
|
r13278 | cell.set_text('a=10; print(a)'); | ||
David Wyde
|
r13249 | cell.execute(); | ||
}); | ||||
Paul Ivanov
|
r13277 | |||
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"); | ||||
}); | ||||
David Wyde
|
r13249 | |||
David Wyde
|
r13253 | this.then(function () { | ||
var result = this.evaluate(function () { | ||||
var cell = IPython.notebook.get_cell(0); | ||||
Paul Ivanov
|
r13259 | var output = cell.output_area.outputs[0].text; | ||
David Wyde
|
r13253 | return output; | ||
}) | ||||
this.test.assertEquals(result, '10\n', 'stdout output matches') | ||||
}); | ||||
David Wyde
|
r13249 | }); | ||