From 26f965bcceb26ce7cdec9df9f213b44be8d9acac Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 27 Apr 2018 16:33:00 -0230 Subject: Further refactors; includes refactor of send-v2.js and associated container --- test/integration/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/integration') diff --git a/test/integration/index.js b/test/integration/index.js index b266ddf37..7789eb283 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -2,7 +2,8 @@ const fs = require('fs') const path = require('path') const pump = require('pump') const browserify = require('browserify') -const tests = fs.readdirSync(path.join(__dirname, 'lib')) +let tests = fs.readdirSync(path.join(__dirname, 'lib')) +tests = tests.filter(fln => fln.match(/send/)) const bundlePath = path.join(__dirname, 'bundle.js') const b = browserify() -- cgit v1.2.3 From 6bc8cc819a16118acc010d0efdec90afbda14590 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 14 May 2018 11:00:50 -0230 Subject: Merge branch 'develop' into i3725-refactor-send-component- --- test/integration/lib/mascara-first-time.js | 19 ++++++++-- test/integration/lib/send-new-ui.js | 59 +++++++++++++++++------------- test/integration/lib/tx-list-items.js | 4 +- 3 files changed, 51 insertions(+), 31 deletions(-) (limited to 'test/integration') diff --git a/test/integration/lib/mascara-first-time.js b/test/integration/lib/mascara-first-time.js index 5e07ab0b4..d86703277 100644 --- a/test/integration/lib/mascara-first-time.js +++ b/test/integration/lib/mascara-first-time.js @@ -71,10 +71,23 @@ async function runFirstTimeUsageTest (assert, done) { assert.ok(lock, 'Lock menu item found') lock.click() - const pwBox2 = (await findAsync(app, '#password-box'))[0] - pwBox2.value = PASSWORD + await timeout(1000) - const createButton2 = (await findAsync(app, 'button.primary'))[0] + const pwBox2 = (await findAsync(app, '#password'))[0] + pwBox2.focus() + await timeout(1000) + + // Used to set values on TextField input component + const nativeInputValueSetter = Object.getOwnPropertyDescriptor( + window.HTMLInputElement.prototype, 'value' + ).set + + nativeInputValueSetter.call(pwBox2, PASSWORD) + + var ev2 = new Event('input', { bubbles: true}) + pwBox2.dispatchEvent(ev2) + + const createButton2 = (await findAsync(app, 'button[type="submit"]'))[0] createButton2.click() const detail2 = (await findAsync(app, '.wallet-view'))[0] diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index 09a074750..3da3f4f95 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -23,6 +23,37 @@ 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__input-wrapper > input')).val(), + 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) { console.log('*** start runSendFlowTest') const selectState = await queryAsync($, 'select') @@ -95,32 +126,8 @@ async function runSendFlowTest(assert, done) { 'send gas field should show estimated gas total converted to USD' ) - 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(50) - reactTriggerChange(customizeGasPriceInput[0]) - const customizeGasLimitInput = (await queryAsync($, '.send-v2__gas-modal-card')).last().find('input') - customizeGasLimitInput.val(60000) - reactTriggerChange(customizeGasLimitInput[0]) - - const customizeGasSaveButton = await queryAsync($, '.send-v2__customize-gas__save') - customizeGasSaveButton[0].click() - - assert.equal( - (await findAsync(sendGasField, '.currency-display__input-wrapper > input')).val(), - '0.003', - 'send gas field should show customized gas total' - ) - assert.equal( - (await findAsync(sendGasField, '.currency-display__converted-value'))[0].textContent, - '$3.60 USD', - 'send gas field should show customized gas total converted to USD' - ) + await customizeGas(assert, 0, 21000, '0', '$0.00 USD') + await customizeGas(assert, 500, 60000, '0.003', '$3.60 USD') const sendButton = await queryAsync($, 'button.btn-primary--lg.page-container__footer-button') assert.equal(sendButton[0].textContent, 'Next', 'next button rendered') diff --git a/test/integration/lib/tx-list-items.js b/test/integration/lib/tx-list-items.js index 0c0c5a77f..4856b3852 100644 --- a/test/integration/lib/tx-list-items.js +++ b/test/integration/lib/tx-list-items.js @@ -21,7 +21,7 @@ async function runTxListItemsTest(assert, done) { selectState.val('tx list items') reactTriggerChange(selectState[0]) - const metamaskLogo = await queryAsync($, '.left-menu-wrapper') + const metamaskLogo = await queryAsync($, '.app-header__logo-container') assert.ok(metamaskLogo[0], 'metamask logo present') metamaskLogo[0].click() @@ -46,7 +46,7 @@ async function runTxListItemsTest(assert, done) { const failedTx = txListItems[4] const failedTxRenderedStatus = await findAsync($(failedTx), '.tx-list-status') assert.equal(failedTxRenderedStatus[0].textContent, 'Failed', 'failedTx has correct label') - + const shapeShiftTx = txListItems[5] const shapeShiftTxStatus = await findAsync($(shapeShiftTx), '.flex-column div:eq(1)') assert.equal(shapeShiftTxStatus[0].textContent, 'No deposits received', 'shapeShiftTx has correct status') -- cgit v1.2.3 From 759bc173887dbb301fd17739ce431e8dfd096adc Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 15 May 2018 11:18:33 -0230 Subject: Merge branch 'develop' into i3725-refactor-send-component- --- test/integration/lib/mascara-first-time.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'test/integration') diff --git a/test/integration/lib/mascara-first-time.js b/test/integration/lib/mascara-first-time.js index d86703277..f43a30c74 100644 --- a/test/integration/lib/mascara-first-time.js +++ b/test/integration/lib/mascara-first-time.js @@ -1,5 +1,4 @@ const PASSWORD = 'password123' -const reactTriggerChange = require('react-trigger-change') const { timeout, findAsync, @@ -11,6 +10,11 @@ async function runFirstTimeUsageTest (assert, done) { const app = await queryAsync($, '#app-content') + // Used to set values on TextField input component + const nativeInputValueSetter = Object.getOwnPropertyDescriptor( + window.HTMLInputElement.prototype, 'value' + ).set + await skipNotices(app) const welcomeButton = (await findAsync(app, '.welcome-screen__button'))[0] @@ -21,12 +25,14 @@ async function runFirstTimeUsageTest (assert, done) { assert.equal(title, 'Create Password', 'create password screen') // enter password - const pwBox = (await findAsync(app, '.first-time-flow__input'))[0] - const confBox = (await findAsync(app, '.first-time-flow__input'))[1] - pwBox.value = PASSWORD - confBox.value = PASSWORD - reactTriggerChange(pwBox) - reactTriggerChange(confBox) + const pwBox = (await findAsync(app, '#create-password'))[0] + const confBox = (await findAsync(app, '#confirm-password'))[0] + + nativeInputValueSetter.call(pwBox, PASSWORD) + pwBox.dispatchEvent(new Event('input', { bubbles: true})) + + nativeInputValueSetter.call(confBox, PASSWORD) + confBox.dispatchEvent(new Event('input', { bubbles: true})) // Create Password const createButton = (await findAsync(app, 'button.first-time-flow__button'))[0] @@ -77,15 +83,8 @@ async function runFirstTimeUsageTest (assert, done) { pwBox2.focus() await timeout(1000) - // Used to set values on TextField input component - const nativeInputValueSetter = Object.getOwnPropertyDescriptor( - window.HTMLInputElement.prototype, 'value' - ).set - nativeInputValueSetter.call(pwBox2, PASSWORD) - - var ev2 = new Event('input', { bubbles: true}) - pwBox2.dispatchEvent(ev2) + pwBox2.dispatchEvent(new Event('input', { bubbles: true})) const createButton2 = (await findAsync(app, 'button[type="submit"]'))[0] createButton2.click() -- cgit v1.2.3 From 0de765aa25637cd85e22eebd11b6c4c8a32faf14 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 24 May 2018 22:30:07 -0230 Subject: Clean up for send refactor PR. --- test/integration/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test/integration') diff --git a/test/integration/index.js b/test/integration/index.js index 7789eb283..b266ddf37 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -2,8 +2,7 @@ const fs = require('fs') const path = require('path') const pump = require('pump') const browserify = require('browserify') -let tests = fs.readdirSync(path.join(__dirname, 'lib')) -tests = tests.filter(fln => fln.match(/send/)) +const tests = fs.readdirSync(path.join(__dirname, 'lib')) const bundlePath = path.join(__dirname, 'bundle.js') const b = browserify() -- cgit v1.2.3 From 3d597cd1d2bfe74abdb945f8ec3ffe96853ed90a Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 25 May 2018 08:01:25 -0230 Subject: Fix test to account for greater precision currency display. --- test/integration/lib/send-new-ui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/integration') diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index 3da3f4f95..069b7fedd 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -117,7 +117,7 @@ async function runSendFlowTest(assert, done) { const sendGasField = await queryAsync($, '.send-v2__gas-fee-display') assert.equal( sendGasField.find('.currency-display__input-wrapper > input').val(), - '0.000198', + '0.000198264', 'send gas field should show estimated gas total' ) assert.equal( -- cgit v1.2.3 From 67c74cd5b6dba059f954be6867a20e1f97197f7d Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 31 May 2018 12:07:23 -0230 Subject: Fix currency display send integration tests. --- test/integration/lib/send-new-ui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/integration') diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index 3da3f4f95..0a9495595 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -101,7 +101,7 @@ async function runSendFlowTest(assert, done) { const sendAmountField = await queryAsync($, '.send-v2__form-row:eq(2)') sendAmountField.find('.currency-display')[0].click() - const sendAmountFieldInput = await findAsync(sendAmountField, 'input:text') + const sendAmountFieldInput = await findAsync(sendAmountField, '.currency-display__input') sendAmountFieldInput.val('5.1') reactTriggerChange(sendAmountField.find('input')[0]) -- cgit v1.2.3 From 704ba54bef4d7b29b265ce0d3a6b2e4b2c7a36eb Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 31 May 2018 12:08:11 -0230 Subject: Fix send-new-ui gas fee display expectation. --- test/integration/lib/send-new-ui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/integration') diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index 0a9495595..6db60ca31 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -127,7 +127,7 @@ async function runSendFlowTest(assert, done) { ) await customizeGas(assert, 0, 21000, '0', '$0.00 USD') - await customizeGas(assert, 500, 60000, '0.003', '$3.60 USD') + await customizeGas(assert, 500, 60000, '0.03', '$36.03 USD') const sendButton = await queryAsync($, 'button.btn-primary--lg.page-container__footer-button') assert.equal(sendButton[0].textContent, 'Next', 'next button rendered') -- cgit v1.2.3 From 3745c1ea4fd62f092c7e277a16b9204b0c0ddaea Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 31 May 2018 14:53:38 -0230 Subject: Fix send amount field select in send-new-ui integration test. --- test/integration/lib/send-new-ui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/integration') diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index 6db60ca31..ed1feec7d 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -165,7 +165,7 @@ async function runSendFlowTest(assert, done) { const sendAmountFieldInEdit = await queryAsync($, '.send-v2__form-row:eq(2)') sendAmountFieldInEdit.find('.currency-display')[0].click() - const sendAmountFieldInputInEdit = sendAmountFieldInEdit.find('input:text') + const sendAmountFieldInputInEdit = sendAmountFieldInEdit.find('.currency-display__input') sendAmountFieldInputInEdit.val('1.0') reactTriggerChange(sendAmountFieldInputInEdit[0]) -- cgit v1.2.3 From 0c8318b02a5ccb11f5de43a8c9894873e29c2401 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 18 Jun 2018 15:20:16 -0230 Subject: Update integration tests for newui gas estimation fixes. --- test/integration/lib/send-new-ui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/integration') diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index 4d2ea2ea4..72e4a8cb1 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -117,12 +117,12 @@ async function runSendFlowTest(assert, done) { const sendGasField = await queryAsync($, '.send-v2__gas-fee-display') assert.equal( sendGasField.find('.currency-display__input-wrapper > input').val(), - '0.000198264', + '0.000021', 'send gas field should show estimated gas total' ) assert.equal( sendGasField.find('.currency-display__converted-value')[0].textContent, - '$0.24 USD', + '$0.03 USD', 'send gas field should show estimated gas total converted to USD' ) -- cgit v1.2.3 From a8f745f9fe74751b87f500af3857b66d4c80f45e Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Mon, 2 Jul 2018 18:49:33 -0400 Subject: eslint --fix . --- test/integration/lib/add-token.js | 2 +- test/integration/lib/confirm-sig-requests.js | 6 +++--- test/integration/lib/currency-localization.js | 2 +- test/integration/lib/mascara-first-time.js | 2 +- test/integration/lib/send-new-ui.js | 4 ++-- test/integration/lib/tx-list-items.js | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) (limited to 'test/integration') diff --git a/test/integration/lib/add-token.js b/test/integration/lib/add-token.js index 5a08c90cd..6de7574c4 100644 --- a/test/integration/lib/add-token.js +++ b/test/integration/lib/add-token.js @@ -75,7 +75,7 @@ async function runAddTokenFlowTest (assert, done) { tokenWrapper[0].click() // Click Next button - let nextButton = await queryAsync($, 'button.btn-primary.btn--large') + const nextButton = await queryAsync($, 'button.btn-primary.btn--large') assert.equal(nextButton[0].textContent, 'Next', 'next button rendered') nextButton[0].click() diff --git a/test/integration/lib/confirm-sig-requests.js b/test/integration/lib/confirm-sig-requests.js index d5ed7c77c..c6a37eabd 100644 --- a/test/integration/lib/confirm-sig-requests.js +++ b/test/integration/lib/confirm-sig-requests.js @@ -16,8 +16,8 @@ QUnit.test('successful confirmation of sig requests', (assert) => { }) }) -async function runConfirmSigRequestsTest(assert, done) { - let selectState = await queryAsync($, 'select') +async function runConfirmSigRequestsTest (assert, done) { + const selectState = await queryAsync($, 'select') selectState.val('confirm sig requests') reactTriggerChange(selectState[0]) @@ -32,7 +32,7 @@ async function runConfirmSigRequestsTest(assert, done) { let confirmSigHeadline = await queryAsync($, '.request-signature__headline') assert.equal(confirmSigHeadline[0].textContent, 'Your signature is being requested') - let confirmSigMessage = await queryAsync($, '.request-signature__notice') + const confirmSigMessage = await queryAsync($, '.request-signature__notice') assert.ok(confirmSigMessage[0].textContent.match(/^Signing\sthis\smessage/)) let confirmSigRowValue = await queryAsync($, '.request-signature__row-value') diff --git a/test/integration/lib/currency-localization.js b/test/integration/lib/currency-localization.js index 7705c9720..3ad1a23e5 100644 --- a/test/integration/lib/currency-localization.js +++ b/test/integration/lib/currency-localization.js @@ -15,7 +15,7 @@ QUnit.test('renders localized currency', (assert) => { }) }) -async function runCurrencyLocalizationTest(assert, done) { +async function runCurrencyLocalizationTest (assert, done) { console.log('*** start runCurrencyLocalizationTest') const selectState = await queryAsync($, 'select') selectState.val('currency localization') diff --git a/test/integration/lib/mascara-first-time.js b/test/integration/lib/mascara-first-time.js index f43a30c74..8bbdb4410 100644 --- a/test/integration/lib/mascara-first-time.js +++ b/test/integration/lib/mascara-first-time.js @@ -42,7 +42,7 @@ async function runFirstTimeUsageTest (assert, done) { assert.equal(created.textContent, 'Your unique account image', 'unique image screen') // Agree button - let button = (await findAsync(app, 'button'))[0] + const button = (await findAsync(app, 'button'))[0] assert.ok(button, 'button present') button.click() diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index 72e4a8cb1..938356e57 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -54,7 +54,7 @@ async function customizeGas (assert, price, limit, ethFee, usdFee) { ) } -async function runSendFlowTest(assert, done) { +async function runSendFlowTest (assert, done) { console.log('*** start runSendFlowTest') const selectState = await queryAsync($, 'select') selectState.val('send new ui') @@ -87,7 +87,7 @@ async function runSendFlowTest(assert, done) { sendFromFieldItemAddress = await queryAsync($, '.account-list-item__account-name') assert.equal(sendFromFieldItemAddress[0].textContent, 'Send Account 2', 'send from field dropdown changes account name') - let sendToFieldInput = await queryAsync($, '.send-v2__to-autocomplete__input') + const sendToFieldInput = await queryAsync($, '.send-v2__to-autocomplete__input') sendToFieldInput[0].focus() const sendToDropdownList = await queryAsync($, '.send-v2__from-dropdown__list') diff --git a/test/integration/lib/tx-list-items.js b/test/integration/lib/tx-list-items.js index 4856b3852..98d624b5e 100644 --- a/test/integration/lib/tx-list-items.js +++ b/test/integration/lib/tx-list-items.js @@ -15,7 +15,7 @@ QUnit.test('renders list items successfully', (assert) => { }) }) -async function runTxListItemsTest(assert, done) { +async function runTxListItemsTest (assert, done) { console.log('*** start runTxListItemsTest') const selectState = await queryAsync($, 'select') selectState.val('tx list items') -- cgit v1.2.3 From 04743afb2da39f0e553412c2ad69efa8a4b4d2e4 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Mon, 2 Jul 2018 19:52:49 -0400 Subject: fix warnings for integration tests --- test/integration/lib/confirm-sig-requests.js | 5 +---- test/integration/lib/send-new-ui.js | 2 -- test/integration/lib/tx-list-items.js | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) (limited to 'test/integration') diff --git a/test/integration/lib/confirm-sig-requests.js b/test/integration/lib/confirm-sig-requests.js index c6a37eabd..5613c0dcb 100644 --- a/test/integration/lib/confirm-sig-requests.js +++ b/test/integration/lib/confirm-sig-requests.js @@ -1,10 +1,7 @@ const reactTriggerChange = require('react-trigger-change') const { - timeout, queryAsync, - findAsync, } = require('../../lib/util') -const PASSWORD = 'password123' QUnit.module('confirm sig requests') @@ -45,7 +42,7 @@ async function runConfirmSigRequestsTest (assert, done) { assert.equal(confirmSigHeadline[0].textContent, 'Your signature is being requested') confirmSigRowValue = await queryAsync($, '.request-signature__row-value') - assert.ok(confirmSigRowValue[0].textContent.match(/^\#\sTerms\sof\sUse/)) + assert.ok(confirmSigRowValue[0].textContent.match(/^#\sTerms\sof\sUse/)) confirmSigSignButton = await queryAsync($, 'button.btn-primary.btn--large') confirmSigSignButton[0].click() diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index 938356e57..241358135 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -5,8 +5,6 @@ const { findAsync, } = require('../../lib/util') -const PASSWORD = 'password123' - QUnit.module('new ui send flow') QUnit.test('successful send flow', (assert) => { diff --git a/test/integration/lib/tx-list-items.js b/test/integration/lib/tx-list-items.js index 98d624b5e..6b67b1d2e 100644 --- a/test/integration/lib/tx-list-items.js +++ b/test/integration/lib/tx-list-items.js @@ -1,6 +1,5 @@ const reactTriggerChange = require('../../lib/react-trigger-change') const { - timeout, queryAsync, findAsync, } = require('../../lib/util') -- cgit v1.2.3