Fix e2e tests and gas default (#7267)

* Add extra delay after second send3eth.click() in the 'adds multiple transactions' test

* Remove use of ARBITRARY_HIGH_BLOCK_GAS_LIMIT as fallback
feature/default_network_editable
Dan J Miller 5 years ago committed by Mark Stacey
parent e7bf250eab
commit 4ed452e6ed
  1. 11
      test/e2e/metamask-ui.spec.js
  2. 3
      ui/app/pages/send/send.constants.js
  3. 3
      ui/app/pages/send/send.utils.js

@ -563,22 +563,23 @@ describe('MetaMask', function () {
const dapp = windowHandles[1] const dapp = windowHandles[1]
await driver.switchTo().window(dapp) await driver.switchTo().window(dapp)
await delay(regularDelayMs) await delay(largeDelayMs)
const send3eth = await findElement(driver, By.xpath(`//button[contains(text(), 'Send')]`), 10000) const send3eth = await findElement(driver, By.xpath(`//button[contains(text(), 'Send')]`), 10000)
await send3eth.click() await send3eth.click()
await delay(largeDelayMs * 2) await delay(largeDelayMs)
const contractDeployment = await findElement(driver, By.xpath(`//button[contains(text(), 'Deploy Contract')]`), 10000) const contractDeployment = await findElement(driver, By.xpath(`//button[contains(text(), 'Deploy Contract')]`), 10000)
await contractDeployment.click() await contractDeployment.click()
await delay(largeDelayMs * 2) await delay(largeDelayMs)
await send3eth.click() await send3eth.click()
await delay(largeDelayMs)
await contractDeployment.click() await contractDeployment.click()
await delay(largeDelayMs * 2) await delay(largeDelayMs)
await driver.switchTo().window(extension) await driver.switchTo().window(extension)
await delay(largeDelayMs * 2) await delay(regularDelayMs)
let transactions = await findElements(driver, By.css('.transaction-list-item')) let transactions = await findElements(driver, By.css('.transaction-list-item'))
await transactions[3].click() await transactions[3].click()

@ -6,8 +6,6 @@ const MIN_GAS_PRICE_HEX = (parseInt(MIN_GAS_PRICE_DEC)).toString(16)
const MIN_GAS_LIMIT_DEC = '21000' const MIN_GAS_LIMIT_DEC = '21000'
const MIN_GAS_LIMIT_HEX = (parseInt(MIN_GAS_LIMIT_DEC)).toString(16) const MIN_GAS_LIMIT_HEX = (parseInt(MIN_GAS_LIMIT_DEC)).toString(16)
const ARBITRARY_HIGH_BLOCK_GAS_LIMIT = (parseInt('8000000')).toString(16)
const MIN_GAS_PRICE_GWEI = ethUtil.addHexPrefix(conversionUtil(MIN_GAS_PRICE_HEX, { const MIN_GAS_PRICE_GWEI = ethUtil.addHexPrefix(conversionUtil(MIN_GAS_PRICE_HEX, {
fromDenomination: 'WEI', fromDenomination: 'WEI',
toDenomination: 'GWEI', toDenomination: 'GWEI',
@ -60,5 +58,4 @@ module.exports = {
SIMPLE_GAS_COST, SIMPLE_GAS_COST,
TOKEN_TRANSFER_FUNCTION_SIGNATURE, TOKEN_TRANSFER_FUNCTION_SIGNATURE,
BASE_TOKEN_GAS_COST, BASE_TOKEN_GAS_COST,
ARBITRARY_HIGH_BLOCK_GAS_LIMIT,
} }

@ -18,7 +18,6 @@ const {
ONE_GWEI_IN_WEI_HEX, ONE_GWEI_IN_WEI_HEX,
SIMPLE_GAS_COST, SIMPLE_GAS_COST,
TOKEN_TRANSFER_FUNCTION_SIGNATURE, TOKEN_TRANSFER_FUNCTION_SIGNATURE,
ARBITRARY_HIGH_BLOCK_GAS_LIMIT,
} = require('./send.constants') } = require('./send.constants')
const abi = require('ethereumjs-abi') const abi = require('ethereumjs-abi')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
@ -245,7 +244,7 @@ async function estimateGas ({
// if not, fall back to block gasLimit // if not, fall back to block gasLimit
if (!blockGasLimit) { if (!blockGasLimit) {
blockGasLimit = ARBITRARY_HIGH_BLOCK_GAS_LIMIT blockGasLimit = MIN_GAS_LIMIT_HEX
} }
paramsForGasEstimate.gas = ethUtil.addHexPrefix(multiplyCurrencies(blockGasLimit, 0.95, { paramsForGasEstimate.gas = ethUtil.addHexPrefix(multiplyCurrencies(blockGasLimit, 0.95, {

Loading…
Cancel
Save