##// END OF EJS Templates
wait_for_output utility function
Paul Ivanov -
Show More
@@ -8,12 +8,7 b' casper.notebook_test(function () {'
8 cell.execute();
8 cell.execute();
9 });
9 });
10
10
11 this.waitFor(function () {
11 this.wait_for_output(0);
12 return this.evaluate(function get_output() {
13 var cell = IPython.notebook.get_cell(0);
14 return cell.output_area.outputs.length != 0;
15 })
16 });
17
12
18 this.then(function () {
13 this.then(function () {
19 var result = this.evaluate(function () {
14 var result = this.evaluate(function () {
@@ -33,12 +28,7 b' casper.notebook_test(function () {'
33 IPython.utils.press_ctrl_enter();
28 IPython.utils.press_ctrl_enter();
34 });
29 });
35
30
36 this.waitFor(function () {
31 this.wait_for_output(0);
37 return this.evaluate(function get_output() {
38 var cell = IPython.notebook.get_cell(0);
39 return cell.output_area.outputs.length != 0;
40 })
41 });
42
32
43 this.then(function () {
33 this.then(function () {
44 var result = this.evaluate(function () {
34 var result = this.evaluate(function () {
@@ -57,12 +47,7 b' casper.notebook_test(function () {'
57 IPython.utils.press_shift_enter();
47 IPython.utils.press_shift_enter();
58 });
48 });
59
49
60 this.waitFor(function () {
50 this.wait_for_output(0);
61 return this.evaluate(function get_output() {
62 var cell = IPython.notebook.get_cell(0);
63 return cell.output_area.outputs.length != 0;
64 })
65 });
66
51
67 this.then(function () {
52 this.then(function () {
68 var result = this.evaluate(function () {
53 var result = this.evaluate(function () {
@@ -54,6 +54,20 b' casper.delete_current_notebook = function () {'
54 });
54 });
55 };
55 };
56
56
57 // wait for output in a given cell
58 casper.wait_for_output = function (cell_num) {
59 this.then(function() {
60 this.waitFor(function (c) {
61 return this.evaluate(function get_output(c) {
62 var cell = IPython.notebook.get_cell(c);
63 return cell.output_area.outputs.length != 0;
64 },
65 // pass parameter from the test suite js to the browser code js
66 {c : cell_num});
67 });
68 });
69 };
70
57 // Wrap a notebook test to reduce boilerplate.
71 // Wrap a notebook test to reduce boilerplate.
58 casper.notebook_test = function(test) {
72 casper.notebook_test = function(test) {
59 this.open_new_notebook();
73 this.open_new_notebook();
General Comments 0
You need to be logged in to leave comments. Login now