0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

CasperJS test amends

- removing --fail-fast as this prevents screenshots
- adding debug code for the good of all
This commit is contained in:
Hannah Wolfe 2013-08-30 10:50:42 +01:00
parent 6c0434fc8f
commit b55ed1c33c
2 changed files with 17 additions and 1 deletions

View file

@ -361,7 +361,7 @@ var path = require('path'),
grunt.registerTask('spawn-casperjs', function () {
var done = this.async(),
options = ['host', 'noPort', 'port', 'email', 'password'],
args = ['test', 'admin/', '--includes=base.js', '--direct', '--log-level=debug', '--port=2369', '--fail-fast'];
args = ['test', 'admin/', '--includes=base.js', '--direct', '--log-level=debug', '--port=2369'];
// Forward parameters from grunt to casperjs
_.each(options, function processOption(option) {

View file

@ -51,6 +51,22 @@ casper.writeContentToCodeMirror = function (content) {
return this;
};
// ## Debugging
// output all errors to the console
casper.on('remote.message', function (msg) {
casper.echo('GOT CONSOLE LOG: ' + msg);
});
casper.on('error', function (msg, trace) {
casper.echo('GOT ERROR, ' + msg);
});
casper.on("page.error", function (msg, trace) {
this.echo("GOT PAGE ERROR: " + msg, "ERROR");
});
// on failure, grab a screenshot
casper.test.on("fail", function captureFailure() {
var filename = casper.test.filename || "casper_test_fail.png";
casper.capture(new Date().getTime() + '_' + filename);