aboutsummaryrefslogtreecommitdiffstats
path: root/test/e2e/metamask.spec.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-03-30 04:49:54 +0800
committerkumavis <aaron@kumavis.me>2018-03-30 04:49:54 +0800
commit2328b120da60e97ec5a636fd3a743a12a3309b96 (patch)
tree2eadeaa962756231b2188dcc4ddd7c8ef867dbc2 /test/e2e/metamask.spec.js
parent830b232cb967ee986706e39aed50ef9a6d729a1e (diff)
downloadtangerine-wallet-browser-2328b120da60e97ec5a636fd3a743a12a3309b96.tar
tangerine-wallet-browser-2328b120da60e97ec5a636fd3a743a12a3309b96.tar.gz
tangerine-wallet-browser-2328b120da60e97ec5a636fd3a743a12a3309b96.tar.bz2
tangerine-wallet-browser-2328b120da60e97ec5a636fd3a743a12a3309b96.tar.lz
tangerine-wallet-browser-2328b120da60e97ec5a636fd3a743a12a3309b96.tar.xz
tangerine-wallet-browser-2328b120da60e97ec5a636fd3a743a12a3309b96.tar.zst
tangerine-wallet-browser-2328b120da60e97ec5a636fd3a743a12a3309b96.zip
test - e2e - generate artifacts on test failure
Diffstat (limited to 'test/e2e/metamask.spec.js')
-rw-r--r--test/e2e/metamask.spec.js30
1 files changed, 24 insertions, 6 deletions
diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js
index a7d0a0efd..88a695adf 100644
--- a/test/e2e/metamask.spec.js
+++ b/test/e2e/metamask.spec.js
@@ -1,5 +1,8 @@
+const fs = require('fs')
+const mkdirp = require('mkdirp')
const path = require('path')
const assert = require('assert')
+const pify = require('pify')
const webdriver = require('selenium-webdriver')
const By = webdriver.By
const { delay, buildWebDriver } = require('./func')
@@ -20,6 +23,12 @@ describe('Metamask popup page', function () {
await delay(500)
})
+ afterEach(async function () {
+ if (this.currentTest.state === 'failed') {
+ await verboseReportOnFailure(this.currentTest)
+ }
+ })
+
after(async function () {
await driver.quit()
})
@@ -39,9 +48,7 @@ describe('Metamask popup page', function () {
it('should show privacy notice', async () => {
const privacy = await driver.findElement(By.css('.terms-header')).getText()
assert.equal(privacy, 'PRIVACY NOTICE', 'shows privacy notice')
- driver.findElement(By.css(
- 'button'
- )).click()
+ driver.findElement(By.css('button')).click()
})
it('should show terms of use', async () => {
@@ -51,9 +58,7 @@ describe('Metamask popup page', function () {
})
it('should be unable to continue without scolling throught the terms of use', async () => {
- const button = await driver.findElement(By.css(
- 'button'
- )).isEnabled()
+ const button = await driver.findElement(By.css('button')).isEnabled()
assert.equal(button, false, 'disabled continue button')
const element = driver.findElement(By.linkText(
'Attributions'
@@ -115,4 +120,17 @@ describe('Metamask popup page', function () {
await delay(500)
})
})
+
+ async function verboseReportOnFailure(test) {
+ const artifactDir = `./test-artifacts/${test.title}`
+ const filepathBase = `${artifactDir}/test-failure`
+ await pify(mkdirp)(artifactDir)
+ // capture screenshot
+ const screenshot = await driver.takeScreenshot()
+ await pify(fs.writeFile)(`${filepathBase}-screenshot.png`, screenshot, { encoding: 'base64' })
+ // capture dom source
+ const htmlSource = await driver.getPageSource()
+ await pify(fs.writeFile)(`${filepathBase}-dom.html`, htmlSource)
+ }
+
})