place failure screenshots in test/output

This commit is contained in:
Joe Fleming 2015-11-04 15:18:57 -07:00
parent e3ac7f6dc0
commit 4cbfecf963
3 changed files with 11 additions and 5 deletions

2
.gitignore vendored
View file

@ -10,7 +10,7 @@ target
.idea
*.iml
*.log
screenshot*.png
/test/output
/esvm
.htpasswd
.eslintcache

0
test/output/.empty Normal file
View file

View file

@ -63,7 +63,7 @@ define(function (require) {
return function (reason) {
var now = Date.now();
var filename = path.resolve(['./screenshot', now, testName, '.png'].join('_'));
var filename = ['failure', now, testName].join('_') + '.png';
return self.saveScreenshot(filename)
.finally(function () {
@ -73,11 +73,17 @@ define(function (require) {
},
saveScreenshot: function saveScreenshot(filename) {
this.debug('Test Failed, taking screenshot "' + filename + '"');
var self = this;
var outDir = path.resolve('test', 'output');
return this.remote.takeScreenshot()
return self.remote.takeScreenshot()
.then(function writeScreenshot(data) {
fs.writeFileSync(filename, data);
var filepath = path.resolve(outDir, filename);
self.debug('Test Failed, taking screenshot "' + filepath + '"');
fs.writeFileSync(filepath, data);
})
.catch(function (err) {
self.log('SCREENSHOT FAILED: ' + err);
});
}
};