aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDan J Miller <danjm.com@gmail.com>2018-12-11 05:51:00 +0800
committerDan Finlay <542863+danfinlay@users.noreply.github.com>2018-12-11 05:51:00 +0800
commit1fbdce8916151df2b31eebc5de29a1365e5dadff (patch)
tree2333aa889dd6a6ec83a1665591006daca8e68859 /test
parent49971e9ec250888746546f62fa176ed129bf9c74 (diff)
downloadtangerine-wallet-browser-1fbdce8916151df2b31eebc5de29a1365e5dadff.tar
tangerine-wallet-browser-1fbdce8916151df2b31eebc5de29a1365e5dadff.tar.gz
tangerine-wallet-browser-1fbdce8916151df2b31eebc5de29a1365e5dadff.tar.bz2
tangerine-wallet-browser-1fbdce8916151df2b31eebc5de29a1365e5dadff.tar.lz
tangerine-wallet-browser-1fbdce8916151df2b31eebc5de29a1365e5dadff.tar.xz
tangerine-wallet-browser-1fbdce8916151df2b31eebc5de29a1365e5dadff.tar.zst
tangerine-wallet-browser-1fbdce8916151df2b31eebc5de29a1365e5dadff.zip
Improve ux for low gas price set (#5862)
* Show user warning if they set gas price below safelow minimum, error if 0. * Properly cache basic price estimate data. * Default retry price to recommended price if original price was 0x0 * Use mock fetch in send-new-ui integration tests.
Diffstat (limited to 'test')
-rw-r--r--test/e2e/beta/metamask-beta-ui.spec.js3
-rw-r--r--test/integration/lib/send-new-ui.js16
2 files changed, 18 insertions, 1 deletions
diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js
index c5b7f40e4..9980e874f 100644
--- a/test/e2e/beta/metamask-beta-ui.spec.js
+++ b/test/e2e/beta/metamask-beta-ui.spec.js
@@ -69,6 +69,7 @@ describe('MetaMask', function () {
beforeEach(async function () {
await driver.executeScript(
+ 'window.origFetch = window.fetch.bind(window);' +
'window.fetch = ' +
'(...args) => { ' +
'if (args[0] === "https://ethgasstation.info/json/ethgasAPI.json") { return ' +
@@ -77,7 +78,7 @@ describe('MetaMask', function () {
'Promise.resolve({ json: () => Promise.resolve(JSON.parse(\'' + fetchMockResponses.ethGasPredictTable + '\')) }); } else if ' +
'(args[0] === "https://dev.blockscale.net/api/gasexpress.json") { return ' +
'Promise.resolve({ json: () => Promise.resolve(JSON.parse(\'' + fetchMockResponses.gasExpress + '\')) }); } ' +
- 'return window.fetch(...args); }'
+ 'return window.origFetch(...args); }'
)
})
diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js
index 98e5f549b..1acd85a35 100644
--- a/test/integration/lib/send-new-ui.js
+++ b/test/integration/lib/send-new-ui.js
@@ -4,6 +4,7 @@ const {
queryAsync,
findAsync,
} = require('../../lib/util')
+const fetchMockResponses = require('../../e2e/beta/fetch-mocks.js')
QUnit.module('new ui send flow')
@@ -22,6 +23,19 @@ global.ethQuery = {
global.ethereumProvider = {}
async function runSendFlowTest (assert, done) {
+ const tempFetch = global.fetch
+
+ global.fetch = (...args) => {
+ if (args[0] === 'https://ethgasstation.info/json/ethgasAPI.json') {
+ return Promise.resolve({ json: () => Promise.resolve(JSON.parse(fetchMockResponses.ethGasBasic)) })
+ } else if (args[0] === 'https://ethgasstation.info/json/predictTable.json') {
+ return Promise.resolve({ json: () => Promise.resolve(JSON.parse(fetchMockResponses.ethGasPredictTable)) })
+ } else if (args[0] === 'https://dev.blockscale.net/api/gasexpress.json') {
+ return Promise.resolve({ json: () => Promise.resolve(JSON.parse(fetchMockResponses.gasExpress)) })
+ }
+ return window.fetch(...args)
+ }
+
console.log('*** start runSendFlowTest')
const selectState = await queryAsync($, 'select')
selectState.val('send new ui')
@@ -129,6 +143,8 @@ async function runSendFlowTest (assert, done) {
const cancelButtonInEdit = await queryAsync($, '.btn-default.btn--large.page-container__footer-button')
cancelButtonInEdit[0].click()
+
+ global.fetch = tempFetch
// sendButtonInEdit[0].click()
// // TODO: Need a way to mock background so that we can test correct transition from editing to confirm