mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Backport screenshots 'session' and 'failure' folders
This commit is contained in:
parent
dfacedb27b
commit
fe9f34cb68
3 changed files with 8 additions and 6 deletions
0
test/screenshots/failure/.empty
Normal file
0
test/screenshots/failure/.empty
Normal file
0
test/screenshots/session/.empty
Normal file
0
test/screenshots/session/.empty
Normal file
|
@ -226,24 +226,26 @@ define(function (require) {
|
|||
|
||||
return function (reason) {
|
||||
var now = Date.now();
|
||||
var filename = ['failure', now, testName].join('_') + '.png';
|
||||
var fileName = ['failure', now, testName].join('_') + '.png';
|
||||
|
||||
return self.saveScreenshot(filename)
|
||||
return self.saveScreenshot(fileName, true)
|
||||
.finally(function () {
|
||||
throw new Error(reason);
|
||||
});
|
||||
};
|
||||
},
|
||||
|
||||
saveScreenshot: function saveScreenshot(filename) {
|
||||
saveScreenshot: function saveScreenshot(fileName, isFailure) {
|
||||
var self = this;
|
||||
var outDir = path.resolve('test', 'screenshots');
|
||||
var directoryName = isFailure ? 'failure' : 'session';
|
||||
var directoryPath = path.resolve('test', 'screenshots', directoryName);
|
||||
var filePath = path.resolve(directoryPath, fileName);
|
||||
self.debug('Taking screenshot "' + filePath + '"');
|
||||
|
||||
return self.remote.takeScreenshot()
|
||||
.then(function writeScreenshot(data) {
|
||||
var filepath = path.resolve(outDir, filename);
|
||||
self.debug('Taking screenshot "' + filepath + '"');
|
||||
fs.writeFileSync(filepath, data);
|
||||
fs.writeFileSync(filePath, data);
|
||||
})
|
||||
.catch(function (err) {
|
||||
self.log('SCREENSHOT FAILED: ' + err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue