mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix flaky e2e tests (#7307)
* Add a delay after connecting This addresses an intermittent test failure where the MetaMask Notification window cannot be found. It appears to be caused by the Send button being clicked too soon after connecting to a dapp, before the background has had a chance to process the approval. The premature send is ignored and the window never appears. This delay (2 seconds) should be sufficient time for the connection to be processed. A later 5-second delay was also reduced to 2 seconds. * Select onboarding buttons by button text The onboarding buttons were being selected using the classname, which was common to all onboarding buttons. This resulting in buttons being selected just before a page transition, leading to an error about the element reference being stale when a click was attempted. The CSS class selectors have been replaced by text selectors, which are more specific and shouldn't be at risk of resolving early. They're also easier to read. * Remove retypeSeedPhrase function This function was used to re-type the seed phrase in the event that a failure occurred when confirming the seed phrase. I'm not sure what failure this was meant to address exactly, but this contingency hasn't been needed for some time. We can tell that it hasn't been used because it wasn't updated for the incremental account security changes, so it couldn't have worked since then (it would have clicked the wrong button).
This commit is contained in:
parent
5c8048fcc1
commit
adb50d1357
@ -8,14 +8,13 @@ const {
|
|||||||
checkBrowserForConsoleErrors,
|
checkBrowserForConsoleErrors,
|
||||||
findElement,
|
findElement,
|
||||||
findElements,
|
findElements,
|
||||||
loadExtension,
|
|
||||||
verboseReportOnFailure,
|
verboseReportOnFailure,
|
||||||
setupFetchMocking,
|
setupFetchMocking,
|
||||||
prepareExtensionForTesting,
|
prepareExtensionForTesting,
|
||||||
} = require('./helpers')
|
} = require('./helpers')
|
||||||
|
const enLocaleMessages = require('../../app/_locales/en/messages.json')
|
||||||
|
|
||||||
describe('MetaMask', function () {
|
describe('MetaMask', function () {
|
||||||
let extensionId
|
|
||||||
let driver
|
let driver
|
||||||
|
|
||||||
const testSeedPhrase = 'forum vessel pink push lonely enact gentle tail admit parrot grunt dress'
|
const testSeedPhrase = 'forum vessel pink push lonely enact gentle tail admit parrot grunt dress'
|
||||||
@ -29,7 +28,6 @@ describe('MetaMask', function () {
|
|||||||
before(async function () {
|
before(async function () {
|
||||||
const result = await prepareExtensionForTesting()
|
const result = await prepareExtensionForTesting()
|
||||||
driver = result.driver
|
driver = result.driver
|
||||||
extensionId = result.extensionId
|
|
||||||
await setupFetchMocking(driver)
|
await setupFetchMocking(driver)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -54,7 +52,7 @@ describe('MetaMask', function () {
|
|||||||
describe('Going through the first time flow', () => {
|
describe('Going through the first time flow', () => {
|
||||||
it('clicks the continue button on the welcome screen', async () => {
|
it('clicks the continue button on the welcome screen', async () => {
|
||||||
await findElement(driver, By.css('.welcome-page__header'))
|
await findElement(driver, By.css('.welcome-page__header'))
|
||||||
const welcomeScreenBtn = await findElement(driver, By.css('.first-time-flow__button'))
|
const welcomeScreenBtn = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`))
|
||||||
welcomeScreenBtn.click()
|
welcomeScreenBtn.click()
|
||||||
await delay(largeDelayMs)
|
await delay(largeDelayMs)
|
||||||
})
|
})
|
||||||
@ -99,7 +97,7 @@ describe('MetaMask', function () {
|
|||||||
assert.equal(seedPhrase.split(' ').length, 12)
|
assert.equal(seedPhrase.split(' ').length, 12)
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
|
|
||||||
const nextScreen = (await findElements(driver, By.css('button.first-time-flow__button')))[1]
|
const nextScreen = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.next.message}')]`))
|
||||||
await nextScreen.click()
|
await nextScreen.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
@ -112,37 +110,12 @@ describe('MetaMask', function () {
|
|||||||
await delay(tinyDelayMs)
|
await delay(tinyDelayMs)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function retypeSeedPhrase (words, wasReloaded, count = 0) {
|
|
||||||
try {
|
|
||||||
if (wasReloaded) {
|
|
||||||
const byRevealButton = By.css('.reveal-seed-phrase__secret-blocker .reveal-seed-phrase__reveal-button')
|
|
||||||
await driver.wait(until.elementLocated(byRevealButton, 10000))
|
|
||||||
const revealSeedPhraseButton = await findElement(driver, byRevealButton, 10000)
|
|
||||||
await revealSeedPhraseButton.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
|
|
||||||
const nextScreen = await findElement(driver, By.css('button.first-time-flow__button'))
|
|
||||||
await nextScreen.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < 12; i++) {
|
|
||||||
await clickWordAndWait(words[i])
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
if (count > 2) {
|
|
||||||
throw e
|
|
||||||
} else {
|
|
||||||
await loadExtension(driver, extensionId)
|
|
||||||
await retypeSeedPhrase(words, true, count + 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
it('can retype the seed phrase', async () => {
|
it('can retype the seed phrase', async () => {
|
||||||
const words = seedPhrase.split(' ')
|
const words = seedPhrase.split(' ')
|
||||||
|
|
||||||
await retypeSeedPhrase(words)
|
for (const word of words) {
|
||||||
|
await clickWordAndWait(word)
|
||||||
|
}
|
||||||
|
|
||||||
const confirm = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
|
const confirm = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
|
||||||
await confirm.click()
|
await confirm.click()
|
||||||
@ -151,7 +124,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
it('clicks through the success screen', async () => {
|
it('clicks through the success screen', async () => {
|
||||||
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
||||||
const doneButton = await findElement(driver, By.css('button.first-time-flow__button'))
|
const doneButton = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.endOfFlowMessage10.message}')]`))
|
||||||
await doneButton.click()
|
await doneButton.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
@ -183,7 +156,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
await passwordInputs[0].sendKeys('correct horse battery staple')
|
await passwordInputs[0].sendKeys('correct horse battery staple')
|
||||||
await passwordInputs[1].sendKeys('correct horse battery staple')
|
await passwordInputs[1].sendKeys('correct horse battery staple')
|
||||||
await driver.findElement(By.css('.first-time-flow__button')).click()
|
await driver.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.restore.message}')]`)).click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ const {
|
|||||||
const {
|
const {
|
||||||
checkBrowserForConsoleErrors,
|
checkBrowserForConsoleErrors,
|
||||||
findElement,
|
findElement,
|
||||||
findElements,
|
|
||||||
openNewPage,
|
openNewPage,
|
||||||
verboseReportOnFailure,
|
verboseReportOnFailure,
|
||||||
waitUntilXWindowHandles,
|
waitUntilXWindowHandles,
|
||||||
@ -15,6 +14,7 @@ const {
|
|||||||
setupFetchMocking,
|
setupFetchMocking,
|
||||||
prepareExtensionForTesting,
|
prepareExtensionForTesting,
|
||||||
} = require('./helpers')
|
} = require('./helpers')
|
||||||
|
const enLocaleMessages = require('../../app/_locales/en/messages.json')
|
||||||
|
|
||||||
describe('MetaMask', function () {
|
describe('MetaMask', function () {
|
||||||
let driver
|
let driver
|
||||||
@ -54,7 +54,7 @@ describe('MetaMask', function () {
|
|||||||
describe('Going through the first time flow, but skipping the seed phrase challenge', () => {
|
describe('Going through the first time flow, but skipping the seed phrase challenge', () => {
|
||||||
it('clicks the continue button on the welcome screen', async () => {
|
it('clicks the continue button on the welcome screen', async () => {
|
||||||
await findElement(driver, By.css('.welcome-page__header'))
|
await findElement(driver, By.css('.welcome-page__header'))
|
||||||
const welcomeScreenBtn = await findElement(driver, By.css('.first-time-flow__button'))
|
const welcomeScreenBtn = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`))
|
||||||
welcomeScreenBtn.click()
|
welcomeScreenBtn.click()
|
||||||
await delay(largeDelayMs)
|
await delay(largeDelayMs)
|
||||||
})
|
})
|
||||||
@ -87,8 +87,8 @@ describe('MetaMask', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('skips the seed phrase challenge', async () => {
|
it('skips the seed phrase challenge', async () => {
|
||||||
const buttons = await findElements(driver, By.css('.first-time-flow__button'))
|
const button = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.remindMeLater.message}')]`))
|
||||||
await buttons[0].click()
|
await button.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
|
|
||||||
const detailsButton = await findElement(driver, By.css('.account-details__details-button'))
|
const detailsButton = await findElement(driver, By.css('.account-details__details-button'))
|
||||||
|
@ -12,6 +12,7 @@ const {
|
|||||||
setupFetchMocking,
|
setupFetchMocking,
|
||||||
prepareExtensionForTesting,
|
prepareExtensionForTesting,
|
||||||
} = require('./helpers')
|
} = require('./helpers')
|
||||||
|
const enLocaleMessages = require('../../app/_locales/en/messages.json')
|
||||||
|
|
||||||
describe('Using MetaMask with an existing account', function () {
|
describe('Using MetaMask with an existing account', function () {
|
||||||
let driver
|
let driver
|
||||||
@ -54,7 +55,7 @@ describe('Using MetaMask with an existing account', function () {
|
|||||||
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 () => {
|
it('clicks the continue button on the welcome screen', async () => {
|
||||||
await findElement(driver, By.css('.welcome-page__header'))
|
await findElement(driver, By.css('.welcome-page__header'))
|
||||||
const welcomeScreenBtn = await findElement(driver, By.css('.first-time-flow__button'))
|
const welcomeScreenBtn = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`))
|
||||||
welcomeScreenBtn.click()
|
welcomeScreenBtn.click()
|
||||||
await delay(largeDelayMs)
|
await delay(largeDelayMs)
|
||||||
})
|
})
|
||||||
@ -91,7 +92,7 @@ describe('Using MetaMask with an existing account', function () {
|
|||||||
|
|
||||||
it('clicks through the success screen', async () => {
|
it('clicks through the success screen', async () => {
|
||||||
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
||||||
const doneButton = await findElement(driver, By.css('button.first-time-flow__button'))
|
const doneButton = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.endOfFlowMessage10.message}')]`))
|
||||||
await doneButton.click()
|
await doneButton.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
|
@ -9,15 +9,14 @@ const {
|
|||||||
checkBrowserForConsoleErrors,
|
checkBrowserForConsoleErrors,
|
||||||
findElement,
|
findElement,
|
||||||
findElements,
|
findElements,
|
||||||
loadExtension,
|
|
||||||
openNewPage,
|
openNewPage,
|
||||||
verboseReportOnFailure,
|
verboseReportOnFailure,
|
||||||
setupFetchMocking,
|
setupFetchMocking,
|
||||||
prepareExtensionForTesting,
|
prepareExtensionForTesting,
|
||||||
} = require('./helpers')
|
} = require('./helpers')
|
||||||
|
const enLocaleMessages = require('../../app/_locales/en/messages.json')
|
||||||
|
|
||||||
describe('MetaMask', function () {
|
describe('MetaMask', function () {
|
||||||
let extensionId
|
|
||||||
let driver
|
let driver
|
||||||
let publicAddress
|
let publicAddress
|
||||||
|
|
||||||
@ -31,7 +30,6 @@ describe('MetaMask', function () {
|
|||||||
before(async function () {
|
before(async function () {
|
||||||
const result = await prepareExtensionForTesting()
|
const result = await prepareExtensionForTesting()
|
||||||
driver = result.driver
|
driver = result.driver
|
||||||
extensionId = result.extensionId
|
|
||||||
await setupFetchMocking(driver)
|
await setupFetchMocking(driver)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -56,7 +54,7 @@ describe('MetaMask', function () {
|
|||||||
describe('Going through the first time flow, but skipping the seed phrase challenge', () => {
|
describe('Going through the first time flow, but skipping the seed phrase challenge', () => {
|
||||||
it('clicks the continue button on the welcome screen', async () => {
|
it('clicks the continue button on the welcome screen', async () => {
|
||||||
await findElement(driver, By.css('.welcome-page__header'))
|
await findElement(driver, By.css('.welcome-page__header'))
|
||||||
const welcomeScreenBtn = await findElement(driver, By.css('.first-time-flow__button'))
|
const welcomeScreenBtn = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`))
|
||||||
welcomeScreenBtn.click()
|
welcomeScreenBtn.click()
|
||||||
await delay(largeDelayMs)
|
await delay(largeDelayMs)
|
||||||
})
|
})
|
||||||
@ -89,8 +87,8 @@ describe('MetaMask', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('skips the seed phrase challenge', async () => {
|
it('skips the seed phrase challenge', async () => {
|
||||||
const buttons = await findElements(driver, By.css('.first-time-flow__button'))
|
const button = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.remindMeLater.message}')]`))
|
||||||
await buttons[0].click()
|
await button.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
|
|
||||||
const detailsButton = await findElement(driver, By.css('.account-details__details-button'))
|
const detailsButton = await findElement(driver, By.css('.account-details__details-button'))
|
||||||
@ -173,7 +171,7 @@ describe('MetaMask', function () {
|
|||||||
assert.equal(seedPhrase.split(' ').length, 12)
|
assert.equal(seedPhrase.split(' ').length, 12)
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
|
|
||||||
const nextScreen = (await findElements(driver, By.css('button.first-time-flow__button')))[1]
|
const nextScreen = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.next.message}')]`))
|
||||||
await nextScreen.click()
|
await nextScreen.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
@ -186,37 +184,12 @@ describe('MetaMask', function () {
|
|||||||
await delay(tinyDelayMs)
|
await delay(tinyDelayMs)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function retypeSeedPhrase (words, wasReloaded, count = 0) {
|
|
||||||
try {
|
|
||||||
if (wasReloaded) {
|
|
||||||
const byRevealButton = By.css('.reveal-seed-phrase__secret-blocker .reveal-seed-phrase__reveal-button')
|
|
||||||
await driver.wait(until.elementLocated(byRevealButton, 10000))
|
|
||||||
const revealSeedPhraseButton = await findElement(driver, byRevealButton, 10000)
|
|
||||||
await revealSeedPhraseButton.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
|
|
||||||
const nextScreen = await findElement(driver, By.css('button.first-time-flow__button'))
|
|
||||||
await nextScreen.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < 12; i++) {
|
|
||||||
await clickWordAndWait(words[i])
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
if (count > 2) {
|
|
||||||
throw e
|
|
||||||
} else {
|
|
||||||
await loadExtension(driver, extensionId)
|
|
||||||
await retypeSeedPhrase(words, true, count + 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
it('can retype the seed phrase', async () => {
|
it('can retype the seed phrase', async () => {
|
||||||
const words = seedPhrase.split(' ')
|
const words = seedPhrase.split(' ')
|
||||||
|
|
||||||
await retypeSeedPhrase(words)
|
for (const word of words) {
|
||||||
|
await clickWordAndWait(word)
|
||||||
|
}
|
||||||
|
|
||||||
const confirm = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
|
const confirm = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
|
||||||
await confirm.click()
|
await confirm.click()
|
||||||
|
@ -8,14 +8,13 @@ const {
|
|||||||
checkBrowserForConsoleErrors,
|
checkBrowserForConsoleErrors,
|
||||||
findElement,
|
findElement,
|
||||||
findElements,
|
findElements,
|
||||||
loadExtension,
|
|
||||||
verboseReportOnFailure,
|
verboseReportOnFailure,
|
||||||
setupFetchMocking,
|
setupFetchMocking,
|
||||||
prepareExtensionForTesting,
|
prepareExtensionForTesting,
|
||||||
} = require('./helpers')
|
} = require('./helpers')
|
||||||
|
const enLocaleMessages = require('../../app/_locales/en/messages.json')
|
||||||
|
|
||||||
describe('MetaMask', function () {
|
describe('MetaMask', function () {
|
||||||
let extensionId
|
|
||||||
let driver
|
let driver
|
||||||
|
|
||||||
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'
|
||||||
@ -29,7 +28,6 @@ describe('MetaMask', function () {
|
|||||||
before(async function () {
|
before(async function () {
|
||||||
const result = await prepareExtensionForTesting({ responsive: true })
|
const result = await prepareExtensionForTesting({ responsive: true })
|
||||||
driver = result.driver
|
driver = result.driver
|
||||||
extensionId = result.extensionId
|
|
||||||
await setupFetchMocking(driver)
|
await setupFetchMocking(driver)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -54,7 +52,7 @@ describe('MetaMask', function () {
|
|||||||
describe('Going through the first time flow', () => {
|
describe('Going through the first time flow', () => {
|
||||||
it('clicks the continue button on the welcome screen', async () => {
|
it('clicks the continue button on the welcome screen', async () => {
|
||||||
await findElement(driver, By.css('.welcome-page__header'))
|
await findElement(driver, By.css('.welcome-page__header'))
|
||||||
const welcomeScreenBtn = await findElement(driver, By.css('.first-time-flow__button'))
|
const welcomeScreenBtn = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`))
|
||||||
welcomeScreenBtn.click()
|
welcomeScreenBtn.click()
|
||||||
await delay(largeDelayMs)
|
await delay(largeDelayMs)
|
||||||
})
|
})
|
||||||
@ -99,7 +97,7 @@ describe('MetaMask', function () {
|
|||||||
assert.equal(seedPhrase.split(' ').length, 12)
|
assert.equal(seedPhrase.split(' ').length, 12)
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
|
|
||||||
const nextScreen = (await findElements(driver, By.css('button.first-time-flow__button')))[1]
|
const nextScreen = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.next.message}')]`))
|
||||||
await nextScreen.click()
|
await nextScreen.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
@ -112,37 +110,12 @@ describe('MetaMask', function () {
|
|||||||
await delay(tinyDelayMs)
|
await delay(tinyDelayMs)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function retypeSeedPhrase (words, wasReloaded, count = 0) {
|
|
||||||
try {
|
|
||||||
if (wasReloaded) {
|
|
||||||
const byRevealButton = By.css('.reveal-seed-phrase__secret-blocker .reveal-seed-phrase__reveal-button')
|
|
||||||
await driver.wait(until.elementLocated(byRevealButton, 10000))
|
|
||||||
const revealSeedPhraseButton = await findElement(driver, byRevealButton, 10000)
|
|
||||||
await revealSeedPhraseButton.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
|
|
||||||
const nextScreen = await findElement(driver, By.css('button.first-time-flow__button'))
|
|
||||||
await nextScreen.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < 12; i++) {
|
|
||||||
await clickWordAndWait(words[i])
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
if (count > 2) {
|
|
||||||
throw e
|
|
||||||
} else {
|
|
||||||
await loadExtension(driver, extensionId)
|
|
||||||
await retypeSeedPhrase(words, true, count + 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
it('can retype the seed phrase', async () => {
|
it('can retype the seed phrase', async () => {
|
||||||
const words = seedPhrase.split(' ')
|
const words = seedPhrase.split(' ')
|
||||||
|
|
||||||
await retypeSeedPhrase(words)
|
for (const word of words) {
|
||||||
|
await clickWordAndWait(word)
|
||||||
|
}
|
||||||
|
|
||||||
const confirm = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
|
const confirm = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
|
||||||
await confirm.click()
|
await confirm.click()
|
||||||
@ -151,7 +124,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
it('clicks through the success screen', async () => {
|
it('clicks through the success screen', async () => {
|
||||||
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
||||||
const doneButton = await findElement(driver, By.css('button.first-time-flow__button'))
|
const doneButton = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.endOfFlowMessage10.message}')]`))
|
||||||
await doneButton.click()
|
await doneButton.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
@ -192,7 +165,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
await passwordInputs[0].sendKeys('correct horse battery staple')
|
await passwordInputs[0].sendKeys('correct horse battery staple')
|
||||||
await passwordInputs[1].sendKeys('correct horse battery staple')
|
await passwordInputs[1].sendKeys('correct horse battery staple')
|
||||||
await driver.findElement(By.css('.first-time-flow__button')).click()
|
await driver.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.restore.message}')]`)).click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ const {
|
|||||||
closeAllWindowHandlesExcept,
|
closeAllWindowHandlesExcept,
|
||||||
findElement,
|
findElement,
|
||||||
findElements,
|
findElements,
|
||||||
loadExtension,
|
|
||||||
openNewPage,
|
openNewPage,
|
||||||
switchToWindowWithTitle,
|
switchToWindowWithTitle,
|
||||||
verboseReportOnFailure,
|
verboseReportOnFailure,
|
||||||
@ -18,9 +17,9 @@ const {
|
|||||||
setupFetchMocking,
|
setupFetchMocking,
|
||||||
prepareExtensionForTesting,
|
prepareExtensionForTesting,
|
||||||
} = require('./helpers')
|
} = require('./helpers')
|
||||||
|
const enLocaleMessages = require('../../app/_locales/en/messages.json')
|
||||||
|
|
||||||
describe('MetaMask', function () {
|
describe('MetaMask', function () {
|
||||||
let extensionId
|
|
||||||
let driver
|
let driver
|
||||||
let tokenAddress
|
let tokenAddress
|
||||||
|
|
||||||
@ -35,7 +34,6 @@ describe('MetaMask', function () {
|
|||||||
before(async function () {
|
before(async function () {
|
||||||
const result = await prepareExtensionForTesting()
|
const result = await prepareExtensionForTesting()
|
||||||
driver = result.driver
|
driver = result.driver
|
||||||
extensionId = result.extensionId
|
|
||||||
await setupFetchMocking(driver)
|
await setupFetchMocking(driver)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -60,7 +58,7 @@ describe('MetaMask', function () {
|
|||||||
describe('Going through the first time flow', () => {
|
describe('Going through the first time flow', () => {
|
||||||
it('clicks the continue button on the welcome screen', async () => {
|
it('clicks the continue button on the welcome screen', async () => {
|
||||||
await findElement(driver, By.css('.welcome-page__header'))
|
await findElement(driver, By.css('.welcome-page__header'))
|
||||||
const welcomeScreenBtn = await findElement(driver, By.css('.first-time-flow__button'))
|
const welcomeScreenBtn = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`))
|
||||||
welcomeScreenBtn.click()
|
welcomeScreenBtn.click()
|
||||||
await delay(largeDelayMs)
|
await delay(largeDelayMs)
|
||||||
})
|
})
|
||||||
@ -105,7 +103,7 @@ describe('MetaMask', function () {
|
|||||||
assert.equal(seedPhrase.split(' ').length, 12)
|
assert.equal(seedPhrase.split(' ').length, 12)
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
|
|
||||||
const nextScreen = (await findElements(driver, By.css('button.first-time-flow__button')))[1]
|
const nextScreen = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.next.message}')]`))
|
||||||
await nextScreen.click()
|
await nextScreen.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
@ -118,37 +116,12 @@ describe('MetaMask', function () {
|
|||||||
await delay(tinyDelayMs)
|
await delay(tinyDelayMs)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function retypeSeedPhrase (words, wasReloaded, count = 0) {
|
|
||||||
try {
|
|
||||||
if (wasReloaded) {
|
|
||||||
const byRevealButton = By.css('.reveal-seed-phrase__secret-blocker .reveal-seed-phrase__reveal-button')
|
|
||||||
await driver.wait(until.elementLocated(byRevealButton, 10000))
|
|
||||||
const revealSeedPhraseButton = await findElement(driver, byRevealButton, 10000)
|
|
||||||
await revealSeedPhraseButton.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
|
|
||||||
const nextScreen = await findElement(driver, By.css('button.first-time-flow__button'))
|
|
||||||
await nextScreen.click()
|
|
||||||
await delay(regularDelayMs)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < 12; i++) {
|
|
||||||
await clickWordAndWait(words[i])
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
if (count > 2) {
|
|
||||||
throw e
|
|
||||||
} else {
|
|
||||||
await loadExtension(driver, extensionId)
|
|
||||||
await retypeSeedPhrase(words, true, count + 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
it('can retype the seed phrase', async () => {
|
it('can retype the seed phrase', async () => {
|
||||||
const words = seedPhrase.split(' ')
|
const words = seedPhrase.split(' ')
|
||||||
|
|
||||||
await retypeSeedPhrase(words)
|
for (const word of words) {
|
||||||
|
await clickWordAndWait(word)
|
||||||
|
}
|
||||||
|
|
||||||
const confirm = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
|
const confirm = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
|
||||||
await confirm.click()
|
await confirm.click()
|
||||||
@ -157,7 +130,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
it('clicks through the success screen', async () => {
|
it('clicks through the success screen', async () => {
|
||||||
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
||||||
const doneButton = await findElement(driver, By.css('button.first-time-flow__button'))
|
const doneButton = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.endOfFlowMessage10.message}')]`))
|
||||||
await doneButton.click()
|
await doneButton.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
@ -249,7 +222,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
await passwordInputs[0].sendKeys('correct horse battery staple')
|
await passwordInputs[0].sendKeys('correct horse battery staple')
|
||||||
await passwordInputs[1].sendKeys('correct horse battery staple')
|
await passwordInputs[1].sendKeys('correct horse battery staple')
|
||||||
await driver.findElement(By.css('.first-time-flow__button')).click()
|
await driver.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.restore.message}')]`)).click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -475,13 +448,13 @@ describe('MetaMask', function () {
|
|||||||
await approveButton.click()
|
await approveButton.click()
|
||||||
|
|
||||||
await driver.switchTo().window(dapp)
|
await driver.switchTo().window(dapp)
|
||||||
await delay(regularDelayMs)
|
await delay(2000)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('initiates a send from the dapp', async () => {
|
it('initiates a send from the dapp', async () => {
|
||||||
const send3eth = await findElement(driver, By.xpath(`//button[contains(text(), 'Send')]`), 10000)
|
const send3eth = await findElement(driver, By.xpath(`//button[contains(text(), 'Send')]`), 10000)
|
||||||
await send3eth.click()
|
await send3eth.click()
|
||||||
await delay(5000)
|
await delay(2000)
|
||||||
|
|
||||||
windowHandles = await driver.getAllWindowHandles()
|
windowHandles = await driver.getAllWindowHandles()
|
||||||
await switchToWindowWithTitle(driver, 'MetaMask Notification', windowHandles)
|
await switchToWindowWithTitle(driver, 'MetaMask Notification', windowHandles)
|
||||||
|
@ -12,6 +12,7 @@ const {
|
|||||||
setupFetchMocking,
|
setupFetchMocking,
|
||||||
prepareExtensionForTesting,
|
prepareExtensionForTesting,
|
||||||
} = require('./helpers')
|
} = require('./helpers')
|
||||||
|
const enLocaleMessages = require('../../app/_locales/en/messages.json')
|
||||||
|
|
||||||
describe('Using MetaMask with an existing account', function () {
|
describe('Using MetaMask with an existing account', function () {
|
||||||
let driver
|
let driver
|
||||||
@ -51,7 +52,7 @@ describe('Using MetaMask with an existing account', function () {
|
|||||||
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 () => {
|
it('clicks the continue button on the welcome screen', async () => {
|
||||||
await findElement(driver, By.css('.welcome-page__header'))
|
await findElement(driver, By.css('.welcome-page__header'))
|
||||||
const welcomeScreenBtn = await findElement(driver, By.css('.first-time-flow__button'))
|
const welcomeScreenBtn = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`))
|
||||||
welcomeScreenBtn.click()
|
welcomeScreenBtn.click()
|
||||||
await delay(largeDelayMs)
|
await delay(largeDelayMs)
|
||||||
})
|
})
|
||||||
@ -88,7 +89,7 @@ describe('Using MetaMask with an existing account', function () {
|
|||||||
|
|
||||||
it('clicks through the success screen', async () => {
|
it('clicks through the success screen', async () => {
|
||||||
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
||||||
const doneButton = await findElement(driver, By.css('button.first-time-flow__button'))
|
const doneButton = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.endOfFlowMessage10.message}')]`))
|
||||||
await doneButton.click()
|
await doneButton.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
|
@ -12,6 +12,7 @@ const {
|
|||||||
setupFetchMocking,
|
setupFetchMocking,
|
||||||
prepareExtensionForTesting,
|
prepareExtensionForTesting,
|
||||||
} = require('./helpers')
|
} = require('./helpers')
|
||||||
|
const enLocaleMessages = require('../../app/_locales/en/messages.json')
|
||||||
|
|
||||||
describe('MetaMask', function () {
|
describe('MetaMask', function () {
|
||||||
let driver
|
let driver
|
||||||
@ -53,7 +54,7 @@ describe('MetaMask', function () {
|
|||||||
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 () => {
|
it('clicks the continue button on the welcome screen', async () => {
|
||||||
await findElement(driver, By.css('.welcome-page__header'))
|
await findElement(driver, By.css('.welcome-page__header'))
|
||||||
const welcomeScreenBtn = await findElement(driver, By.css('.first-time-flow__button'))
|
const welcomeScreenBtn = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`))
|
||||||
welcomeScreenBtn.click()
|
welcomeScreenBtn.click()
|
||||||
await delay(largeDelayMs)
|
await delay(largeDelayMs)
|
||||||
})
|
})
|
||||||
@ -90,7 +91,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
it('clicks through the success screen', async () => {
|
it('clicks through the success screen', async () => {
|
||||||
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
||||||
const doneButton = await findElement(driver, By.css('button.first-time-flow__button'))
|
const doneButton = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.endOfFlowMessage10.message}')]`))
|
||||||
await doneButton.click()
|
await doneButton.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
@ -176,7 +177,7 @@ describe('MetaMask', function () {
|
|||||||
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 () => {
|
it('clicks the continue button on the welcome screen', async () => {
|
||||||
await findElement(driver2, By.css('.welcome-page__header'))
|
await findElement(driver2, By.css('.welcome-page__header'))
|
||||||
const welcomeScreenBtn = await findElement(driver2, By.css('.first-time-flow__button'))
|
const welcomeScreenBtn = await findElement(driver2, By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`))
|
||||||
welcomeScreenBtn.click()
|
welcomeScreenBtn.click()
|
||||||
await delay(largeDelayMs)
|
await delay(largeDelayMs)
|
||||||
})
|
})
|
||||||
@ -213,7 +214,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
it('clicks through the success screen', async () => {
|
it('clicks through the success screen', async () => {
|
||||||
await findElement(driver2, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
await findElement(driver2, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
||||||
const doneButton = await findElement(driver2, By.css('button.first-time-flow__button'))
|
const doneButton = await findElement(driver2, By.xpath(`//button[contains(text(), '${enLocaleMessages.endOfFlowMessage10.message}')]`))
|
||||||
await doneButton.click()
|
await doneButton.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
|
@ -15,6 +15,7 @@ const {
|
|||||||
setupFetchMocking,
|
setupFetchMocking,
|
||||||
prepareExtensionForTesting,
|
prepareExtensionForTesting,
|
||||||
} = require('./helpers')
|
} = require('./helpers')
|
||||||
|
const enLocaleMessages = require('../../app/_locales/en/messages.json')
|
||||||
|
|
||||||
describe('Using MetaMask with an existing account', function () {
|
describe('Using MetaMask with an existing account', function () {
|
||||||
let driver
|
let driver
|
||||||
@ -65,7 +66,7 @@ describe('Using MetaMask with an existing account', function () {
|
|||||||
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 () => {
|
it('clicks the continue button on the welcome screen', async () => {
|
||||||
await findElement(driver, By.css('.welcome-page__header'))
|
await findElement(driver, By.css('.welcome-page__header'))
|
||||||
const welcomeScreenBtn = await findElement(driver, By.css('.first-time-flow__button'))
|
const welcomeScreenBtn = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`))
|
||||||
welcomeScreenBtn.click()
|
welcomeScreenBtn.click()
|
||||||
await delay(largeDelayMs)
|
await delay(largeDelayMs)
|
||||||
})
|
})
|
||||||
@ -102,7 +103,7 @@ describe('Using MetaMask with an existing account', function () {
|
|||||||
|
|
||||||
it('clicks through the success screen', async () => {
|
it('clicks through the success screen', async () => {
|
||||||
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
await findElement(driver, By.xpath(`//div[contains(text(), 'Congratulations')]`))
|
||||||
const doneButton = await findElement(driver, By.css('button.first-time-flow__button'))
|
const doneButton = await findElement(driver, By.xpath(`//button[contains(text(), '${enLocaleMessages.endOfFlowMessage10.message}')]`))
|
||||||
await doneButton.click()
|
await doneButton.click()
|
||||||
await delay(regularDelayMs)
|
await delay(regularDelayMs)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user