mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 02:10:12 +01:00
Update new UI e2e tests for new UI default
This commit is contained in:
parent
c482c9926c
commit
921125b7fd
@ -81,22 +81,6 @@ describe('MetaMask', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('selects the new UI option', async () => {
|
it('selects the new UI option', async () => {
|
||||||
try {
|
|
||||||
const overlay = await findElement(driver, By.css('.full-flex-height'))
|
|
||||||
await driver.wait(until.stalenessOf(overlay))
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
let button
|
|
||||||
try {
|
|
||||||
button = await findElement(driver, By.xpath("//button[contains(text(), 'Try it now')]"))
|
|
||||||
} catch (e) {
|
|
||||||
await loadExtension(driver, extensionId)
|
|
||||||
await delay(largeDelayMs)
|
|
||||||
button = await findElement(driver, By.xpath("//button[contains(text(), 'Try it now')]"))
|
|
||||||
}
|
|
||||||
await button.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
|
|
||||||
// Close all other tabs
|
// Close all other tabs
|
||||||
const [tab0, tab1, tab2] = await driver.getAllWindowHandles()
|
const [tab0, tab1, tab2] = await driver.getAllWindowHandles()
|
||||||
await driver.switchTo().window(tab0)
|
await driver.switchTo().window(tab0)
|
||||||
|
@ -12,11 +12,9 @@ const {
|
|||||||
} = require('../func')
|
} = require('../func')
|
||||||
const {
|
const {
|
||||||
checkBrowserForConsoleErrors,
|
checkBrowserForConsoleErrors,
|
||||||
closeAllWindowHandlesExcept,
|
|
||||||
verboseReportOnFailure,
|
verboseReportOnFailure,
|
||||||
findElement,
|
findElement,
|
||||||
findElements,
|
findElements,
|
||||||
loadExtension,
|
|
||||||
} = require('./helpers')
|
} = require('./helpers')
|
||||||
|
|
||||||
|
|
||||||
@ -27,7 +25,6 @@ describe('Using MetaMask with an existing account', function () {
|
|||||||
const testSeedPhrase = 'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent'
|
const testSeedPhrase = 'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent'
|
||||||
const testAddress = '0xE18035BF8712672935FDB4e5e431b1a0183d2DFC'
|
const testAddress = '0xE18035BF8712672935FDB4e5e431b1a0183d2DFC'
|
||||||
const testPrivateKey2 = '14abe6f4aab7f9f626fe981c864d0adeb5685f289ac9270c27b8fd790b4235d6'
|
const testPrivateKey2 = '14abe6f4aab7f9f626fe981c864d0adeb5685f289ac9270c27b8fd790b4235d6'
|
||||||
const tinyDelayMs = 500
|
|
||||||
const regularDelayMs = 1000
|
const regularDelayMs = 1000
|
||||||
const largeDelayMs = regularDelayMs * 2
|
const largeDelayMs = regularDelayMs * 2
|
||||||
|
|
||||||
@ -40,7 +37,7 @@ describe('Using MetaMask with an existing account', function () {
|
|||||||
const extensionPath = path.resolve('dist/chrome')
|
const extensionPath = path.resolve('dist/chrome')
|
||||||
driver = buildChromeWebDriver(extensionPath)
|
driver = buildChromeWebDriver(extensionPath)
|
||||||
extensionId = await getExtensionIdChrome(driver)
|
extensionId = await getExtensionIdChrome(driver)
|
||||||
await driver.get(`chrome-extension://${extensionId}/popup.html`)
|
await driver.get(`chrome-extension://${extensionId}/home.html`)
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -50,7 +47,7 @@ describe('Using MetaMask with an existing account', function () {
|
|||||||
await installWebExt(driver, extensionPath)
|
await installWebExt(driver, extensionPath)
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
extensionId = await getExtensionIdFirefox(driver)
|
extensionId = await getExtensionIdFirefox(driver)
|
||||||
await driver.get(`moz-extension://${extensionId}/popup.html`)
|
await driver.get(`moz-extension://${extensionId}/home.html`)
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -75,69 +72,13 @@ describe('Using MetaMask with an existing account', function () {
|
|||||||
await driver.quit()
|
await driver.quit()
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('New UI setup', async function () {
|
|
||||||
it('switches to first tab', async function () {
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
const [firstTab] = await driver.getAllWindowHandles()
|
|
||||||
await driver.switchTo().window(firstTab)
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('selects the new UI option', async () => {
|
|
||||||
try {
|
|
||||||
const overlay = await findElement(driver, By.css('.full-flex-height'))
|
|
||||||
await driver.wait(until.stalenessOf(overlay))
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
let button
|
|
||||||
try {
|
|
||||||
button = await findElement(driver, By.xpath("//button[contains(text(), 'Try it now')]"))
|
|
||||||
} catch (e) {
|
|
||||||
await loadExtension(driver, extensionId)
|
|
||||||
await delay(largeDelayMs)
|
|
||||||
button = await findElement(driver, By.xpath("//button[contains(text(), 'Try it now')]"))
|
|
||||||
}
|
|
||||||
await button.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
|
|
||||||
// Close all other tabs
|
|
||||||
const [tab0, tab1, tab2] = await driver.getAllWindowHandles()
|
|
||||||
await driver.switchTo().window(tab0)
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
|
|
||||||
let selectedUrl = await driver.getCurrentUrl()
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
if (tab0 && selectedUrl.match(/popup.html/)) {
|
|
||||||
await closeAllWindowHandlesExcept(driver, tab0)
|
|
||||||
} else if (tab1) {
|
|
||||||
await driver.switchTo().window(tab1)
|
|
||||||
selectedUrl = await driver.getCurrentUrl()
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
if (selectedUrl.match(/popup.html/)) {
|
|
||||||
await closeAllWindowHandlesExcept(driver, tab1)
|
|
||||||
} else if (tab2) {
|
|
||||||
await driver.switchTo().window(tab2)
|
|
||||||
selectedUrl = await driver.getCurrentUrl()
|
|
||||||
selectedUrl.match(/popup.html/) && await closeAllWindowHandlesExcept(driver, tab2)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new Error('popup.html not found')
|
|
||||||
}
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
const [appTab] = await driver.getAllWindowHandles()
|
|
||||||
await driver.switchTo().window(appTab)
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
|
|
||||||
await loadExtension(driver, extensionId)
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
|
|
||||||
const continueBtn = await findElement(driver, By.css('.welcome-screen__button'))
|
|
||||||
await continueBtn.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('First time flow starting from an existing seed phrase', () => {
|
describe('First time flow starting from an existing seed phrase', () => {
|
||||||
|
it('clicks the continue button on the welcome screen', async () => {
|
||||||
|
const welcomeScreenBtn = await findElement(driver, By.css('.welcome-screen__button'))
|
||||||
|
welcomeScreenBtn.click()
|
||||||
|
await delay(largeDelayMs)
|
||||||
|
})
|
||||||
|
|
||||||
it('imports a seed phrase', async () => {
|
it('imports a seed phrase', async () => {
|
||||||
const [seedPhrase] = await findElements(driver, By.xpath(`//a[contains(text(), 'Import with seed phrase')]`))
|
const [seedPhrase] = await findElements(driver, By.xpath(`//a[contains(text(), 'Import with seed phrase')]`))
|
||||||
await seedPhrase.click()
|
await seedPhrase.click()
|
||||||
|
@ -12,7 +12,6 @@ const {
|
|||||||
} = require('../func')
|
} = require('../func')
|
||||||
const {
|
const {
|
||||||
checkBrowserForConsoleErrors,
|
checkBrowserForConsoleErrors,
|
||||||
closeAllWindowHandlesExcept,
|
|
||||||
findElement,
|
findElement,
|
||||||
findElements,
|
findElements,
|
||||||
loadExtension,
|
loadExtension,
|
||||||
@ -37,7 +36,7 @@ describe('MetaMask', function () {
|
|||||||
const extPath = path.resolve('dist/chrome')
|
const extPath = path.resolve('dist/chrome')
|
||||||
driver = buildChromeWebDriver(extPath, { responsive: true })
|
driver = buildChromeWebDriver(extPath, { responsive: true })
|
||||||
extensionId = await getExtensionIdChrome(driver)
|
extensionId = await getExtensionIdChrome(driver)
|
||||||
await driver.get(`chrome-extension://${extensionId}/popup.html`)
|
await driver.get(`chrome-extension://${extensionId}/home.html`)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'firefox': {
|
case 'firefox': {
|
||||||
@ -46,7 +45,7 @@ describe('MetaMask', function () {
|
|||||||
await installWebExt(driver, extPath)
|
await installWebExt(driver, extPath)
|
||||||
await delay(700)
|
await delay(700)
|
||||||
extensionId = await getExtensionIdFirefox(driver)
|
extensionId = await getExtensionIdFirefox(driver)
|
||||||
await driver.get(`moz-extension://${extensionId}/popup.html`)
|
await driver.get(`moz-extension://${extensionId}/home.html`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -69,69 +68,13 @@ describe('MetaMask', function () {
|
|||||||
await driver.quit()
|
await driver.quit()
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('New UI setup', async function () {
|
|
||||||
it('switches to first tab', async function () {
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
const [firstTab] = await driver.getAllWindowHandles()
|
|
||||||
await driver.switchTo().window(firstTab)
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('selects the new UI option', async () => {
|
|
||||||
try {
|
|
||||||
const overlay = await findElement(driver, By.css('.full-flex-height'))
|
|
||||||
await driver.wait(until.stalenessOf(overlay))
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
let button
|
|
||||||
try {
|
|
||||||
button = await findElement(driver, By.xpath("//button[contains(text(), 'Try it now')]"))
|
|
||||||
} catch (e) {
|
|
||||||
await loadExtension(driver, extensionId)
|
|
||||||
await delay(largeDelayMs)
|
|
||||||
button = await findElement(driver, By.xpath("//button[contains(text(), 'Try it now')]"))
|
|
||||||
}
|
|
||||||
await button.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
|
|
||||||
// Close all other tabs
|
|
||||||
const [tab0, tab1, tab2] = await driver.getAllWindowHandles()
|
|
||||||
await driver.switchTo().window(tab0)
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
|
|
||||||
let selectedUrl = await driver.getCurrentUrl()
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
if (tab0 && selectedUrl.match(/popup.html/)) {
|
|
||||||
await closeAllWindowHandlesExcept(driver, tab0)
|
|
||||||
} else if (tab1) {
|
|
||||||
await driver.switchTo().window(tab1)
|
|
||||||
selectedUrl = await driver.getCurrentUrl()
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
if (selectedUrl.match(/popup.html/)) {
|
|
||||||
await closeAllWindowHandlesExcept(driver, tab1)
|
|
||||||
} else if (tab2) {
|
|
||||||
await driver.switchTo().window(tab2)
|
|
||||||
selectedUrl = await driver.getCurrentUrl()
|
|
||||||
selectedUrl.match(/popup.html/) && await closeAllWindowHandlesExcept(driver, tab2)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new Error('popup.html not found')
|
|
||||||
}
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
const [appTab] = await driver.getAllWindowHandles()
|
|
||||||
await driver.switchTo().window(appTab)
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
|
|
||||||
await loadExtension(driver, extensionId)
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
|
|
||||||
const continueBtn = await findElement(driver, By.css('.welcome-screen__button'))
|
|
||||||
await continueBtn.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('Going through the first time flow', () => {
|
describe('Going through the first time flow', () => {
|
||||||
|
it('clicks the continue button on the welcome screen', async () => {
|
||||||
|
const welcomeScreenBtn = await findElement(driver, By.css('.welcome-screen__button'))
|
||||||
|
welcomeScreenBtn.click()
|
||||||
|
await delay(largeDelayMs)
|
||||||
|
})
|
||||||
|
|
||||||
it('accepts a secure password', async () => {
|
it('accepts a secure password', async () => {
|
||||||
const passwordBox = await findElement(driver, By.css('.create-password #create-password'))
|
const passwordBox = await findElement(driver, By.css('.create-password #create-password'))
|
||||||
const passwordBoxConfirm = await findElement(driver, By.css('.create-password #confirm-password'))
|
const passwordBoxConfirm = await findElement(driver, By.css('.create-password #confirm-password'))
|
||||||
|
@ -42,7 +42,7 @@ describe('MetaMask', function () {
|
|||||||
const extPath = path.resolve('dist/chrome')
|
const extPath = path.resolve('dist/chrome')
|
||||||
driver = buildChromeWebDriver(extPath)
|
driver = buildChromeWebDriver(extPath)
|
||||||
extensionId = await getExtensionIdChrome(driver)
|
extensionId = await getExtensionIdChrome(driver)
|
||||||
await driver.get(`chrome-extension://${extensionId}/popup.html`)
|
await driver.get(`chrome-extension://${extensionId}/home.html`)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'firefox': {
|
case 'firefox': {
|
||||||
@ -51,7 +51,7 @@ describe('MetaMask', function () {
|
|||||||
await installWebExt(driver, extPath)
|
await installWebExt(driver, extPath)
|
||||||
await delay(700)
|
await delay(700)
|
||||||
extensionId = await getExtensionIdFirefox(driver)
|
extensionId = await getExtensionIdFirefox(driver)
|
||||||
await driver.get(`moz-extension://${extensionId}/popup.html`)
|
await driver.get(`moz-extension://${extensionId}/home.html`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -74,69 +74,13 @@ describe('MetaMask', function () {
|
|||||||
await driver.quit()
|
await driver.quit()
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('New UI setup', async function () {
|
|
||||||
it('switches to first tab', async function () {
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
const [firstTab] = await driver.getAllWindowHandles()
|
|
||||||
await driver.switchTo().window(firstTab)
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('selects the new UI option', async () => {
|
|
||||||
try {
|
|
||||||
const overlay = await findElement(driver, By.css('.full-flex-height'))
|
|
||||||
await driver.wait(until.stalenessOf(overlay))
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
let button
|
|
||||||
try {
|
|
||||||
button = await findElement(driver, By.xpath("//button[contains(text(), 'Try it now')]"))
|
|
||||||
} catch (e) {
|
|
||||||
await loadExtension(driver, extensionId)
|
|
||||||
await delay(largeDelayMs)
|
|
||||||
button = await findElement(driver, By.xpath("//button[contains(text(), 'Try it now')]"))
|
|
||||||
}
|
|
||||||
await button.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
|
|
||||||
// Close all other tabs
|
|
||||||
const [tab0, tab1, tab2] = await driver.getAllWindowHandles()
|
|
||||||
await driver.switchTo().window(tab0)
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
|
|
||||||
let selectedUrl = await driver.getCurrentUrl()
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
if (tab0 && selectedUrl.match(/popup.html/)) {
|
|
||||||
await closeAllWindowHandlesExcept(driver, tab0)
|
|
||||||
} else if (tab1) {
|
|
||||||
await driver.switchTo().window(tab1)
|
|
||||||
selectedUrl = await driver.getCurrentUrl()
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
if (selectedUrl.match(/popup.html/)) {
|
|
||||||
await closeAllWindowHandlesExcept(driver, tab1)
|
|
||||||
} else if (tab2) {
|
|
||||||
await driver.switchTo().window(tab2)
|
|
||||||
selectedUrl = await driver.getCurrentUrl()
|
|
||||||
selectedUrl.match(/popup.html/) && await closeAllWindowHandlesExcept(driver, tab2)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new Error('popup.html not found')
|
|
||||||
}
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
const [appTab] = await driver.getAllWindowHandles()
|
|
||||||
await driver.switchTo().window(appTab)
|
|
||||||
await delay(tinyDelayMs)
|
|
||||||
|
|
||||||
await loadExtension(driver, extensionId)
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
|
|
||||||
const continueBtn = await findElement(driver, By.css('.welcome-screen__button'))
|
|
||||||
await continueBtn.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('Going through the first time flow', () => {
|
describe('Going through the first time flow', () => {
|
||||||
|
it('clicks the continue button on the welcome screen', async () => {
|
||||||
|
const welcomeScreenBtn = await findElement(driver, By.css('.welcome-screen__button'))
|
||||||
|
welcomeScreenBtn.click()
|
||||||
|
await delay(largeDelayMs)
|
||||||
|
})
|
||||||
|
|
||||||
it('accepts a secure password', async () => {
|
it('accepts a secure password', async () => {
|
||||||
const passwordBox = await findElement(driver, By.css('.create-password #create-password'))
|
const passwordBox = await findElement(driver, By.css('.create-password #create-password'))
|
||||||
const passwordBoxConfirm = await findElement(driver, By.css('.create-password #confirm-password'))
|
const passwordBoxConfirm = await findElement(driver, By.css('.create-password #confirm-password'))
|
||||||
|
Loading…
Reference in New Issue
Block a user