diff options
Add try catch to deal with false negative timeouts in beta e2e tests.
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/beta/metamask-beta-ui.spec.js | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index efd391003..4f01f5b50 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -72,14 +72,20 @@ describe('MetaMask', function () { }) describe('New UI setup', async function () { + let networkSelector it('switches to first tab', async function () { const [firstTab] = await driver.getAllWindowHandles() await driver.switchTo().window(firstTab) await delay(regularDelayMs) + try { + networkSelector = await findElement(driver, By.css('#network_component')) + } catch (e) { + await loadExtension(driver, extensionId) + } + await delay(regularDelayMs) }) it('use the local network', async function () { - const networkSelector = await findElement(driver, By.css('#network_component')) await networkSelector.click() await delay(regularDelayMs) @@ -177,9 +183,7 @@ describe('MetaMask', function () { await delay(regularDelayMs) }) - it('can retype the seed phrase', async () => { - const words = seedPhrase.split(' ') - + async function retypeSeedPhrase (words) { const word0 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[0]}')]`)) await word0.click() await delay(tinyDelayMs) @@ -224,9 +228,20 @@ describe('MetaMask', function () { await word10.click() await delay(tinyDelayMs) - const word11 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[11]}')]`)) - await word11.click() - await delay(tinyDelayMs) + try { + const word11 = await findElement(driver, By.xpath(`//button[contains(text(), '${words[11]}')]`), 10000) + await word11.click() + await delay(tinyDelayMs) + } catch (e) { + await loadExtension(driver, extensionId) + await retypeSeedPhrase + } + } + + it('can retype the seed phrase', async () => { + const words = seedPhrase.split(' ') + + await retypeSeedPhrase(words) const confirm = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`)) await confirm.click() |