|
|
@ -1,5 +1,8 @@ |
|
|
|
|
|
|
|
const fs = require('fs') |
|
|
|
|
|
|
|
const mkdirp = require('mkdirp') |
|
|
|
const path = require('path') |
|
|
|
const path = require('path') |
|
|
|
const assert = require('assert') |
|
|
|
const assert = require('assert') |
|
|
|
|
|
|
|
const pify = require('pify') |
|
|
|
const webdriver = require('selenium-webdriver') |
|
|
|
const webdriver = require('selenium-webdriver') |
|
|
|
const By = webdriver.By |
|
|
|
const By = webdriver.By |
|
|
|
const { delay, buildWebDriver } = require('./func') |
|
|
|
const { delay, buildWebDriver } = require('./func') |
|
|
@ -20,6 +23,12 @@ describe('Metamask popup page', function () { |
|
|
|
await delay(500) |
|
|
|
await delay(500) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
afterEach(async function () { |
|
|
|
|
|
|
|
if (this.currentTest.state === 'failed') { |
|
|
|
|
|
|
|
await verboseReportOnFailure(this.currentTest) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
after(async function () { |
|
|
|
after(async function () { |
|
|
|
await driver.quit() |
|
|
|
await driver.quit() |
|
|
|
}) |
|
|
|
}) |
|
|
@ -39,9 +48,7 @@ describe('Metamask popup page', function () { |
|
|
|
it('should show privacy notice', async () => { |
|
|
|
it('should show privacy notice', async () => { |
|
|
|
const privacy = await driver.findElement(By.css('.terms-header')).getText() |
|
|
|
const privacy = await driver.findElement(By.css('.terms-header')).getText() |
|
|
|
assert.equal(privacy, 'PRIVACY NOTICE', 'shows privacy notice') |
|
|
|
assert.equal(privacy, 'PRIVACY NOTICE', 'shows privacy notice') |
|
|
|
driver.findElement(By.css( |
|
|
|
driver.findElement(By.css('button')).click() |
|
|
|
'button' |
|
|
|
|
|
|
|
)).click() |
|
|
|
|
|
|
|
await delay(300) |
|
|
|
await delay(300) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -53,9 +60,7 @@ describe('Metamask popup page', function () { |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
it('should be unable to continue without scolling throught the terms of use', async () => { |
|
|
|
it('should be unable to continue without scolling throught the terms of use', async () => { |
|
|
|
const button = await driver.findElement(By.css( |
|
|
|
const button = await driver.findElement(By.css('button')).isEnabled() |
|
|
|
'button' |
|
|
|
|
|
|
|
)).isEnabled() |
|
|
|
|
|
|
|
assert.equal(button, false, 'disabled continue button') |
|
|
|
assert.equal(button, false, 'disabled continue button') |
|
|
|
const element = driver.findElement(By.linkText( |
|
|
|
const element = driver.findElement(By.linkText( |
|
|
|
'Attributions' |
|
|
|
'Attributions' |
|
|
@ -118,4 +123,17 @@ describe('Metamask popup page', function () { |
|
|
|
await delay(500) |
|
|
|
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) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|