|
|
@ -4,22 +4,20 @@ const webdriver = require('selenium-webdriver') |
|
|
|
const { By, Key, until } = webdriver |
|
|
|
const { By, Key, until } = webdriver |
|
|
|
const { |
|
|
|
const { |
|
|
|
delay, |
|
|
|
delay, |
|
|
|
buildChromeWebDriver, |
|
|
|
createModifiedTestBuild, |
|
|
|
buildFirefoxWebdriver, |
|
|
|
setupBrowserAndExtension, |
|
|
|
installWebExt, |
|
|
|
verboseReportOnFailure, |
|
|
|
getExtensionIdChrome, |
|
|
|
|
|
|
|
getExtensionIdFirefox, |
|
|
|
|
|
|
|
} = require('../func') |
|
|
|
} = require('../func') |
|
|
|
const { |
|
|
|
const { |
|
|
|
checkBrowserForConsoleErrors, |
|
|
|
checkBrowserForConsoleErrors, |
|
|
|
loadExtension, |
|
|
|
loadExtension, |
|
|
|
verboseReportOnFailure, |
|
|
|
|
|
|
|
findElement, |
|
|
|
findElement, |
|
|
|
findElements, |
|
|
|
findElements, |
|
|
|
} = require('./helpers') |
|
|
|
} = require('./helpers') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe('Using MetaMask with an existing account', function () { |
|
|
|
describe('Using MetaMask with an existing account', function () { |
|
|
|
|
|
|
|
const browser = process.env.SELENIUM_BROWSER |
|
|
|
let extensionId |
|
|
|
let extensionId |
|
|
|
let driver |
|
|
|
let driver |
|
|
|
let tokenAddress |
|
|
|
let tokenAddress |
|
|
@ -34,30 +32,15 @@ describe('Using MetaMask with an existing account', function () { |
|
|
|
this.bail(true) |
|
|
|
this.bail(true) |
|
|
|
|
|
|
|
|
|
|
|
before(async function () { |
|
|
|
before(async function () { |
|
|
|
switch (process.env.SELENIUM_BROWSER) { |
|
|
|
const srcPath = path.resolve(`dist/${browser}`) |
|
|
|
case 'chrome': { |
|
|
|
const { extPath } = await createModifiedTestBuild({ browser, srcPath }) |
|
|
|
const extensionPath = path.resolve('dist/chrome') |
|
|
|
const installResult = await setupBrowserAndExtension({ browser, extPath }) |
|
|
|
driver = buildChromeWebDriver(extensionPath) |
|
|
|
driver = installResult.driver |
|
|
|
extensionId = await getExtensionIdChrome(driver) |
|
|
|
extensionUri = installResult.extensionUri |
|
|
|
await driver.get(`chrome-extension://${extensionId}/popup.html`) |
|
|
|
|
|
|
|
await delay(regularDelayMs) |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case 'firefox': { |
|
|
|
|
|
|
|
const extensionPath = path.resolve('dist/firefox') |
|
|
|
|
|
|
|
driver = buildFirefoxWebdriver() |
|
|
|
|
|
|
|
await installWebExt(driver, extensionPath) |
|
|
|
|
|
|
|
await delay(regularDelayMs) |
|
|
|
|
|
|
|
extensionId = await getExtensionIdFirefox(driver) |
|
|
|
|
|
|
|
await driver.get(`moz-extension://${extensionId}/popup.html`) |
|
|
|
|
|
|
|
await delay(regularDelayMs) |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
afterEach(async function () { |
|
|
|
afterEach(async function () { |
|
|
|
if (process.env.SELENIUM_BROWSER === 'chrome') { |
|
|
|
if (browser === 'chrome') { |
|
|
|
const errors = await checkBrowserForConsoleErrors(driver) |
|
|
|
const errors = await checkBrowserForConsoleErrors(driver) |
|
|
|
if (errors.length) { |
|
|
|
if (errors.length) { |
|
|
|
const errorReports = errors.map(err => err.message) |
|
|
|
const errorReports = errors.map(err => err.message) |
|
|
@ -66,7 +49,7 @@ describe('Using MetaMask with an existing account', function () { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.currentTest.state === 'failed') { |
|
|
|
if (this.currentTest.state === 'failed') { |
|
|
|
await verboseReportOnFailure(driver, this.currentTest) |
|
|
|
await verboseReportOnFailure({ browser, driver, title: this.currentTest.title }) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|