Don't fail with the first browser error.
log all browser errors and then fail
This commit is contained in:
@@ -30,15 +30,20 @@ var driver = new webdriver.Builder().
|
|||||||
function checkConsoleErros () {
|
function checkConsoleErros () {
|
||||||
it('should not have any console errors', function (done) {
|
it('should not have any console errors', function (done) {
|
||||||
driver.manage().logs().get('browser').then(function(browserLogs) {
|
driver.manage().logs().get('browser').then(function(browserLogs) {
|
||||||
|
|
||||||
|
var errors = [];
|
||||||
|
|
||||||
browserLogs.forEach(function(log){
|
browserLogs.forEach(function(log){
|
||||||
if (log.level.value > 900) {
|
|
||||||
console.error('browser error message:', log.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 900 and above is "error" level. Console should not have any errors
|
// 900 and above is "error" level. Console should not have any errors
|
||||||
expect(log.level.value).not.to.be.greaterThan(900);
|
if (log.level.value > 900) {
|
||||||
|
console.log('browser error message:', log.message);
|
||||||
|
errors.push(log);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
expect(errors).to.be.empty;
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user