diff --git a/IPython/html/tests/notebook/interrupt.js b/IPython/html/tests/notebook/interrupt.js
index 7c2912c..24b6266 100644
--- a/IPython/html/tests/notebook/interrupt.js
+++ b/IPython/html/tests/notebook/interrupt.js
@@ -26,13 +26,14 @@ casper.notebook_test(function () {
// run cell 0 again, now interrupting using keyboard shortcut
this.thenEvaluate(function () {
+ var cell = IPython.notebook.get_cell(0);
cell.clear_output();
cell.execute();
});
- // interrupt using Ctrl-M I keyboard shortcut
+ // interrupt using ii keyboard shortcut
this.then(function(){
- this.trigger_keydown('i');
+ this.trigger_keydown('esc', 'i', 'i');
});
this.wait_for_output(0);
diff --git a/IPython/html/tests/notebook/isolated_svg.js b/IPython/html/tests/notebook/isolated_svg.js
index 8c9b763..ac29d49 100644
--- a/IPython/html/tests/notebook/isolated_svg.js
+++ b/IPython/html/tests/notebook/isolated_svg.js
@@ -21,7 +21,6 @@ casper.notebook_test(function () {
"display_svg(SVG(s2), metadata=dict(isolated=True))\n"
);
cell.execute();
- console.log("hello" );
});
this.then(function() {
@@ -30,7 +29,6 @@ casper.notebook_test(function () {
this.echo(this.currentUrl);
this.evaluate(function (n) {
IPython.notebook.rename(n);
- console.write("hello" + n);
IPython.notebook.save_notebook();
}, {n : fname});
this.echo(this.currentUrl);
@@ -40,9 +38,6 @@ casper.notebook_test(function () {
url = this.evaluate(function() {
IPython.notebook.rename("foo");
- //$("span#notebook_name")[0].click();
- //$("input")[0].value = "please-work";
- //$(".btn-primary")[0].click();
return document.location.href;
});
this.echo("renamed" + url);
diff --git a/IPython/html/tests/util.js b/IPython/html/tests/util.js
index bc9ce6d..eaac02c 100644
--- a/IPython/html/tests/util.js
+++ b/IPython/html/tests/util.js
@@ -480,7 +480,7 @@ casper.notebook_test = function(test) {
this.then(function(){
this.evaluate(function(){
window.onbeforeunload = function(){};
- });
+ });
});
this.then(test);
@@ -546,3 +546,56 @@ casper.print_log = function () {
this.echo('Remote message caught: ' + msg);
});
};
+
+casper.on("page.error", function onError(msg, trace) {
+ // show errors in the browser
+ this.echo("Page Error!");
+ for (var i = 0; i < trace.length; i++) {
+ var frame = trace[i];
+ var file = frame.file;
+ // shorten common phantomjs evaluate url
+ // this will have a different value on slimerjs
+ if (file === "phantomjs://webpage.evaluate()") {
+ file = "evaluate";
+ }
+ this.echo("line " + frame.line + " of " + file);
+ if (frame.function.length > 0) {
+ this.echo("in " + frame.function);
+ }
+ }
+ this.echo(msg);
+});
+
+
+casper.capture_log = function () {
+ // show captured errors
+ var captured_log = [];
+ var seen_errors = 0;
+ this.on('remote.message', function(msg) {
+ captured_log.push(msg);
+ });
+
+ this.test.on("test.done", function (result) {
+ // test.done runs per-file,
+ // but suiteResults is per-suite (directory)
+ var current_errors;
+ if (this.suiteResults) {
+ // casper 1.1 has suiteResults
+ current_errors = this.suiteResults.countErrors() + this.suiteResults.countFailed();
+ } else {
+ // casper 1.0 has testResults instead
+ current_errors = this.testResults.failed;
+ }
+
+ if (current_errors > seen_errors && captured_log.length > 0) {
+ casper.echo("\nCaptured console.log:");
+ for (var i = 0; i < captured_log.length; i++) {
+ casper.echo(" " + captured_log[i]);
+ }
+ }
+ seen_errors = current_errors;
+ captured_log = [];
+ });
+};
+
+casper.capture_log();