##// END OF EJS Templates
#7548: A bang, "!", followed by an equal sign, "=", is not a shell escape.
#7548: A bang, "!", followed by an equal sign, "=", is not a shell escape.

File last commit:

r19987:da0fef15
r20146:cfc41c06
Show More
execute_code.js
115 lines | 3.5 KiB | application/javascript | JavascriptLexer
David Wyde
Add CasperJS utility functions, and tests for code and...
r13249 //
// Test code cell execution.
//
Paul Ivanov
pep8 style function names
r13275 casper.notebook_test(function () {
David Wyde
Add CasperJS utility functions, and tests for code and...
r13249 this.evaluate(function () {
Paul Ivanov
consistently get the first cell
r13260 var cell = IPython.notebook.get_cell(0);
Thomas Kluyver
Use Python 3 compatible syntax in tests
r13278 cell.set_text('a=10; print(a)');
David Wyde
Add CasperJS utility functions, and tests for code and...
r13249 cell.execute();
});
Paul Ivanov
wait_for_output utility function
r13294 this.wait_for_output(0);
David Wyde
Add CasperJS utility functions, and tests for code and...
r13249
Paul Ivanov
refactor of get_output_cell
r13299 // refactor this into just a get_output(0)
David Wyde
Wrap CasperJS tests in a helper function to reduce boilerplate.
r13253 this.then(function () {
Paul Ivanov
refactor of get_output_cell
r13299 var result = this.get_output_cell(0);
Paul Ivanov
add checks for new cell added using shift-enter
r13300 this.test.assertEquals(result.text, '10\n', 'cell execute (using js)');
Paul Ivanov
repeat test with keyboard shortcut
r13292 });
// do it again with the keyboard shortcut
this.thenEvaluate(function () {
var cell = IPython.notebook.get_cell(0);
cell.set_text('a=11; print(a)');
Paul Ivanov
add checks for new cell added using shift-enter
r13300 cell.clear_output();
Paul Ivanov
repeat test with keyboard shortcut
r13292 });
Jonathan Frederic
Partial fix of problems b/c keydown move
r15940 this.then(function(){
Jonathan Frederic
Final fixes?
r15941 this.trigger_keydown('shift-enter');
Jonathan Frederic
Partial fix of problems b/c keydown move
r15940 });
Paul Ivanov
wait_for_output utility function
r13294 this.wait_for_output(0);
Paul Ivanov
repeat test with keyboard shortcut
r13292
this.then(function () {
Paul Ivanov
refactor of get_output_cell
r13299 var result = this.get_output_cell(0);
Paul Ivanov
add checks for new cell added using shift-enter
r13300 var num_cells = this.get_cells_length();
this.test.assertEquals(result.text, '11\n', 'cell execute (using ctrl-enter)');
Brian E. Granger
Fixing tests from shift and ctrl enter swap.
r14947 this.test.assertEquals(num_cells, 2, 'shift-enter adds a new cell at the bottom')
David Wyde
Wrap CasperJS tests in a helper function to reduce boilerplate.
r13253 });
Paul Ivanov
utility functions + tests for shift- & ctrl-enter
r13293
// do it again with the keyboard shortcut
this.thenEvaluate(function () {
Brian E. Granger
Fixing more JS tests.
r14081 IPython.notebook.select(1);
IPython.notebook.delete_cell();
Paul Ivanov
utility functions + tests for shift- & ctrl-enter
r13293 var cell = IPython.notebook.get_cell(0);
cell.set_text('a=12; print(a)');
Paul Ivanov
add checks for new cell added using shift-enter
r13300 cell.clear_output();
Jonathan Frederic
Final fixes?
r15941 });
this.then(function(){
this.trigger_keydown('ctrl-enter');
Paul Ivanov
utility functions + tests for shift- & ctrl-enter
r13293 });
Paul Ivanov
wait_for_output utility function
r13294 this.wait_for_output(0);
Paul Ivanov
utility functions + tests for shift- & ctrl-enter
r13293
this.then(function () {
Paul Ivanov
refactor of get_output_cell
r13299 var result = this.get_output_cell(0);
Paul Ivanov
add checks for new cell added using shift-enter
r13300 var num_cells = this.get_cells_length();
this.test.assertEquals(result.text, '12\n', 'cell execute (using shift-enter)');
Brian E. Granger
Fixing tests from shift and ctrl enter swap.
r14947 this.test.assertEquals(num_cells, 1, 'ctrl-enter adds no new cell at the bottom')
Paul Ivanov
utility functions + tests for shift- & ctrl-enter
r13293 });
Paul Ivanov
adds test of clicking the play button
r13301
// press the "play" triangle button in the toolbar
this.thenEvaluate(function () {
var cell = IPython.notebook.get_cell(0);
IPython.notebook.select(0);
cell.clear_output();
cell.set_text('a=13; print(a)');
Bussonnier Matthias
saving notebook does not run cell....
r19480 $("button[data-jupyter-action='ipython.run-select-next']")[0].click()
Paul Ivanov
adds test of clicking the play button
r13301 });
this.wait_for_output(0);
this.then(function () {
var result = this.get_output_cell(0);
this.test.assertEquals(result.text, '13\n', 'cell execute (using "play" toolbar button)')
});
Juergen Hasch
Skip exceptions
r19985
// run code with skip_exception
this.thenEvaluate(function () {
var cell0 = IPython.notebook.get_cell(0);
cell0.set_text('raise IOError');
IPython.notebook.insert_cell_below('code',0);
var cell1 = IPython.notebook.get_cell(1);
cell1.set_text('a=14; print(a)');
Juergen Hasch
Use stop_on_error instead of skip_exceptions
r19986 cell0.execute(false);
Juergen Hasch
Skip exceptions
r19985 cell1.execute();
});
this.wait_for_output(1);
this.then(function () {
var result = this.get_output_cell(1);
Juergen Hasch
Use stop_on_error instead of skip_exceptions
r19986 this.test.assertEquals(result.text, '14\n', "cell execute, don't stop on error");
Juergen Hasch
Skip exceptions
r19985 });
this.thenEvaluate(function () {
var cell0 = IPython.notebook.get_cell(0);
cell0.set_text('raise IOError');
IPython.notebook.insert_cell_below('code',0);
var cell1 = IPython.notebook.get_cell(1);
cell1.set_text('a=14; print(a)');
cell0.execute();
cell1.execute();
});
Min RK
fix stop-on-error test
r19987 this.wait_for_output(0);
Juergen Hasch
Skip exceptions
r19985
this.then(function () {
Min RK
fix stop-on-error test
r19987 var outputs = this.evaluate(function() {
return IPython.notebook.get_cell(1).output_area.outputs;
})
this.test.assertEquals(outputs.length, 0, 'cell execute, stop on error (default)');
Juergen Hasch
Skip exceptions
r19985 });
David Wyde
Add CasperJS utility functions, and tests for code and...
r13249 });