Show More
@@ -26,13 +26,14 b' casper.notebook_test(function () {' | |||
|
26 | 26 | |
|
27 | 27 | // run cell 0 again, now interrupting using keyboard shortcut |
|
28 | 28 | this.thenEvaluate(function () { |
|
29 | var cell = IPython.notebook.get_cell(0); | |
|
29 | 30 | cell.clear_output(); |
|
30 | 31 | cell.execute(); |
|
31 | 32 | }); |
|
32 | 33 | |
|
33 |
// interrupt using |
|
|
34 | // interrupt using ii keyboard shortcut | |
|
34 | 35 | this.then(function(){ |
|
35 | this.trigger_keydown('i'); | |
|
36 | this.trigger_keydown('esc', 'i', 'i'); | |
|
36 | 37 | }); |
|
37 | 38 | |
|
38 | 39 | this.wait_for_output(0); |
@@ -21,7 +21,6 b' casper.notebook_test(function () {' | |||
|
21 | 21 | "display_svg(SVG(s2), metadata=dict(isolated=True))\n" |
|
22 | 22 | ); |
|
23 | 23 | cell.execute(); |
|
24 | console.log("hello" ); | |
|
25 | 24 | }); |
|
26 | 25 | |
|
27 | 26 | this.then(function() { |
@@ -30,7 +29,6 b' casper.notebook_test(function () {' | |||
|
30 | 29 | this.echo(this.currentUrl); |
|
31 | 30 | this.evaluate(function (n) { |
|
32 | 31 | IPython.notebook.rename(n); |
|
33 | console.write("hello" + n); | |
|
34 | 32 | IPython.notebook.save_notebook(); |
|
35 | 33 | }, {n : fname}); |
|
36 | 34 | this.echo(this.currentUrl); |
@@ -40,9 +38,6 b' casper.notebook_test(function () {' | |||
|
40 | 38 | |
|
41 | 39 | url = this.evaluate(function() { |
|
42 | 40 | IPython.notebook.rename("foo"); |
|
43 | //$("span#notebook_name")[0].click(); | |
|
44 | //$("input")[0].value = "please-work"; | |
|
45 | //$(".btn-primary")[0].click(); | |
|
46 | 41 | return document.location.href; |
|
47 | 42 | }); |
|
48 | 43 | this.echo("renamed" + url); |
@@ -546,3 +546,56 b' casper.print_log = function () {' | |||
|
546 | 546 | this.echo('Remote message caught: ' + msg); |
|
547 | 547 | }); |
|
548 | 548 | }; |
|
549 | ||
|
550 | casper.on("page.error", function onError(msg, trace) { | |
|
551 | // show errors in the browser | |
|
552 | this.echo("Page Error!"); | |
|
553 | for (var i = 0; i < trace.length; i++) { | |
|
554 | var frame = trace[i]; | |
|
555 | var file = frame.file; | |
|
556 | // shorten common phantomjs evaluate url | |
|
557 | // this will have a different value on slimerjs | |
|
558 | if (file === "phantomjs://webpage.evaluate()") { | |
|
559 | file = "evaluate"; | |
|
560 | } | |
|
561 | this.echo("line " + frame.line + " of " + file); | |
|
562 | if (frame.function.length > 0) { | |
|
563 | this.echo("in " + frame.function); | |
|
564 | } | |
|
565 | } | |
|
566 | this.echo(msg); | |
|
567 | }); | |
|
568 | ||
|
569 | ||
|
570 | casper.capture_log = function () { | |
|
571 | // show captured errors | |
|
572 | var captured_log = []; | |
|
573 | var seen_errors = 0; | |
|
574 | this.on('remote.message', function(msg) { | |
|
575 | captured_log.push(msg); | |
|
576 | }); | |
|
577 | ||
|
578 | this.test.on("test.done", function (result) { | |
|
579 | // test.done runs per-file, | |
|
580 | // but suiteResults is per-suite (directory) | |
|
581 | var current_errors; | |
|
582 | if (this.suiteResults) { | |
|
583 | // casper 1.1 has suiteResults | |
|
584 | current_errors = this.suiteResults.countErrors() + this.suiteResults.countFailed(); | |
|
585 | } else { | |
|
586 | // casper 1.0 has testResults instead | |
|
587 | current_errors = this.testResults.failed; | |
|
588 | } | |
|
589 | ||
|
590 | if (current_errors > seen_errors && captured_log.length > 0) { | |
|
591 | casper.echo("\nCaptured console.log:"); | |
|
592 | for (var i = 0; i < captured_log.length; i++) { | |
|
593 | casper.echo(" " + captured_log[i]); | |
|
594 | } | |
|
595 | } | |
|
596 | seen_errors = current_errors; | |
|
597 | captured_log = []; | |
|
598 | }); | |
|
599 | }; | |
|
600 | ||
|
601 | casper.capture_log(); |
General Comments 0
You need to be logged in to leave comments.
Login now