aboutsummaryrefslogtreecommitdiffstats
path: root/test/e2e/beta/metamask-beta-ui.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/beta/metamask-beta-ui.spec.js')
-rw-r--r--test/e2e/beta/metamask-beta-ui.spec.js88
1 files changed, 53 insertions, 35 deletions
diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js
index 8d1ecac0d..3bfa1eaf2 100644
--- a/test/e2e/beta/metamask-beta-ui.spec.js
+++ b/test/e2e/beta/metamask-beta-ui.spec.js
@@ -271,16 +271,21 @@ describe('MetaMask', function () {
await driver.wait(until.stalenessOf(accountModal))
await delay(regularDelayMs)
})
- it('show account details dropdown menu', async () => {
+ })
+
+ describe('Enable privacy mode', () => {
+ it('enables privacy mode', async () => {
+ const networkDropdown = await findElement(driver, By.css('.network-name'))
+ await networkDropdown.click()
+ await delay(regularDelayMs)
- 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
+ const customRpcButton = await findElement(driver, By.xpath(`//span[contains(text(), 'Custom RPC')]`))
+ await customRpcButton.click()
await delay(regularDelayMs)
- driver.manage().window().setSize(width, height)
+ const privacyToggle = await findElement(driver, By.css('.settings-page__content-row:nth-of-type(10) .settings-page__content-item-col > div'))
+ await privacyToggle.click()
+ await delay(largeDelayMs * 2)
})
})
@@ -371,7 +376,7 @@ describe('MetaMask', function () {
it('balance renders', async () => {
const balance = await findElement(driver, By.css('.balance-display .token-amount'))
- await driver.wait(until.elementTextMatches(balance, /100.+ETH/))
+ await driver.wait(until.elementTextMatches(balance, /100\s*ETH/))
await delay(regularDelayMs)
})
})
@@ -383,7 +388,7 @@ describe('MetaMask', function () {
await delay(regularDelayMs)
const inputAddress = await findElement(driver, By.css('input[placeholder="Recipient Address"]'))
- const inputAmount = await findElement(driver, By.css('.currency-display__input'))
+ const inputAmount = await findElement(driver, By.css('.unit-input__input'))
await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')
await inputAmount.sendKeys('1')
@@ -420,30 +425,43 @@ describe('MetaMask', function () {
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\sETH/), 10000)
+ await driver.wait(until.elementTextMatches(txValues, /-1\s*ETH/), 10000)
}
})
})
describe('Send ETH from dapp', () => {
+ let windowHandles
+ let extension
+ let popup
+ let dapp
+
it('starts a send transaction inside the dapp', async () => {
await openNewPage(driver, 'http://127.0.0.1:8080/')
await delay(regularDelayMs)
- await waitUntilXWindowHandles(driver, 2)
- let windowHandles = await driver.getAllWindowHandles()
- const extension = windowHandles[0]
- const dapp = windowHandles[1]
+ await waitUntilXWindowHandles(driver, 3)
+ windowHandles = await driver.getAllWindowHandles()
+
+ extension = windowHandles[0]
+ popup = await switchToWindowWithTitle(driver, 'MetaMask Notification', windowHandles)
+ dapp = windowHandles.find(handle => handle !== extension && handle !== popup)
+ await delay(regularDelayMs)
+ const approveButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Connect')]`))
+ await approveButton.click()
+ })
+
+ it('initiates a send from the dapp', async () => {
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 delay(5000)
windowHandles = await driver.getAllWindowHandles()
- await driver.switchTo().window(windowHandles[2])
+ await switchToWindowWithTitle(driver, 'MetaMask Notification', windowHandles)
await delay(regularDelayMs)
await assertElementNotPresent(webdriver, driver, By.xpath(`//li[contains(text(), 'Data')]`))
@@ -462,7 +480,7 @@ describe('MetaMask', function () {
assert.equal(transactions.length, 2)
const txValues = await findElement(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txValues, /-3\sETH/), 10000)
+ await driver.wait(until.elementTextMatches(txValues, /-3\s*ETH/), 10000)
})
})
@@ -540,7 +558,7 @@ describe('MetaMask', function () {
await findElements(driver, By.css('.transaction-list-item'))
const [txListValue] = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txListValue, /-4\sETH/), 10000)
+ await driver.wait(until.elementTextMatches(txListValue, /-4\s*ETH/), 10000)
await txListValue.click()
await delay(regularDelayMs)
@@ -574,7 +592,7 @@ describe('MetaMask', function () {
}, 10000)
const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txValues[0], /-4\sETH/), 10000)
+ await driver.wait(until.elementTextMatches(txValues[0], /-4\s*ETH/), 10000)
// const txAccounts = await findElements(driver, By.css('.tx-list-account'))
// const firstTxAddress = await txAccounts[0].getText()
@@ -606,7 +624,7 @@ describe('MetaMask', function () {
}, 10000)
const txValues = await findElement(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txValues, /-0\sETH/), 10000)
+ await driver.wait(until.elementTextMatches(txValues, /-0\s*ETH/), 10000)
await closeAllWindowHandlesExcept(driver, [extension, dapp])
await driver.switchTo().window(extension)
@@ -616,9 +634,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.*ETH.*$/), 10000)
+ await driver.wait(until.elementTextMatches(balance, /^92.*\s*ETH.*$/), 10000)
const tokenAmount = await balance.getText()
- assert.ok(/^92.*ETH.*$/.test(tokenAmount))
+ assert.ok(/^92.*\s*ETH.*$/.test(tokenAmount))
await delay(regularDelayMs)
}
})
@@ -662,7 +680,7 @@ describe('MetaMask', function () {
})
it('clicks on the Add Token button', async () => {
- const addToken = await driver.findElement(By.css('.wallet-view__add-token-button'))
+ const addToken = await driver.findElement(By.xpath(`//div[contains(text(), 'Add Token')]`))
await addToken.click()
await delay(regularDelayMs)
})
@@ -702,7 +720,7 @@ describe('MetaMask', function () {
await delay(regularDelayMs)
const inputAddress = await findElement(driver, By.css('input[placeholder="Recipient Address"]'))
- const inputAmount = await findElement(driver, By.css('.currency-display__input'))
+ const inputAmount = await findElement(driver, By.css('.unit-input__input'))
await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')
await inputAmount.sendKeys('50')
@@ -764,7 +782,7 @@ describe('MetaMask', function () {
// test cancelled on firefox until https://github.com/mozilla/geckodriver/issues/906 is resolved,
// or possibly until we use latest version of firefox in the tests
if (process.env.SELENIUM_BROWSER !== 'firefox') {
- await driver.wait(until.elementTextMatches(txValues[0], /-50\sTST/), 10000)
+ await driver.wait(until.elementTextMatches(txValues[0], /-50\s*TST/), 10000)
}
driver.wait(async () => {
@@ -798,7 +816,7 @@ describe('MetaMask', function () {
await findElements(driver, By.css('.transaction-list__pending-transactions'))
const [txListValue] = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txListValue, /-7\sTST/), 10000)
+ await driver.wait(until.elementTextMatches(txListValue, /-7\s*TST/), 10000)
await txListValue.click()
await delay(regularDelayMs)
@@ -834,8 +852,8 @@ describe('MetaMask', function () {
await save.click()
await driver.wait(until.stalenessOf(gasModal))
- const gasFeeInputs = await findElements(driver, By.css('.confirm-detail-row__eth'))
- assert.equal(await gasFeeInputs[0].getText(), '♦ 0.0006')
+ const gasFeeInputs = await findElements(driver, By.css('.confirm-detail-row__primary'))
+ assert.equal(await gasFeeInputs[0].getText(), '0.0006')
})
it('submits the transaction', async function () {
@@ -851,7 +869,7 @@ describe('MetaMask', function () {
}, 10000)
const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txValues[0], /-7\sTST/))
+ await driver.wait(until.elementTextMatches(txValues[0], /-7\s*TST/))
const txStatuses = await findElements(driver, By.css('.transaction-list-item__action'))
await driver.wait(until.elementTextMatches(txStatuses[0], /Sent\sToken/))
@@ -897,7 +915,7 @@ describe('MetaMask', function () {
const [txListItem] = await findElements(driver, By.css('.transaction-list-item'))
const [txListValue] = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txListValue, /-7\sTST/))
+ await driver.wait(until.elementTextMatches(txListValue, /-7\s*TST/))
await txListItem.click()
await delay(regularDelayMs)
})
@@ -957,8 +975,8 @@ describe('MetaMask', function () {
await save.click()
await driver.wait(until.stalenessOf(gasModal))
- const gasFeeInputs = await findElements(driver, By.css('.confirm-detail-row__eth'))
- assert.equal(await gasFeeInputs[0].getText(), '♦ 0.0006')
+ const gasFeeInputs = await findElements(driver, By.css('.confirm-detail-row__primary'))
+ assert.equal(await gasFeeInputs[0].getText(), '0.0006')
})
it('submits the transaction', async function () {
@@ -974,7 +992,7 @@ describe('MetaMask', function () {
}, 10000)
const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txValues[0], /-7\sTST/))
+ await driver.wait(until.elementTextMatches(txValues[0], /-7\s*TST/))
const txStatuses = await findElements(driver, By.css('.transaction-list-item__action'))
await driver.wait(until.elementTextMatches(txStatuses[0], /Approve/))
})
@@ -1002,7 +1020,7 @@ describe('MetaMask', function () {
describe('Add existing token using search', () => {
it('clicks on the Add Token button', async () => {
- const addToken = await findElement(driver, By.xpath(`//button[contains(text(), 'Add Token')]`))
+ const addToken = await findElement(driver, By.xpath(`//div[contains(text(), 'Add Token')]`))
await addToken.click()
await delay(regularDelayMs)
})
@@ -1027,7 +1045,7 @@ describe('MetaMask', function () {
it('renders the balance for the chosen token', async () => {
const balance = await findElement(driver, By.css('.transaction-view-balance__token-balance'))
- await driver.wait(until.elementTextMatches(balance, /0\sBAT/))
+ await driver.wait(until.elementTextMatches(balance, /0\s*BAT/))
await delay(regularDelayMs)
})
})