2016-09-07 19:04:33 -04:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
import * as webdriver from 'selenium-webdriver';
|
|
|
|
declare var browser: any;
|
|
|
|
declare var expect: any;
|
|
|
|
|
|
|
|
// TODO (juliemr): remove this method once this becomes a protractor plugin
|
|
|
|
export function verifyNoBrowserErrors() {
|
2016-09-14 12:41:40 -04:00
|
|
|
browser.manage().logs().get('browser').then(function(browserLog: any[]) {
|
2016-11-12 08:08:58 -05:00
|
|
|
const errors: any[] = [];
|
2016-09-07 19:04:33 -04:00
|
|
|
browserLog.filter(logEntry => {
|
2016-11-12 08:08:58 -05:00
|
|
|
const msg = logEntry.message;
|
2016-09-07 19:04:33 -04:00
|
|
|
if (logEntry.level.value >= webdriver.logging.Level.INFO.value) {
|
|
|
|
errors.push(msg);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
expect(errors).toEqual([]);
|
|
|
|
});
|
|
|
|
}
|