diff options
Diffstat (limited to 'test/e2e/metamask.spec.js')
-rw-r--r-- | test/e2e/metamask.spec.js | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index b0a8fe411..ac7600f09 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -4,7 +4,7 @@ const path = require('path') const assert = require('assert') const pify = require('pify') const webdriver = require('selenium-webdriver') -const { By, Key } = webdriver +const { By, Key, until } = webdriver const { delay, buildChromeWebDriver, buildFirefoxWebdriver, installWebExt, getExtensionIdChrome, getExtensionIdFirefox } = require('./func') describe('Metamask popup page', function () { @@ -59,6 +59,13 @@ describe('Metamask popup page', function () { await driver.switchTo().window(windowHandles[0]) }) + it('does not select the new UI option', async () => { + await delay(300) + const button = await driver.findElement(By.xpath("//button[contains(text(), 'No thanks, maybe later')]")) + await button.click() + await delay(1000) + }) + it('sets provider type to localhost', async function () { await delay(300) await setProviderType('localhost') @@ -133,9 +140,9 @@ describe('Metamask popup page', function () { }) it('adds a second account', async function () { - await driver.findElement(By.css('#app-content > div > div.full-width > div > div:nth-child(2) > span > div')).click() + await driver.findElement(By.css('div.full-width > div > div:nth-child(2) > span > div')).click() await delay(300) - await driver.findElement(By.css('#app-content > div > div.full-width > div > div:nth-child(2) > span > div > div > span > div > li:nth-child(3) > span')).click() + await driver.findElement(By.css('div.full-width > div > div:nth-child(2) > span > div > div > span > div > li:nth-child(3) > span')).click() }) it('shows account address', async function () { @@ -146,7 +153,7 @@ describe('Metamask popup page', function () { it('logs out of the vault', async () => { await driver.findElement(By.css('.sandwich-expando')).click() await delay(500) - const logoutButton = await driver.findElement(By.css('#app-content > div > div:nth-child(3) > span > div > li:nth-child(3)')) + const logoutButton = await driver.findElement(By.css('.menu-droppo > li:nth-child(3)')) assert.equal(await logoutButton.getText(), 'Log Out') await logoutButton.click() }) @@ -178,7 +185,7 @@ describe('Metamask popup page', function () { it('logs out', async function () { await driver.findElement(By.css('.sandwich-expando')).click() await delay(200) - const logOut = await driver.findElement(By.css('#app-content > div > div:nth-child(3) > span > div > li:nth-child(3)')) + const logOut = await driver.findElement(By.css('.menu-droppo > li:nth-child(3)')) assert.equal(await logOut.getText(), 'Log Out') await logOut.click() await delay(300) @@ -229,8 +236,12 @@ describe('Metamask popup page', function () { it('confirms transaction', async function () { await delay(300) - await driver.findElement(By.css('#pending-tx-form > div.flex-row.flex-space-around.conf-buttons > input')).click() - await delay(500) + const bySubmitButton = By.css('#pending-tx-form > div.flex-row.flex-space-around.conf-buttons > input') + const submitButton = await driver.wait(until.elementLocated(bySubmitButton)) + + submitButton.click() + + await delay(1500) }) it('finds the transaction in the transactions list', async function () { @@ -269,7 +280,8 @@ describe('Metamask popup page', function () { it('confirms transaction in MetaMask popup', async function () { const windowHandles = await driver.getAllWindowHandles() await driver.switchTo().window(windowHandles[windowHandles.length - 1]) - const metamaskSubmit = await driver.findElement(By.css('#pending-tx-form > div.flex-row.flex-space-around.conf-buttons > input')) + const byMetamaskSubmit = By.css('#pending-tx-form > div.flex-row.flex-space-around.conf-buttons > input') + const metamaskSubmit = await driver.wait(until.elementLocated(byMetamaskSubmit)) await metamaskSubmit.click() await delay(1000) }) @@ -330,7 +342,7 @@ describe('Metamask popup page', function () { await driver.executeScript('window.metamask.setProviderType(arguments[0])', type) } - async function checkBrowserForConsoleErrors() { + async function checkBrowserForConsoleErrors () { const ignoredLogTypes = ['WARNING'] const ignoredErrorMessages = [ // React throws error warnings on "dataset", but still sets the data-* properties correctly |