aboutsummaryrefslogtreecommitdiffstats
path: root/test/integration/lib
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/lib')
-rw-r--r--test/integration/lib/confirm-sig-requests.js4
-rw-r--r--test/integration/lib/send-new-ui.js51
-rw-r--r--test/integration/lib/tx-list-items.js26
3 files changed, 26 insertions, 55 deletions
diff --git a/test/integration/lib/confirm-sig-requests.js b/test/integration/lib/confirm-sig-requests.js
index 9c2ad7cf4..041a1af34 100644
--- a/test/integration/lib/confirm-sig-requests.js
+++ b/test/integration/lib/confirm-sig-requests.js
@@ -21,8 +21,8 @@ async function runConfirmSigRequestsTest (assert, done) {
const pendingRequestItem = $.find('.transaction-list-item .transaction-list-item__grid')
- if (pendingRequestItem[0]) {
- pendingRequestItem[0].click()
+ if (pendingRequestItem[2]) {
+ pendingRequestItem[2].click()
}
await timeout(1000)
diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js
index 271dd91cf..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')
@@ -21,38 +22,20 @@ global.ethQuery = {
global.ethereumProvider = {}
-async function customizeGas (assert, price, limit, ethFee, usdFee) {
- const sendGasOpenCustomizeModalButton = await queryAsync($, '.sliders-icon-container')
- sendGasOpenCustomizeModalButton[0].click()
-
- const customizeGasModal = await queryAsync($, '.send-v2__customize-gas')
- assert.ok(customizeGasModal[0], 'should render the customize gas modal')
-
- const customizeGasPriceInput = (await queryAsync($, '.send-v2__gas-modal-card')).first().find('input')
- customizeGasPriceInput.val(price)
- reactTriggerChange(customizeGasPriceInput[0])
- const customizeGasLimitInput = (await queryAsync($, '.send-v2__gas-modal-card')).last().find('input')
- customizeGasLimitInput.val(limit)
- reactTriggerChange(customizeGasLimitInput[0])
-
- const customizeGasSaveButton = await queryAsync($, '.send-v2__customize-gas__save')
- customizeGasSaveButton[0].click()
- const sendGasField = await queryAsync($, '.send-v2__gas-fee-display')
-
- assert.equal(
- (await findAsync(sendGasField, '.currency-display-component'))[0].textContent,
- ethFee,
- 'send gas field should show customized gas total'
- )
-
- assert.equal(
- (await findAsync(sendGasField, '.currency-display__converted-value'))[0].textContent,
- usdFee,
- 'send gas field should show customized gas total converted to USD'
- )
-}
-
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')
@@ -112,10 +95,6 @@ async function runSendFlowTest (assert, done) {
errorMessage = $('.send-v2__error')
assert.equal(errorMessage.length, 0, 'send should stop rendering amount error message after amount is corrected')
- await customizeGas(assert, 0, 21000, '0ETH', '$0.00USD')
- await customizeGas(assert, 1, 21000, '0.000021ETH', '$0.03USD')
- await customizeGas(assert, 500, 60000, '0.03ETH', '$36.03USD')
-
const sendButton = await queryAsync($, 'button.btn-primary.btn--large.page-container__footer-button')
assert.equal(sendButton[0].textContent, 'Next', 'next button rendered')
sendButton[0].click()
@@ -164,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
diff --git a/test/integration/lib/tx-list-items.js b/test/integration/lib/tx-list-items.js
index ed4f82074..ff196fac8 100644
--- a/test/integration/lib/tx-list-items.js
+++ b/test/integration/lib/tx-list-items.js
@@ -30,35 +30,25 @@ async function runTxListItemsTest (assert, done) {
metamaskLogo[0].click()
const txListItems = await queryAsync($, '.transaction-list-item')
- assert.equal(txListItems.length, 8, 'all tx list items are rendered')
+ assert.equal(txListItems.length, 7, 'all tx list items are rendered')
- const retryTxGrid = await findAsync($(txListItems[2]), '.transaction-list-item__grid')
- retryTxGrid[0].click()
- const retryTxDetails = await findAsync($, '.transaction-list-item-details')
- const headerButtons = await findAsync($(retryTxDetails[0]), '.transaction-list-item-details__header-button')
- assert.equal(headerButtons[0].textContent, 'speed up')
-
- const approvedTx = txListItems[2]
+ const approvedTx = txListItems[0]
const approvedTxRenderedStatus = await findAsync($(approvedTx), '.transaction-list-item__status')
assert.equal(approvedTxRenderedStatus[0].textContent, 'pending', 'approvedTx has correct label')
- const unapprovedMsg = txListItems[0]
+ const unapprovedMsg = txListItems[1]
const unapprovedMsgDescription = await findAsync($(unapprovedMsg), '.transaction-list-item__action')
assert.equal(unapprovedMsgDescription[0].textContent, 'Signature Request', 'unapprovedMsg has correct description')
- const failedTx = txListItems[4]
- const failedTxRenderedStatus = await findAsync($(failedTx), '.transaction-list-item__status')
- assert.equal(failedTxRenderedStatus[0].textContent, 'Failed', 'failedTx has correct label')
-
- const shapeShiftTx = txListItems[5]
+ const shapeShiftTx = txListItems[4]
const shapeShiftTxStatus = await findAsync($(shapeShiftTx), '.flex-column div:eq(1)')
assert.equal(shapeShiftTxStatus[0].textContent, 'No deposits received', 'shapeShiftTx has correct status')
+ const rejectedTx = txListItems[5]
+ const rejectedTxRenderedStatus = await findAsync($(rejectedTx), '.transaction-list-item__status')
+ assert.equal(rejectedTxRenderedStatus[0].textContent, 'Rejected', 'rejectedTx has correct label')
+
const confirmedTokenTx = txListItems[6]
const confirmedTokenTxAddress = await findAsync($(confirmedTokenTx), '.transaction-list-item__status')
assert.equal(confirmedTokenTxAddress[0].textContent, 'Confirmed', 'confirmedTokenTx has correct address')
-
- const rejectedTx = txListItems[7]
- const rejectedTxRenderedStatus = await findAsync($(rejectedTx), '.transaction-list-item__status')
- assert.equal(rejectedTxRenderedStatus[0].textContent, 'Rejected', 'rejectedTx has correct label')
}