aboutsummaryrefslogtreecommitdiffstats
path: root/test/e2e
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-11-14 06:21:15 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-11-14 06:21:15 +0800
commit484aa6801ea50fb08253fd08559710c53e0c189d (patch)
tree2a7876d3800e57aafab39a6beebe00abf7fc26ba /test/e2e
parentc651212025ab7cd0309d96be6687c1eba35ab9fa (diff)
parent0549782595335e8257d1b4abf7d6220020e2c8db (diff)
downloadtangerine-wallet-browser-484aa6801ea50fb08253fd08559710c53e0c189d.tar
tangerine-wallet-browser-484aa6801ea50fb08253fd08559710c53e0c189d.tar.gz
tangerine-wallet-browser-484aa6801ea50fb08253fd08559710c53e0c189d.tar.bz2
tangerine-wallet-browser-484aa6801ea50fb08253fd08559710c53e0c189d.tar.lz
tangerine-wallet-browser-484aa6801ea50fb08253fd08559710c53e0c189d.tar.xz
tangerine-wallet-browser-484aa6801ea50fb08253fd08559710c53e0c189d.tar.zst
tangerine-wallet-browser-484aa6801ea50fb08253fd08559710c53e0c189d.zip
Merge branch 'develop' into trezor-v5
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/beta/from-import-beta-ui.spec.js1
-rw-r--r--test/e2e/beta/metamask-beta-responsive-ui.spec.js360
-rw-r--r--test/e2e/beta/metamask-beta-ui.spec.js157
-rwxr-xr-xtest/e2e/beta/run-all.sh1
-rw-r--r--test/e2e/func.js22
5 files changed, 518 insertions, 23 deletions
diff --git a/test/e2e/beta/from-import-beta-ui.spec.js b/test/e2e/beta/from-import-beta-ui.spec.js
index caef99fed..ffb0a10ff 100644
--- a/test/e2e/beta/from-import-beta-ui.spec.js
+++ b/test/e2e/beta/from-import-beta-ui.spec.js
@@ -159,6 +159,7 @@ describe('Using MetaMask with an existing account', function () {
it('clicks through the ToS', async () => {
// terms of use
+ await delay(largeDelayMs)
const canClickThrough = await driver.findElement(By.css('.tou button')).isEnabled()
assert.equal(canClickThrough, false, 'disabled continue button')
const bottomOfTos = await findElement(driver, By.linkText('Attributions'))
diff --git a/test/e2e/beta/metamask-beta-responsive-ui.spec.js b/test/e2e/beta/metamask-beta-responsive-ui.spec.js
new file mode 100644
index 000000000..b93563b25
--- /dev/null
+++ b/test/e2e/beta/metamask-beta-responsive-ui.spec.js
@@ -0,0 +1,360 @@
+const path = require('path')
+const assert = require('assert')
+const webdriver = require('selenium-webdriver')
+const { By, until } = webdriver
+const {
+ delay,
+ buildChromeWebDriver,
+ buildFirefoxWebdriver,
+ installWebExt,
+ getExtensionIdChrome,
+ getExtensionIdFirefox,
+} = require('../func')
+const {
+ checkBrowserForConsoleErrors,
+ closeAllWindowHandlesExcept,
+ findElement,
+ findElements,
+ loadExtension,
+ verboseReportOnFailure,
+} = require('./helpers')
+
+describe('MetaMask', function () {
+ let extensionId
+ let driver
+
+ const testSeedPhrase = 'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent'
+ const tinyDelayMs = 200
+ const regularDelayMs = tinyDelayMs * 2
+ const largeDelayMs = regularDelayMs * 2
+
+ this.timeout(0)
+ this.bail(true)
+
+ before(async function () {
+ switch (process.env.SELENIUM_BROWSER) {
+ case 'chrome': {
+ const extPath = path.resolve('dist/chrome')
+ driver = buildChromeWebDriver(extPath, { responsive: true })
+ extensionId = await getExtensionIdChrome(driver)
+ await driver.get(`chrome-extension://${extensionId}/popup.html`)
+ break
+ }
+ case 'firefox': {
+ const extPath = path.resolve('dist/firefox')
+ driver = buildFirefoxWebdriver({ responsive: true })
+ await installWebExt(driver, extPath)
+ await delay(700)
+ extensionId = await getExtensionIdFirefox(driver)
+ await driver.get(`moz-extension://${extensionId}/popup.html`)
+ }
+ }
+ })
+
+ afterEach(async function () {
+ if (process.env.SELENIUM_BROWSER === 'chrome') {
+ const errors = await checkBrowserForConsoleErrors(driver)
+ if (errors.length) {
+ const errorReports = errors.map(err => err.message)
+ const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
+ console.error(new Error(errorMessage))
+ }
+ }
+ if (this.currentTest.state === 'failed') {
+ await verboseReportOnFailure(driver, this.currentTest)
+ }
+ })
+
+ after(async function () {
+ 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', () => {
+ it('accepts a secure password', async () => {
+ const passwordBox = await findElement(driver, By.css('.create-password #create-password'))
+ const passwordBoxConfirm = await findElement(driver, By.css('.create-password #confirm-password'))
+ const button = await findElement(driver, By.css('.create-password button'))
+
+ await passwordBox.sendKeys('correct horse battery staple')
+ await passwordBoxConfirm.sendKeys('correct horse battery staple')
+ await button.click()
+ await delay(regularDelayMs)
+ })
+
+ it('clicks through the unique image screen', async () => {
+ const nextScreen = await findElement(driver, By.css('.unique-image button'))
+ await nextScreen.click()
+ await delay(regularDelayMs)
+ })
+
+ it('clicks through the ToS', async () => {
+ // terms of use
+ const canClickThrough = await driver.findElement(By.css('.tou button')).isEnabled()
+ assert.equal(canClickThrough, false, 'disabled continue button')
+ const bottomOfTos = await findElement(driver, By.linkText('Attributions'))
+ await driver.executeScript('arguments[0].scrollIntoView(true)', bottomOfTos)
+ await delay(regularDelayMs)
+ const acceptTos = await findElement(driver, By.css('.tou button'))
+ driver.wait(until.elementIsEnabled(acceptTos))
+ await acceptTos.click()
+ await delay(regularDelayMs)
+ })
+
+ it('clicks through the privacy notice', async () => {
+ // privacy notice
+ const nextScreen = await findElement(driver, By.css('.tou button'))
+ await nextScreen.click()
+ await delay(regularDelayMs)
+ })
+
+ it('clicks through the phishing notice', async () => {
+ // phishing notice
+ const noticeElement = await driver.findElement(By.css('.markdown'))
+ await driver.executeScript('arguments[0].scrollTop = arguments[0].scrollHeight', noticeElement)
+ await delay(regularDelayMs)
+ const nextScreen = await findElement(driver, By.css('.tou button'))
+ await nextScreen.click()
+ await delay(regularDelayMs)
+ })
+
+ let seedPhrase
+
+ it('reveals the seed phrase', async () => {
+ const byRevealButton = By.css('.backup-phrase__secret-blocker .backup-phrase__reveal-button')
+ await driver.wait(until.elementLocated(byRevealButton, 10000))
+ const revealSeedPhraseButton = await findElement(driver, byRevealButton, 10000)
+ await revealSeedPhraseButton.click()
+ await delay(regularDelayMs)
+
+ seedPhrase = await driver.findElement(By.css('.backup-phrase__secret-words')).getText()
+ assert.equal(seedPhrase.split(' ').length, 12)
+ await delay(regularDelayMs)
+
+ const nextScreen = await findElement(driver, By.css('.backup-phrase button'))
+ await nextScreen.click()
+ await delay(regularDelayMs)
+ })
+
+ async function clickWordAndWait (word) {
+ const xpathClass = 'backup-phrase__confirm-seed-option backup-phrase__confirm-seed-option--unselected'
+ const xpath = `//button[@class='${xpathClass}' and contains(text(), '${word}')]`
+ const word0 = await findElement(driver, By.xpath(xpath), 10000)
+
+ await word0.click()
+ await delay(tinyDelayMs)
+ }
+
+ async function retypeSeedPhrase (words, wasReloaded, count = 0) {
+ try {
+ if (wasReloaded) {
+ const byRevealButton = By.css('.backup-phrase__secret-blocker .backup-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('.backup-phrase 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 () => {
+ const words = seedPhrase.split(' ')
+
+ await retypeSeedPhrase(words)
+
+ const confirm = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
+ await confirm.click()
+ await delay(regularDelayMs)
+ })
+
+ it('clicks through the deposit modal', async () => {
+ const byBuyModal = By.css('span .modal')
+ const buyModal = await driver.wait(until.elementLocated(byBuyModal))
+ const closeModal = await findElement(driver, By.css('.page-container__header-close'))
+ await closeModal.click()
+ await driver.wait(until.stalenessOf(buyModal))
+ await delay(regularDelayMs)
+ })
+ })
+
+ describe('Show account information', () => {
+ it('show account details dropdown menu', async () => {
+ await driver.findElement(By.css('div.menu-bar__open-in-browser')).click()
+ const options = await driver.findElements(By.css('div.menu.account-details-dropdown div.menu__item'))
+ assert.equal(options.length, 3) // HD Wallet type does not have to show the Remove Account option
+ await delay(regularDelayMs)
+ })
+ })
+
+ describe('Import seed phrase', () => {
+ it('logs out of the vault', async () => {
+ await driver.findElement(By.css('.account-menu__icon')).click()
+ await delay(regularDelayMs)
+
+ const logoutButton = await findElement(driver, By.css('.account-menu__logout-button'))
+ assert.equal(await logoutButton.getText(), 'Log out')
+ await logoutButton.click()
+ await delay(regularDelayMs)
+ })
+
+ it('imports seed phrase', async () => {
+ const restoreSeedLink = await findElement(driver, By.css('.unlock-page__link--import'))
+ assert.equal(await restoreSeedLink.getText(), 'Import using account seed phrase')
+ await restoreSeedLink.click()
+ await delay(regularDelayMs)
+
+ const seedTextArea = await findElement(driver, By.css('textarea'))
+ await seedTextArea.sendKeys(testSeedPhrase)
+ await delay(regularDelayMs)
+
+ const passwordInputs = await driver.findElements(By.css('input'))
+ await delay(regularDelayMs)
+
+ await passwordInputs[0].sendKeys('correct horse battery staple')
+ await passwordInputs[1].sendKeys('correct horse battery staple')
+ await driver.findElement(By.css('.first-time-flow__button')).click()
+ await delay(regularDelayMs)
+ })
+
+ it('switches to localhost', async () => {
+ const networkDropdown = await findElement(driver, By.css('.network-name'))
+ await networkDropdown.click()
+ await delay(regularDelayMs)
+
+ const [localhost] = await findElements(driver, By.xpath(`//span[contains(text(), 'Localhost')]`))
+ await localhost.click()
+ await delay(largeDelayMs * 2)
+ })
+
+ it('balance renders', async () => {
+ const balance = await findElement(driver, By.css('.transaction-view-balance__primary-balance'))
+ await driver.wait(until.elementTextMatches(balance, /100\s*ETH/))
+ await delay(regularDelayMs)
+ })
+ })
+
+ describe('Send ETH from inside MetaMask', () => {
+ it('starts to send a transaction', async function () {
+ const sendButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Send')]`))
+ await sendButton.click()
+ await delay(regularDelayMs)
+
+ const inputAddress = await findElement(driver, By.css('input[placeholder="Recipient Address"]'))
+ const inputAmount = await findElement(driver, By.css('.unit-input__input'))
+ await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')
+ await inputAmount.sendKeys('1')
+
+ const inputValue = await inputAmount.getAttribute('value')
+ assert.equal(inputValue, '1')
+
+ // Set the gas limit
+ const configureGas = await findElement(driver, By.css('.send-v2__gas-fee-display button'))
+ await configureGas.click()
+ await delay(regularDelayMs)
+
+ const gasModal = await driver.findElement(By.css('span .modal'))
+
+ const save = await findElement(driver, By.xpath(`//button[contains(text(), 'Save')]`))
+ await save.click()
+ await driver.wait(until.stalenessOf(gasModal))
+ await delay(regularDelayMs)
+
+ // Continue to next screen
+ const nextScreen = await findElement(driver, By.xpath(`//button[contains(text(), 'Next')]`))
+ await nextScreen.click()
+ await delay(regularDelayMs)
+ })
+
+ it('confirms the transaction', async function () {
+ const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
+ await confirmButton.click()
+ await delay(largeDelayMs)
+ })
+
+ it('finds the transaction in the transactions list', async function () {
+ const transactions = await findElements(driver, By.css('.transaction-list-item'))
+ assert.equal(transactions.length, 1)
+
+ if (process.env.SELENIUM_BROWSER !== 'firefox') {
+ const txValues = await findElement(driver, By.css('.transaction-list-item__amount--primary'))
+ await driver.wait(until.elementTextMatches(txValues, /-1\s*ETH/), 10000)
+ }
+ })
+ })
+})
diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js
index 5887d0293..2b5c8ee18 100644
--- a/test/e2e/beta/metamask-beta-ui.spec.js
+++ b/test/e2e/beta/metamask-beta-ui.spec.js
@@ -271,17 +271,6 @@ describe('MetaMask', function () {
await driver.wait(until.stalenessOf(accountModal))
await delay(regularDelayMs)
})
- it('show account details dropdown menu', async () => {
-
- const {width, height} = await driver.manage().window().getSize()
- driver.manage().window().setSize(320, 480)
- await driver.findElement(By.css('div.menu-bar__open-in-browser')).click()
- const options = await driver.findElements(By.css('div.menu.account-details-dropdown div.menu__item'))
- assert.equal(options.length, 3) // HD Wallet type does not have to show the Remove Account option
- await delay(regularDelayMs)
- driver.manage().window().setSize(width, height)
-
- })
})
describe('Enable privacy mode', () => {
@@ -495,6 +484,142 @@ describe('MetaMask', function () {
})
})
+ describe('Navigate transactions', () => {
+ it('adds multiple transactions', async () => {
+ await delay(regularDelayMs)
+
+ await waitUntilXWindowHandles(driver, 2)
+ const windowHandles = await driver.getAllWindowHandles()
+ const extension = windowHandles[0]
+ const dapp = windowHandles[1]
+
+ await driver.switchTo().window(dapp)
+ await delay(regularDelayMs)
+
+ const send3eth = await findElement(driver, By.xpath(`//button[contains(text(), 'Send')]`), 10000)
+ await send3eth.click()
+ await delay(regularDelayMs)
+
+ const contractDeployment = await findElement(driver, By.xpath(`//button[contains(text(), 'Deploy Contract')]`), 10000)
+ await contractDeployment.click()
+ await delay(regularDelayMs)
+
+ await send3eth.click()
+ await contractDeployment.click()
+ await delay(regularDelayMs)
+
+ await driver.switchTo().window(extension)
+ await delay(regularDelayMs)
+
+ const transactions = await findElements(driver, By.css('.transaction-list-item'))
+ await transactions[3].click()
+ await delay(regularDelayMs)
+ })
+
+ it('navigates the transactions', async () => {
+ let navigateTxButtons = await findElements(driver, By.css('.confirm-page-container-navigation__arrow'))
+ assert.equal(navigateTxButtons.length, 4, 'navigation button present')
+
+ await navigateTxButtons[2].click()
+ let navigationElement = await findElement(driver, By.css('.confirm-page-container-navigation'))
+ let navigationText = await navigationElement.getText()
+ assert.equal(navigationText.includes('2'), true, 'changed transaction right')
+
+ navigateTxButtons = await findElements(driver, By.css('.confirm-page-container-navigation__arrow'))
+ await navigateTxButtons[2].click()
+ navigationElement = await findElement(driver, By.css('.confirm-page-container-navigation'))
+ navigationText = await navigationElement.getText()
+ assert.equal(navigationText.includes('3'), true, 'changed transaction right')
+
+ navigateTxButtons = await findElements(driver, By.css('.confirm-page-container-navigation__arrow'))
+ await navigateTxButtons[2].click()
+ navigationElement = await findElement(driver, By.css('.confirm-page-container-navigation'))
+ navigationText = await navigationElement.getText()
+ assert.equal(navigationText.includes('4'), true, 'changed transaction right')
+
+ navigateTxButtons = await findElements(driver, By.css('.confirm-page-container-navigation__arrow'))
+ await navigateTxButtons[0].click()
+ navigationElement = await findElement(driver, By.css('.confirm-page-container-navigation'))
+ navigationText = await navigationElement.getText()
+ assert.equal(navigationText.includes('1'), true, 'navigate to first transaction')
+
+ navigateTxButtons = await findElements(driver, By.css('.confirm-page-container-navigation__arrow'))
+ await navigateTxButtons[3].click()
+ navigationElement = await findElement(driver, By.css('.confirm-page-container-navigation'))
+ navigationText = await navigationElement.getText()
+ assert.equal(navigationText.split('4').length, 3, 'navigate to last transaction')
+
+ navigateTxButtons = await findElements(driver, By.css('.confirm-page-container-navigation__arrow'))
+ await navigateTxButtons[1].click()
+ navigationElement = await findElement(driver, By.css('.confirm-page-container-navigation'))
+ navigationText = await navigationElement.getText()
+ assert.equal(navigationText.includes('3'), true, 'changed transaction left')
+
+ navigateTxButtons = await findElements(driver, By.css('.confirm-page-container-navigation__arrow'))
+ await navigateTxButtons[1].click()
+ navigationElement = await findElement(driver, By.css('.confirm-page-container-navigation'))
+ navigationText = await navigationElement.getText()
+ assert.equal(navigationText.includes('2'), true, 'changed transaction left')
+ })
+
+ it('adds a transaction while confirm screen is in focus', async () => {
+ let navigationElement = await findElement(driver, By.css('.confirm-page-container-navigation'))
+ let navigationText = await navigationElement.getText()
+ assert.equal(navigationText.includes('2'), true, 'second transaction in focus')
+
+ const windowHandles = await driver.getAllWindowHandles()
+ const extension = windowHandles[0]
+ const dapp = windowHandles[1]
+
+ await driver.switchTo().window(dapp)
+ await delay(regularDelayMs)
+
+ const send3eth = await findElement(driver, By.xpath(`//button[contains(text(), 'Send')]`), 10000)
+ await send3eth.click()
+ await delay(regularDelayMs)
+
+ await driver.switchTo().window(extension)
+ await delay(regularDelayMs)
+
+ navigationElement = await findElement(driver, By.css('.confirm-page-container-navigation'))
+ navigationText = await navigationElement.getText()
+ assert.equal(navigationText.includes('3'), true, 'correct transaction in focus')
+ })
+
+ it('confirms a transaction', async () => {
+ const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`), 10000)
+ await confirmButton.click()
+ await delay(regularDelayMs)
+
+ const navigationElement = await findElement(driver, By.css('.confirm-page-container-navigation'))
+ const navigationText = await navigationElement.getText()
+ assert.equal(navigationText.includes('4'), true, 'transaction confirmed')
+ })
+
+ it('rejects a transaction', async () => {
+ const rejectButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Reject')]`), 10000)
+ await rejectButton.click()
+ await delay(regularDelayMs)
+
+ const navigationElement = await findElement(driver, By.css('.confirm-page-container-navigation'))
+ const navigationText = await navigationElement.getText()
+ assert.equal(navigationText.includes('3'), true, 'transaction rejected')
+ })
+
+ it('rejects the rest of the transactions', async () => {
+ const rejectAllButton = await findElement(driver, By.xpath(`//a[contains(text(), 'Reject 3')]`), 10000)
+ await rejectAllButton.click()
+ await delay(regularDelayMs)
+
+ const rejectButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Reject All')]`), 10000)
+ await rejectButton.click()
+ await delay(largeDelayMs * 2)
+
+ const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item'))
+ assert.equal(confirmedTxes.length, 3, '3 transactions present')
+ })
+ })
+
describe('Deploy contract and call contract methods', () => {
let extension
let dapp
@@ -542,7 +667,7 @@ describe('MetaMask', function () {
driver.wait(async () => {
const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item'))
- return confirmedTxes.length === 3
+ return confirmedTxes.length === 4
}, 10000)
const txAction = await findElements(driver, By.css('.transaction-list-item__action'))
@@ -599,7 +724,7 @@ describe('MetaMask', function () {
driver.wait(async () => {
const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item'))
- return confirmedTxes.length === 4
+ return confirmedTxes.length === 5
}, 10000)
const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
@@ -631,7 +756,7 @@ describe('MetaMask', function () {
driver.wait(async () => {
const confirmedTxes = await findElements(driver, By.css('.transaction-list__completed-transactions .transaction-list-item'))
- return confirmedTxes.length === 5
+ return confirmedTxes.length === 6
}, 10000)
const txValues = await findElement(driver, By.css('.transaction-list-item__amount--primary'))
@@ -645,9 +770,9 @@ describe('MetaMask', function () {
const balance = await findElement(driver, By.css('.transaction-view-balance__primary-balance'))
await delay(regularDelayMs)
if (process.env.SELENIUM_BROWSER !== 'firefox') {
- await driver.wait(until.elementTextMatches(balance, /^92.*\s*ETH.*$/), 10000)
+ await driver.wait(until.elementTextMatches(balance, /^89.*\s*ETH.*$/), 10000)
const tokenAmount = await balance.getText()
- assert.ok(/^92.*\s*ETH.*$/.test(tokenAmount))
+ assert.ok(/^89.*\s*ETH.*$/.test(tokenAmount))
await delay(regularDelayMs)
}
})
diff --git a/test/e2e/beta/run-all.sh b/test/e2e/beta/run-all.sh
index c51f19fdf..f2705da4c 100755
--- a/test/e2e/beta/run-all.sh
+++ b/test/e2e/beta/run-all.sh
@@ -7,4 +7,5 @@ set -o pipefail
export PATH="$PATH:./node_modules/.bin"
shell-parallel -s 'npm run ganache:start -- -b 2' -x 'sleep 5 && static-server test/e2e/beta/contract-test --port 8080' -x 'sleep 5 && mocha test/e2e/beta/metamask-beta-ui.spec'
+shell-parallel -s 'npm run ganache:start -- -b 2' -x 'sleep 5 && static-server test/e2e/beta/contract-test --port 8080' -x 'sleep 5 && mocha test/e2e/beta/metamask-beta-responsive-ui.spec'
shell-parallel -s 'npm run ganache:start -- -d -b 2' -x 'sleep 5 && mocha test/e2e/beta/from-import-beta-ui.spec'
diff --git a/test/e2e/func.js b/test/e2e/func.js
index 13dfb82f9..5301d78ae 100644
--- a/test/e2e/func.js
+++ b/test/e2e/func.js
@@ -56,23 +56,31 @@ async function setupBrowserAndExtension ({ browser, extPath }) {
return { driver, extensionId, extensionUri }
}
-function buildChromeWebDriver (extPath) {
+function buildChromeWebDriver (extPath, opts = {}) {
const tmpProfile = fs.mkdtempSync(path.join(os.tmpdir(), 'mm-chrome-profile'))
+ const args = [
+ `load-extension=${extPath}`,
+ `user-data-dir=${tmpProfile}`,
+ ]
+ if (opts.responsive) {
+ args.push('--auto-open-devtools-for-tabs')
+ }
return new webdriver.Builder()
.withCapabilities({
chromeOptions: {
- args: [
- `load-extension=${extPath}`,
- `user-data-dir=${tmpProfile}`,
- ],
+ args,
binary: process.env.SELENIUM_CHROME_BINARY,
},
})
.build()
}
-function buildFirefoxWebdriver () {
- return new webdriver.Builder().build()
+function buildFirefoxWebdriver (opts = {}) {
+ const driver = new webdriver.Builder().build()
+ if (opts.responsive) {
+ driver.manage().window().setSize(320, 600)
+ }
+ return driver
}
async function getExtensionIdChrome (driver) {