From f7ab4577f637dd9e96cec0f08848bc70c489f9d3 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Wed, 13 Feb 2019 10:33:14 -0330 Subject: Adds tests for advanced gas controls on confim screen (#6144) --- test/e2e/beta/metamask-beta-ui.spec.js | 48 +++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index a824763e0..bde031301 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -480,12 +480,36 @@ describe('MetaMask', function () { }) }) - describe('Send ETH from dapp', () => { + describe('Send ETH from dapp using advanced gas controls', () => { let windowHandles let extension let popup let dapp + it('goes to the settings screen', async () => { + await driver.findElement(By.css('.account-menu__icon')).click() + await delay(regularDelayMs) + + const settingsButton = await findElement(driver, By.xpath(`//div[contains(text(), 'Settings')]`)) + settingsButton.click() + + await findElement(driver, By.css('.tab-bar')) + + const advancedGasTitle = await findElement(driver, By.xpath(`//span[contains(text(), 'Advanced gas controls')]`)) + await driver.executeScript('arguments[0].scrollIntoView(true)', advancedGasTitle) + + const advancedGasToggle = await findElement(driver, By.css('.settings-page__content-row:nth-of-type(11) .settings-page__content-item-col > div')) + await advancedGasToggle.click() + windowHandles = await driver.getAllWindowHandles() + extension = windowHandles[0] + await closeAllWindowHandlesExcept(driver, [extension]) + + const metamaskHomeButton = await findElement(driver, By.css('.app-header__logo-container')) + await metamaskHomeButton.click() + + await delay(largeDelayMs) + }) + it('starts a send transaction inside the dapp', async () => { await openNewPage(driver, 'http://127.0.0.1:8080/') await delay(regularDelayMs) @@ -516,6 +540,17 @@ describe('MetaMask', function () { await assertElementNotPresent(webdriver, driver, By.xpath(`//li[contains(text(), 'Data')]`)) + const [gasPriceInput, gasLimitInput] = await findElements(driver, By.css('.advanced-gas-inputs__gas-edit-row__input')) + await gasPriceInput.clear() + await delay(tinyDelayMs) + + await gasPriceInput.sendKeys(Key.BACK_SPACE) + await gasPriceInput.sendKeys(Key.BACK_SPACE) + await gasPriceInput.sendKeys('10') + await delay(tinyDelayMs) + await gasLimitInput.sendKeys('5') + await delay(tinyDelayMs) + const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`), 10000) await confirmButton.click() await delay(regularDelayMs) @@ -532,6 +567,17 @@ describe('MetaMask', function () { const txValues = await findElement(driver, By.css('.transaction-list-item__amount--primary')) await driver.wait(until.elementTextMatches(txValues, /-3\s*ETH/), 10000) }) + + it('the transaction has the expected gas price', async function () { + const txValues = await findElement(driver, By.css('.transaction-list-item__amount--primary')) + await txValues.click() + await delay(tinyDelayMs) + await findElement(driver, By.xpath(`//div[contains(text(), 'Gas Price (GWEI)')]`)) + + await findElement(driver, By.xpath(`//span[contains(text(), '7')]`)) + + txValues.click() + }) }) describe('Navigate transactions', () => { -- cgit v1.2.3