| 1 | // This script can be used to check for errors/console warnings in _all_ the |
| 2 | // files in tests/*.html. |
| 3 | // |
| 4 | // Suggested usage: |
| 5 | // |
| 6 | // npm install casperjs |
| 7 | // for x in tests/*.html; casperjs scripts/casperscript.js $x |
| 8 | |
| 9 | var casper = require('casper').create({ |
| 10 | verbose: true |
| 11 | }); |
| 12 | var filename = casper.cli.args[0]; |
| 13 | |
| 14 | casper.echo(filename); |
| 15 | casper.on('remote.message', function(message) { |
| 16 | this.echo('page console: ' + message); |
| 17 | }); |
| 18 | |
| 19 | casper.on('resource.error', function(e) { |
| 20 | this.echo('resource.error: ' + e); |
| 21 | }); |
| 22 | casper.on('page.error', function(e) { |
| 23 | this.echo('error! ' + e); |
| 24 | }); |
| 25 | |
| 26 | casper.start(filename, function() { }); |
| 27 | |
| 28 | casper.run(); |