diff options
author | Dan Miller <danjm.com@gmail.com> | 2018-07-26 21:24:38 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-07-28 22:29:51 +0800 |
commit | 30d92b8d3f4c38dcd83bab97576775c0096adc1a (patch) | |
tree | 9fc065a7569eb3ec9dcbea1161cb3fa75c2f1a3f /test/e2e/beta/metamask-beta-ui.spec.js | |
parent | 89c74ac4adf7d064e144594537d8e8ee5a0f8082 (diff) | |
download | tangerine-wallet-browser-30d92b8d3f4c38dcd83bab97576775c0096adc1a.tar tangerine-wallet-browser-30d92b8d3f4c38dcd83bab97576775c0096adc1a.tar.gz tangerine-wallet-browser-30d92b8d3f4c38dcd83bab97576775c0096adc1a.tar.bz2 tangerine-wallet-browser-30d92b8d3f4c38dcd83bab97576775c0096adc1a.tar.lz tangerine-wallet-browser-30d92b8d3f4c38dcd83bab97576775c0096adc1a.tar.xz tangerine-wallet-browser-30d92b8d3f4c38dcd83bab97576775c0096adc1a.tar.zst tangerine-wallet-browser-30d92b8d3f4c38dcd83bab97576775c0096adc1a.zip |
Fix e2e tests to accomodate new ui suggestion screen changes.
Diffstat (limited to 'test/e2e/beta/metamask-beta-ui.spec.js')
-rw-r--r-- | test/e2e/beta/metamask-beta-ui.spec.js | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index ca1977c5a..1590e6d35 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -75,30 +75,11 @@ describe('MetaMask', function () { }) describe('New UI setup', async function () { - let networkSelector it('switches to first tab', async function () { + await delay(tinyDelayMs) 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(largeDelayMs * 2) - networkSelector = await findElement(driver, By.css('#network_component')) - } - await delay(regularDelayMs) - }) - - it('uses the local network', async function () { - await networkSelector.click() - await delay(regularDelayMs) - - const networks = await findElements(driver, By.css('.dropdown-menu-item')) - const localhost = networks[4] - await driver.wait(until.elementTextMatches(localhost, /Localhost/)) - await localhost.click() - await delay(regularDelayMs) }) it('selects the new UI option', async () => { @@ -107,27 +88,44 @@ describe('MetaMask', function () { await driver.wait(until.stalenessOf(overlay)) } catch (e) {} - const button = await findElement(driver, By.xpath("//p[contains(text(), 'Try Beta Version')]")) + const button = await findElement(driver, By.xpath("//button[contains(text(), 'Try it now')]")) await button.click() await delay(regularDelayMs) // Close all other tabs - const [oldUi, tab1, tab2] = await driver.getAllWindowHandles() - await driver.switchTo().window(oldUi) - await driver.close() + const [tab0, tab1, tab2] = await driver.getAllWindowHandles() + await driver.switchTo().window(tab0) + await delay(tinyDelayMs) - await driver.switchTo().window(tab1) - const tab1Url = await driver.getCurrentUrl() - if (tab1Url.match(/metamask.io/)) { - await driver.switchTo().window(tab1) - await driver.close() - await driver.switchTo().window(tab2) - } else if (tab2) { - await driver.switchTo().window(tab2) - await driver.close() + 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) + + const okayBtn = await findElement(driver, By.xpath("//button[contains(text(), 'Ok')]")) + await okayBtn.click() + await delay(regularDelayMs) + + await loadExtension(driver, extensionId) + await delay(regularDelayMs) const continueBtn = await findElement(driver, By.css('.welcome-screen__button')) await continueBtn.click() |