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

test - e2e - remove usage of extensionId from tests

This commit is contained in:
kumavis 2018-06-11 16:45:29 -07:00
parent ab0e60e802
commit 93a2e28705
4 changed files with 12 additions and 28 deletions

View File

@ -9,17 +9,16 @@ const {
verboseReportOnFailure,
} = require('../func')
const {
checkBrowserForConsoleErrors,
loadExtension,
findElement,
findElements,
checkBrowserForConsoleErrors,
} = require('./helpers')
describe('Using MetaMask with an existing account', function () {
const browser = process.env.SELENIUM_BROWSER
let extensionId
let driver
let extensionUri
let tokenAddress
const testSeedPhrase = 'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent'
@ -273,7 +272,7 @@ describe('Using MetaMask with an existing account', function () {
await delay(regularDelayMs)
await driver.switchTo().window(extension)
await loadExtension(driver, extensionId)
await driver.get(extensionUri)
await delay(regularDelayMs)
const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`), 14000)
@ -286,7 +285,7 @@ describe('Using MetaMask with an existing account', function () {
await delay(regularDelayMs)
await driver.switchTo().window(extension)
await delay(regularDelayMs)
await loadExtension(driver, extensionId)
await driver.get(extensionUri)
await delay(regularDelayMs)
})
})
@ -348,7 +347,7 @@ describe('Using MetaMask with an existing account', function () {
await delay(regularDelayMs)
await driver.switchTo().window(extension)
await loadExtension(driver, extensionId)
await driver.get(extensionUri)
await delay(regularDelayMs)
const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
@ -361,7 +360,7 @@ describe('Using MetaMask with an existing account', function () {
tokenAddress = await tokenContactAddress.getText()
await driver.close()
await driver.switchTo().window(extension)
await loadExtension(driver, extensionId)
await driver.get(extensionUri)
await delay(regularDelayMs)
})

View File

@ -2,24 +2,10 @@ const { until } = require('selenium-webdriver')
module.exports = {
checkBrowserForConsoleErrors,
loadExtension,
findElement,
findElements,
}
async function loadExtension (driver, extensionId) {
switch (process.env.SELENIUM_BROWSER) {
case 'chrome': {
await driver.get(`chrome-extension://${extensionId}/home.html`)
break
}
case 'firefox': {
await driver.get(`moz-extension://${extensionId}/home.html`)
break
}
}
}
async function checkBrowserForConsoleErrors (driver) {
const ignoredLogTypes = ['WARNING']
const ignoredErrorMessages = [

View File

@ -12,13 +12,12 @@ const {
findElement,
findElements,
checkBrowserForConsoleErrors,
loadExtension,
} = require('./helpers')
describe('MetaMask', function () {
const browser = process.env.SELENIUM_BROWSER
let extensionId
let driver
let extensionUri
let tokenAddress
const testSeedPhrase = 'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent'
@ -361,7 +360,7 @@ describe('MetaMask', function () {
await delay(regularDelayMs)
await driver.switchTo().window(extension)
await loadExtension(driver, extensionId)
await driver.get(extensionUri)
await delay(regularDelayMs)
const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`), 14000)
@ -374,7 +373,7 @@ describe('MetaMask', function () {
await delay(regularDelayMs)
await driver.switchTo().window(extension)
await delay(regularDelayMs)
await loadExtension(driver, extensionId)
await driver.get(extensionUri)
await delay(regularDelayMs)
})
})
@ -437,7 +436,7 @@ describe('MetaMask', function () {
await delay(regularDelayMs)
await driver.switchTo().window(extension)
await loadExtension(driver, extensionId)
await driver.get(extensionUri)
await delay(regularDelayMs)
const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
@ -450,7 +449,7 @@ describe('MetaMask', function () {
tokenAddress = await tokenContactAddress.getText()
await driver.close()
await driver.switchTo().window(extension)
await loadExtension(driver, extensionId)
await driver.get(extensionUri)
await delay(regularDelayMs)
})

View File

@ -8,7 +8,7 @@ const { delay, createModifiedTestBuild, setupBrowserAndExtension, verboseReportO
describe('Metamask popup page', function () {
const browser = process.env.SELENIUM_BROWSER
let driver, accountAddress, tokenAddress, extensionId, extensionUri
let driver, accountAddress, tokenAddress, extensionUri
this.timeout(0)