aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Miller <danjm.com@gmail.com>2018-12-12 22:54:03 +0800
committerDan Miller <danjm.com@gmail.com>2018-12-12 23:30:57 +0800
commit1145a0a9ad46fda5fb9a7ad9cf5cf062c574691d (patch)
tree8d5e4f3f8b316a6912d987e98dee0919b20f083d
parent9c2401965911aa78496a8168a76e9c0c2e4c86b5 (diff)
downloadtangerine-wallet-browser-1145a0a9ad46fda5fb9a7ad9cf5cf062c574691d.tar.gz
tangerine-wallet-browser-1145a0a9ad46fda5fb9a7ad9cf5cf062c574691d.tar.zst
tangerine-wallet-browser-1145a0a9ad46fda5fb9a7ad9cf5cf062c574691d.zip
Ensures that advanced tab gas limit reflects tx gas limit
-rw-r--r--test/e2e/beta/metamask-beta-ui.spec.js16
-rw-r--r--ui/app/components/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js4
-rw-r--r--ui/app/ducks/gas.duck.js2
-rw-r--r--ui/app/ducks/tests/gas-duck.test.js2
-rw-r--r--ui/app/selectors/custom-gas.js5
-rw-r--r--ui/app/selectors/tests/custom-gas.test.js5
6 files changed, 23 insertions, 11 deletions
diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js
index 9980e874f..a69b25e77 100644
--- a/test/e2e/beta/metamask-beta-ui.spec.js
+++ b/test/e2e/beta/metamask-beta-ui.spec.js
@@ -769,6 +769,22 @@ describe('MetaMask', function () {
await driver.switchTo().window(popup)
await delay(regularDelayMs)
+ const configureGas = await driver.wait(until.elementLocated(By.css('.confirm-detail-row__header-text--edit')), 10000)
+ await configureGas.click()
+ await delay(regularDelayMs)
+
+ const advancedTabButton = await driver.wait(until.elementLocated(By.xpath(`//li[contains(text(), 'Advanced')]`)), 10000)
+ await advancedTabButton.click()
+ await delay(tinyDelayMs)
+
+ const [gasPriceInput, gasLimitInput] = await findElements(driver, By.css('.advanced-tab__gas-edit-row__input'))
+ assert(gasPriceInput.getAttribute('value'), 20)
+ assert(gasLimitInput.getAttribute('value'), 4700000)
+
+ const saveButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Save')]`))
+ await saveButton.click()
+ await delay(regularDelayMs)
+
const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
await confirmButton.click()
await delay(regularDelayMs)
diff --git a/ui/app/components/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js b/ui/app/components/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js
index dde0f2b94..1671f95fa 100644
--- a/ui/app/components/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js
+++ b/ui/app/components/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js
@@ -76,7 +76,7 @@ const mapStateToProps = (state, ownProps) => {
const customGasTotal = calcGasTotal(customModalGasLimitInHex, customModalGasPriceInHex)
- const gasButtonInfo = getRenderableBasicEstimateData(state)
+ const gasButtonInfo = getRenderableBasicEstimateData(state, customModalGasLimitInHex)
const currentCurrency = getCurrentCurrency(state)
const conversionRate = getConversionRate(state)
@@ -235,7 +235,7 @@ function getTxParams (state, transactionId) {
const { txParams: pendingTxParams } = pendingTransaction || {}
return txData.txParams || pendingTxParams || {
from: send.from,
- gas: send.gasLimit,
+ gas: send.gasLimit || '0x5208',
gasPrice: send.gasPrice || getFastPriceEstimateInHexWEI(state, true),
to: send.to,
value: getSelectedToken(state) ? '0x0' : send.amount,
diff --git a/ui/app/ducks/gas.duck.js b/ui/app/ducks/gas.duck.js
index ee235a757..957b00163 100644
--- a/ui/app/ducks/gas.duck.js
+++ b/ui/app/ducks/gas.duck.js
@@ -29,7 +29,7 @@ const SET_BASIC_PRICE_ESTIMATES_LAST_RETRIEVED = 'metamask/gas/SET_BASIC_PRICE_E
const initState = {
customData: {
price: null,
- limit: '0x5208',
+ limit: null,
},
basicEstimates: {
average: null,
diff --git a/ui/app/ducks/tests/gas-duck.test.js b/ui/app/ducks/tests/gas-duck.test.js
index 3637d8f29..cd963aed4 100644
--- a/ui/app/ducks/tests/gas-duck.test.js
+++ b/ui/app/ducks/tests/gas-duck.test.js
@@ -98,7 +98,7 @@ describe('Gas Duck', () => {
const initState = {
customData: {
price: null,
- limit: '0x5208',
+ limit: null,
},
basicEstimates: {
average: null,
diff --git a/ui/app/selectors/custom-gas.js b/ui/app/selectors/custom-gas.js
index 91c9109a5..f9cedf9fb 100644
--- a/ui/app/selectors/custom-gas.js
+++ b/ui/app/selectors/custom-gas.js
@@ -221,11 +221,10 @@ function getGasPriceInHexWei (price) {
)(price)
}
-function getRenderableBasicEstimateData (state) {
+function getRenderableBasicEstimateData (state, gasLimit) {
if (getBasicGasEstimateLoadingStatus(state)) {
return []
}
- const gasLimit = state.metamask.send.gasLimit || getCustomGasLimit(state)
const conversionRate = state.metamask.conversionRate
const currentCurrency = getCurrentCurrency(state)
const {
@@ -270,7 +269,7 @@ function getRenderableEstimateDataForSmallButtonsFromGWEI (state) {
if (getBasicGasEstimateLoadingStatus(state)) {
return []
}
- const gasLimit = state.metamask.send.gasLimit || getCustomGasLimit(state)
+ const gasLimit = state.metamask.send.gasLimit || getCustomGasLimit(state) || '0x5208'
const conversionRate = state.metamask.conversionRate
const currentCurrency = getCurrentCurrency(state)
const {
diff --git a/ui/app/selectors/tests/custom-gas.test.js b/ui/app/selectors/tests/custom-gas.test.js
index ebc300160..e43fd0d74 100644
--- a/ui/app/selectors/tests/custom-gas.test.js
+++ b/ui/app/selectors/tests/custom-gas.test.js
@@ -102,9 +102,6 @@ describe('custom-gas selectors', () => {
metamask: {
conversionRate: 255.71,
currentCurrency: 'usd',
- send: {
- gasLimit: '0x5208',
- },
},
gas: {
basicEstimates: {
@@ -168,7 +165,7 @@ describe('custom-gas selectors', () => {
it('should return renderable data about basic estimates', () => {
tests.forEach(test => {
assert.deepEqual(
- getRenderableBasicEstimateData(test.mockState),
+ getRenderableBasicEstimateData(test.mockState, '0x5208'),
test.expectedResult
)
})