1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Check browser logs in withFixtures e2e test helper (#8947)

e2e test that use the `withFixtures` helper now check for console
errors after each successful test. If any errors are found, the test
fails.

It's currently enabled for Chrome only, because the Firefox driver
throws an error when you attempt to get the browser logs. Not sure why
exactly, but it's a long-standing problem.
This commit is contained in:
Mark Stacey 2020-07-09 12:01:39 -03:00 committed by GitHub
parent 0e51fb233c
commit 85f884c641
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,15 @@ async function withFixtures (options, callback) {
await callback({
driver,
})
if (process.env.SELENIUM_BROWSER === 'chrome') {
const errors = await driver.checkBrowserForConsoleErrors(driver)
if (errors.length) {
const errorReports = errors.map((err) => err.message)
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
throw new Error(errorMessage)
}
}
} finally {
await fixtureServer.stop()
await ganacheServer.quit()