aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-05-22 07:26:38 +0800
committerkumavis <aaron@kumavis.me>2018-05-22 07:26:38 +0800
commit9c6e2ec8ef4944172f6e771b216beaf00ed21575 (patch)
tree11f7a0016d36f48afceea44ac3cd5c80dd31a246 /test
parente8b2e11c5624d80f535c1344d9c9be48627b1319 (diff)
downloadtangerine-wallet-browser-9c6e2ec8ef4944172f6e771b216beaf00ed21575.tar
tangerine-wallet-browser-9c6e2ec8ef4944172f6e771b216beaf00ed21575.tar.gz
tangerine-wallet-browser-9c6e2ec8ef4944172f6e771b216beaf00ed21575.tar.bz2
tangerine-wallet-browser-9c6e2ec8ef4944172f6e771b216beaf00ed21575.tar.lz
tangerine-wallet-browser-9c6e2ec8ef4944172f6e771b216beaf00ed21575.tar.xz
tangerine-wallet-browser-9c6e2ec8ef4944172f6e771b216beaf00ed21575.tar.zst
tangerine-wallet-browser-9c6e2ec8ef4944172f6e771b216beaf00ed21575.zip
test - e2e - check for console errors after each test
Diffstat (limited to 'test')
-rw-r--r--test/e2e/metamask.spec.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js
index 707ca2560..fac560176 100644
--- a/test/e2e/metamask.spec.js
+++ b/test/e2e/metamask.spec.js
@@ -30,6 +30,14 @@ describe('Metamask popup page', function () {
})
afterEach(async function () {
+ // check for console errors
+ const errors = await checkBrowserForConsoleErrors()
+ if (errors.length) {
+ const errorReports = errors.map(err => err.message)
+ const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
+ this.test.error(new Error(errorMessage))
+ }
+ // gather extra data if test failed
if (this.currentTest.state === 'failed') {
await verboseReportOnFailure(this.currentTest)
}
@@ -300,13 +308,21 @@ describe('Metamask popup page', function () {
await driver.executeScript('window.metamask.setProviderType(arguments[0])', type)
}
+ async function checkBrowserForConsoleErrors() {
+ const ignoredLogTypes = ['WARNING']
+ const browserLogs = await driver.manage().logs().get('browser')
+ const errorEntries = browserLogs.filter(entry => !ignoredLogTypes.includes(entry.level.toString()))
+ const errorEntryObjects = errorEntries.map(entry => entry.toJSON())
+ return errorEntryObjects
+ }
+
async function verboseReportOnFailure (test) {
let artifactDir
if (process.env.SELENIUM_BROWSER === 'chrome') {
artifactDir = `./test-artifacts/chrome/${test.title}`
} else if (process.env.SELENIUM_BROWSER === 'firefox') {
artifactDir = `./test-artifacts/firefox/${test.title}`
- }
+ }
const filepathBase = `${artifactDir}/test-failure`
await pify(mkdirp)(artifactDir)
// capture screenshot