diff --git a/IPython/frontend/html/notebook/tests/casperjs/test_cases/execute_code_cell.js b/IPython/frontend/html/notebook/tests/casperjs/test_cases/execute_code_cell.js new file mode 100644 index 000000000..17ac61c63 --- /dev/null +++ b/IPython/frontend/html/notebook/tests/casperjs/test_cases/execute_code_cell.js @@ -0,0 +1,29 @@ +// +// Test code cell execution. +// +casper.openNewNotebook(); + +casper.then(function () { + this.evaluate(function () { + var cell = IPython.notebook.get_selected_cell(); + cell.set_text('a=10; print a'); + cell.execute(); + }); +}); + +casper.wait(2000); + +casper.then(function () { + var result = this.evaluate(function () { + var cell = IPython.notebook.get_cell(0); + var output = cell.element.find('.output_area').find('pre').html(); + return output; + }) + this.test.assertEquals(result, '10\n', 'stdout output matches') +}); + +casper.deleteCurrentNotebook(); + +casper.run(function() { + this.test.done(); +}); diff --git a/IPython/frontend/html/notebook/tests/casperjs/test_cases/render_markdown.js b/IPython/frontend/html/notebook/tests/casperjs/test_cases/render_markdown.js new file mode 100644 index 000000000..86a074adb --- /dev/null +++ b/IPython/frontend/html/notebook/tests/casperjs/test_cases/render_markdown.js @@ -0,0 +1,30 @@ +// +// Test that a Markdown cell is rendered to HTML. +// +casper.openNewNotebook(); + +casper.then(function () { + var output = this.evaluate(function() { + // Does it make more sense to test the UI or the JS API here? + // + // $('#cell_type').val('markdown'); + // $('#cell_type').change(); + // $('#run_b').click(); + // + // $('#to_markdown').click(); // fails via jQuery UI menubar + // $('#run_cell').click(); // fails via jQuery UI menubar + IPython.notebook.to_markdown(); + var cell = IPython.notebook.get_selected_cell(); + cell.set_text('# Foo'); + cell.render(); + return cell.get_rendered(); + }); + casper.test.assertEquals(output, '