diff options
Merge branch 'i3725-refactor-send-component-' into i3725-refactor-send-component-2
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/index.js | 3 | ||||
-rw-r--r-- | test/integration/lib/confirm-sig-requests.js | 18 | ||||
-rw-r--r-- | test/integration/lib/currency-localization.js | 28 | ||||
-rw-r--r-- | test/integration/lib/mascara-first-time.js | 3 | ||||
-rw-r--r-- | test/integration/lib/send-new-ui.js | 38 | ||||
-rw-r--r-- | test/integration/lib/tx-list-items.js | 2 |
6 files changed, 71 insertions, 21 deletions
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() diff --git a/test/integration/lib/confirm-sig-requests.js b/test/integration/lib/confirm-sig-requests.js index f1116d1a6..3936ac5fa 100644 --- a/test/integration/lib/confirm-sig-requests.js +++ b/test/integration/lib/confirm-sig-requests.js @@ -21,11 +21,22 @@ async function runConfirmSigRequestsTest(assert, done) { selectState.val('confirm sig requests') reactTriggerChange(selectState[0]) + // await timeout(1000000) + + const pendingRequestItem = $.find('.tx-list-item.tx-list-pending-item-container.tx-list-clickable') + + if (pendingRequestItem[0]) { + pendingRequestItem[0].click() + } + let confirmSigHeadline = await queryAsync($, '.request-signature__headline') assert.equal(confirmSigHeadline[0].textContent, 'Your signature is being requested') + let confirmSigMessage = await queryAsync($, '.request-signature__notice') + assert.ok(confirmSigMessage[0].textContent.match(/^Signing\sthis\smessage/)) + let confirmSigRowValue = await queryAsync($, '.request-signature__row-value') - assert.ok(confirmSigRowValue[0].textContent.match(/^\#\sTerms\sof\sUse/)) + assert.equal(confirmSigRowValue[0].textContent, '0x879a053d4800c6354e76c7985a865d2922c82fb5b3f4577b2fe08b998954f2e0') let confirmSigSignButton = await queryAsync($, 'button.btn-primary--lg') confirmSigSignButton[0].click() @@ -33,11 +44,8 @@ async function runConfirmSigRequestsTest(assert, done) { confirmSigHeadline = await queryAsync($, '.request-signature__headline') assert.equal(confirmSigHeadline[0].textContent, 'Your signature is being requested') - let confirmSigMessage = await queryAsync($, '.request-signature__notice') - assert.ok(confirmSigMessage[0].textContent.match(/^Signing\sthis\smessage/)) - confirmSigRowValue = await queryAsync($, '.request-signature__row-value') - assert.equal(confirmSigRowValue[0].textContent, '0x879a053d4800c6354e76c7985a865d2922c82fb5b3f4577b2fe08b998954f2e0') + assert.ok(confirmSigRowValue[0].textContent.match(/^\#\sTerms\sof\sUse/)) confirmSigSignButton = await queryAsync($, 'button.btn-primary--lg') confirmSigSignButton[0].click() diff --git a/test/integration/lib/currency-localization.js b/test/integration/lib/currency-localization.js new file mode 100644 index 000000000..7705c9720 --- /dev/null +++ b/test/integration/lib/currency-localization.js @@ -0,0 +1,28 @@ +const reactTriggerChange = require('../../lib/react-trigger-change') +const { + timeout, + queryAsync, + findAsync, +} = require('../../lib/util') + +QUnit.module('currency localization') + +QUnit.test('renders localized currency', (assert) => { + const done = assert.async() + runCurrencyLocalizationTest(assert).then(done).catch((err) => { + assert.notOk(err, `Error was thrown: ${err.stack}`) + done() + }) +}) + +async function runCurrencyLocalizationTest(assert, done) { + console.log('*** start runCurrencyLocalizationTest') + const selectState = await queryAsync($, 'select') + selectState.val('currency localization') + reactTriggerChange(selectState[0]) + await timeout(1000) + const txView = await queryAsync($, '.tx-view') + const heroBalance = await findAsync($(txView), '.hero-balance') + const fiatAmount = await findAsync($(heroBalance), '.fiat-amount') + assert.equal(fiatAmount[0].textContent, '₱102,707.97') +} diff --git a/test/integration/lib/mascara-first-time.js b/test/integration/lib/mascara-first-time.js index 564852585..5e07ab0b4 100644 --- a/test/integration/lib/mascara-first-time.js +++ b/test/integration/lib/mascara-first-time.js @@ -13,6 +13,9 @@ async function runFirstTimeUsageTest (assert, done) { await skipNotices(app) + const welcomeButton = (await findAsync(app, '.welcome-screen__button'))[0] + welcomeButton.click() + // Scroll through terms const title = (await findAsync(app, '.create-password__title')).text() assert.equal(title, 'Create Password', 'create password screen') diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index 163f3658c..09a074750 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -53,7 +53,7 @@ async function runSendFlowTest(assert, done) { assert.equal(sendFromDropdownList.children().length, 4, 'send from dropdown shows all accounts') sendFromDropdownList.children()[1].click() - sendFromFieldItemAddress = await queryAsync($, '.account-list-item__account-name') + 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') @@ -91,7 +91,7 @@ async function runSendFlowTest(assert, done) { ) assert.equal( sendGasField.find('.currency-display__converted-value')[0].textContent, - '0.24 USD', + '$0.24 USD', 'send gas field should show estimated gas total converted to USD' ) @@ -118,7 +118,7 @@ async function runSendFlowTest(assert, done) { ) assert.equal( (await findAsync(sendGasField, '.currency-display__converted-value'))[0].textContent, - '3.60 USD', + '$3.60 USD', 'send gas field should show customized gas total converted to USD' ) @@ -138,9 +138,9 @@ async function runSendFlowTest(assert, done) { const confirmScreenRows = await queryAsync($, '.confirm-screen-rows') const confirmScreenGas = confirmScreenRows.find('.currency-display__converted-value')[0] - assert.equal(confirmScreenGas.textContent, '3.60 USD', 'confirm screen should show correct gas') + assert.equal(confirmScreenGas.textContent, '$3.60 USD', 'confirm screen should show correct gas') const confirmScreenTotal = confirmScreenRows.find('.confirm-screen-row-info')[2] - assert.equal(confirmScreenTotal.textContent, '2405.36 USD', 'confirm screen should show correct total') + assert.equal(confirmScreenTotal.textContent, '$2,405.36 USD', 'confirm screen should show correct total') const confirmScreenBackButton = await queryAsync($, '.page-container__back-button') confirmScreenBackButton[0].click() @@ -164,17 +164,27 @@ async function runSendFlowTest(assert, done) { const sendButtonInEdit = await queryAsync($, '.btn-primary--lg.page-container__footer-button') assert.equal(sendButtonInEdit[0].textContent, 'Next', 'next button in edit rendered') - sendButtonInEdit[0].click() - // TODO: Need a way to mock background so that we can test correct transition from editing to confirm - selectState.val('confirm new ui') + selectState.val('send new ui') reactTriggerChange(selectState[0]) - const confirmScreenConfirmButton = await queryAsync($, '.btn-confirm.page-container__footer-button') - console.log(`+++++++++++++++++++++++++++++++= confirmScreenConfirmButton[0]`, confirmScreenConfirmButton[0]); - confirmScreenConfirmButton[0].click() - const txView = await queryAsync($, '.tx-view') - console.log(`++++++++++++++++++++++++++++++++ txView[0]`, txView[0]); + const cancelButtonInEdit = await queryAsync($, '.btn-secondary--lg.page-container__footer-button') + cancelButtonInEdit[0].click() + // sendButtonInEdit[0].click() + + // // TODO: Need a way to mock background so that we can test correct transition from editing to confirm + // selectState.val('confirm new ui') + // reactTriggerChange(selectState[0]) + + + // const confirmScreenConfirmButton = await queryAsync($, '.btn-confirm.page-container__footer-button') + // console.log(`+++++++++++++++++++++++++++++++= confirmScreenConfirmButton[0]`, confirmScreenConfirmButton[0]); + // confirmScreenConfirmButton[0].click() + + // await timeout(10000000) + + // const txView = await queryAsync($, '.tx-view') + // console.log(`++++++++++++++++++++++++++++++++ txView[0]`, txView[0]); - assert.ok(txView[0], 'Should return to the account details screen after confirming') + // assert.ok(txView[0], 'Should return to the account details screen after confirming') } diff --git a/test/integration/lib/tx-list-items.js b/test/integration/lib/tx-list-items.js index d0056eb94..0c0c5a77f 100644 --- a/test/integration/lib/tx-list-items.js +++ b/test/integration/lib/tx-list-items.js @@ -53,7 +53,7 @@ async function runTxListItemsTest(assert, done) { const confirmedTokenTx = txListItems[6] const confirmedTokenTxAddress = await findAsync($(confirmedTokenTx), '.tx-list-account') - assert.equal(confirmedTokenTxAddress[0].textContent, '0xe7884118...81a9', 'confirmedTokenTx has correct address') + assert.equal(confirmedTokenTxAddress[0].textContent, '0xE7884118...81a9', 'confirmedTokenTx has correct address') const rejectedTx = txListItems[7] const rejectedTxRenderedStatus = await findAsync($(rejectedTx), '.tx-list-status') |