From 2f5abd9ad8ac64c16edcc0d9fff923e62c5ca984 Mon Sep 17 00:00:00 2001 From: Thomas Huang Date: Tue, 11 Dec 2018 14:56:47 -0800 Subject: Version Bump (#5909) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adds new gas customization modal container (without content) * Adds the content of the advanced tab - w/o chart or dynamic content - to gas customize modal. * Use correct message key in gas-modal-page-container.component.js * Use BEM for css in gas-modal-page-container * Split advanced-tab-content.component.js render() method into smaller pieces; add translations to the same file. * Remove gas slider from advance-tab-content.component * Add tests for advanced-tab-component.js and subcomponents. * Improve styling of advanced-tab-content gasInput row * Adds basic tab content to gas customizer, with styled button group (static, for now). * Connect the gas-button-group component to redux and a live api. * Improvements to propdefaults in button-group.component and basic-tab-content.component * Styling fixes for gas customization advanced tab content. * Adds gas-duck.test.js tests. * Connects remained of the gas customization component to redux. * Integrate gas buttons with the send screen. * Test updates and additions for button integration with send screen. * Adds redesign for the customize gas advanced tab. * Adds not yet functional gas price chart. * Gas price chart improvements, redesign, bug fixes, and set up to receive external data * Read only connection of gas price chart to redux * Clean up for advanced gas tab customization changes. * Complete integration of gas chart with redux. * Add control arrows to advanced gas tab inputs. * Lint and unit test fixes. * Clean up gas chart code. * Update tests, plus some lint fixes, for gas-price-chart * Improve data management and tests for gas-modal-page-container price estimates. * Clean up for mmui-i11-custom-gas-price-chart branch * Redesign of gas customization basic tab. * Adds createSpeedUpTransaction to txController * Connect gas price chart to gas station api. * Adds speed up slide-in gas customization sidebar * Update e2e tests for new gas customization modal. * Fixes for components that break e2e gas customization tests, plus unit test updates. * Remove gas customization integration tests (in favour of e2e tests) * Add gas data to integration test json data set. * Add c3 and d3 to the separate dependencies bundle. * Make gas customization modal responsive. * Fix "fastest" translation message; change to sentence case * Uses more reliable api on main send screen; caches basic api results in modal * Add loading spinners when waiting for APIs in the gas customization modal * Modify results of API data to better fit gas chart: remove outliers, pad data * Clear custom gas data on hiding of gas customization modal. * Improve responsiveness of customize speed up slider. * Final gas customization fixes * Fix styling of send screen in extension view when hex data on. * Replace height: 100% rule with workaround for flexbox quirks * Fill in more Polish message translations * Update lockfile to fix errors npm has informed me that the lockfile has "errors": npm ERR! code ELOCKVERIFY npm ERR! Errors were found in your package-lock.json, run npm install to fix them. npm ERR! Missing: c3@^0.6.7 npm ERR! Invalid: lock file's d3@3.5.17 does not satisfy d3@^5.7.0 * circleci: Disable npm audit when installing packages Auditing packages when installing here doesn't help anyone as the summary isn't visible and vulnerabilities don't produce a non-zero exit code. We will have `npm audit` as an extra CI job. * npm audit fix * circleci: Replace nsp with npm audit Refs #4751 * Remove beefy dependency and its usages Refs #4768 Refs #5389 This changeset removes the beefy package that: 1. Was last published 2 yrs ago 2. Brought with it 1 moderate and 1 critical vulnerability 3. Was only used in scripts that no longer work * npm uninstall open * Update ganache-core to mitigate vuln === npm audit security report === > # Run npm install --save-dev ganache-core@2.3.1 to resolve 1 vulnerability ┌───────────────┬──────────────────────────────────────────────────────────────┐ │ Moderate │ Memory Exposure │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Package │ bl │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Dependency of │ ganache-core [dev] │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Path │ ganache-core > level-sublevel > levelup > bl │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ More info │ https://nodesecurity.io/advisories/596 │ └───────────────┴──────────────────────────────────────────────────────────────┘ * Deduplicate package.json file From `npm install`: > npm WARN The package css-loader is included as both a dev and production dependency. > npm WARN The package eslint-plugin-react is included as both a dev and production dependency. > npm WARN The package file-loader is included as both a dev and production dependency. > npm WARN The package gulp is included as both a dev and production dependency. It's also worth noting that the Gulp version we were using was inconsistent and there is a published v4 release on GitHub. * Fix race condition in network controller lookup() method. * Group transactions by nonce (#5886) * fix formatting of 32-byte strings in personal_sign (#5878) * Bump json-rpc-engine to v4.0.0 * Bump package lock, mostly to https links * 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. * Show Failed transaction in the browser notification for on-chain failures (#5904) * Changelog and version bump for 5.2.0 --- test/integration/lib/confirm-sig-requests.js | 4 +-- test/integration/lib/send-new-ui.js | 51 +++++++++------------------- test/integration/lib/tx-list-items.js | 26 +++++--------- 3 files changed, 26 insertions(+), 55 deletions(-) (limited to 'test/integration/lib') 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') } -- cgit v1.2.3