mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Created Common.screenshotError function and changed testSettings to call it.
Improved logging in screenshotError to get the timestamp and use it in the log message instead of logging Date.now().
This commit is contained in:
parent
85397c754f
commit
e9d349bf24
2 changed files with 28 additions and 44 deletions
|
@ -4,8 +4,7 @@ define(function (require) {
|
|||
|
||||
var registerSuite = require('intern!object');
|
||||
var expect = require('intern/dojo/node!expect.js');
|
||||
//var ScenarioManager = require('intern/dojo/node!../fixtures/scenarioManager');
|
||||
var fs = require('intern/dojo/node!fs');
|
||||
var ScenarioManager = require('intern/dojo/node!../fixtures/scenarioManager');
|
||||
var pollUntil = require('intern/dojo/node!leadfoot/helpers/pollUntil');
|
||||
var Common = require('../support/pages/Common');
|
||||
var SettingsPage = require('../support/pages/SettingsPage');
|
||||
|
@ -126,13 +125,8 @@ define(function (require) {
|
|||
|
||||
})
|
||||
.catch(function screenshotError(reason) {
|
||||
common.log('Test Failed, taking screenshot "./screenshot-' + testSubName + '-ERROR- + Date.now() + .png"');
|
||||
return remote
|
||||
.takeScreenshot()
|
||||
.then(function screenshot2a(data) {
|
||||
fs.writeFileSync('./screenshot-' + testSubName + '-ERROR-' + Date.now() + '.png', data);
|
||||
throw new Error(reason);
|
||||
});
|
||||
return common
|
||||
.screenshotError(testSubName, reason);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -163,13 +157,8 @@ define(function (require) {
|
|||
});
|
||||
})
|
||||
.catch(function screenshotError(reason) {
|
||||
common.log('Test Failed, taking screenshot "./screenshot-' + testSubName + '-ERROR- + Date.now() + .png"');
|
||||
return remote
|
||||
.takeScreenshot()
|
||||
.then(function screenshot2a(data) {
|
||||
fs.writeFileSync('./screenshot-' + testSubName + '-ERROR-' + Date.now() + '.png', data);
|
||||
throw new Error(reason);
|
||||
});
|
||||
return common
|
||||
.screenshotError(testSubName, reason);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -263,13 +252,8 @@ define(function (require) {
|
|||
});
|
||||
})
|
||||
.catch(function screenshotError(reason) {
|
||||
common.log('Test Failed, taking screenshot "./screenshot-' + testSubName + '-ERROR- + Date.now() + .png"');
|
||||
return remote
|
||||
.takeScreenshot()
|
||||
.then(function screenshot2a(data) {
|
||||
fs.writeFileSync('./screenshot-' + testSubName + '-ERROR-' + Date.now() + '.png', data);
|
||||
throw new Error(reason);
|
||||
});
|
||||
return common
|
||||
.screenshotError(testSubName, reason);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -381,13 +365,8 @@ define(function (require) {
|
|||
});
|
||||
})
|
||||
.catch(function screenshotError(reason) {
|
||||
common.log('Test Failed, taking screenshot "./screenshot-' + testSubName + '-ERROR- + Date.now() + .png"');
|
||||
return remote
|
||||
.takeScreenshot()
|
||||
.then(function screenshot2a(data) {
|
||||
fs.writeFileSync('./screenshot-' + testSubName + '-ERROR-' + Date.now() + '.png', data);
|
||||
throw new Error(reason);
|
||||
});
|
||||
return common
|
||||
.screenshotError(testSubName, reason);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -585,13 +564,8 @@ define(function (require) {
|
|||
.acceptAlert();
|
||||
})
|
||||
.catch(function screenshotError(reason) {
|
||||
common.log('Test Failed, taking screenshot "./screenshot-' + testSubName + '-ERROR- + Date.now() + .png"');
|
||||
return remote
|
||||
.takeScreenshot()
|
||||
.then(function screenshot2a(data) {
|
||||
fs.writeFileSync('./screenshot-' + testSubName + '-ERROR-' + Date.now() + '.png', data);
|
||||
throw new Error(reason);
|
||||
});
|
||||
return common
|
||||
.screenshotError(testSubName, reason);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -724,13 +698,8 @@ define(function (require) {
|
|||
.acceptAlert();
|
||||
})
|
||||
.catch(function screenshotError(reason) {
|
||||
common.log('Test Failed, taking screenshot "./screenshot-' + testSubName + '-ERROR- + Date.now() + .png"');
|
||||
return remote
|
||||
.takeScreenshot()
|
||||
.then(function screenshot2a(data) {
|
||||
fs.writeFileSync('./screenshot-' + testSubName + '-ERROR-' + Date.now() + '.png', data);
|
||||
throw new Error(reason);
|
||||
});
|
||||
return common
|
||||
.screenshotError(testSubName, reason);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ define(function (require) {
|
|||
var expect = require('intern/dojo/node!expect.js');
|
||||
var Promise = require('bluebird');
|
||||
var moment = require('moment');
|
||||
var fs = require('intern/dojo/node!fs');
|
||||
|
||||
function Common(remote) {
|
||||
this.remote = remote;
|
||||
|
@ -58,6 +59,20 @@ define(function (require) {
|
|||
}, sleepMilliseconds);
|
||||
});
|
||||
return promise;
|
||||
},
|
||||
|
||||
|
||||
screenshotError: function screenshotError(testSubName, reason) {
|
||||
var self = this;
|
||||
var now = Date.now();
|
||||
var filename = './screenshot-' + testSubName + '-ERROR-' + now + '.png';
|
||||
self.log('Test Failed, taking screenshot "' + filename + '"');
|
||||
return self.remote
|
||||
.takeScreenshot()
|
||||
.then(function writeScreenshot(data) {
|
||||
fs.writeFileSync(filename, data);
|
||||
throw new Error(reason);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue