aboutsummaryrefslogtreecommitdiffstats
path: root/test/integration/lib
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/lib')
-rw-r--r--test/integration/lib/add-token.js140
-rw-r--r--test/integration/lib/currency-localization.js2
-rw-r--r--test/integration/lib/send-new-ui.js22
3 files changed, 12 insertions, 152 deletions
diff --git a/test/integration/lib/add-token.js b/test/integration/lib/add-token.js
deleted file mode 100644
index bb9d0d10f..000000000
--- a/test/integration/lib/add-token.js
+++ /dev/null
@@ -1,140 +0,0 @@
-const reactTriggerChange = require('react-trigger-change')
-const {
- timeout,
- queryAsync,
- findAsync,
-} = require('../../lib/util')
-
-QUnit.module('Add token flow')
-
-QUnit.test('successful add token flow', (assert) => {
- const done = assert.async()
- runAddTokenFlowTest(assert)
- .then(done)
- .catch(err => {
- assert.notOk(err, `Error was thrown: ${err.stack}`)
- done()
- })
-})
-
-async function runAddTokenFlowTest (assert, done) {
- const selectState = await queryAsync($, 'select')
- selectState.val('add token')
- reactTriggerChange(selectState[0])
-
- // Used to set values on TextField input component
- const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
- window.HTMLInputElement.prototype, 'value'
- ).set
-
- // Check that no tokens have been added
- assert.ok($('.token-list-item').length === 0, 'no tokens added')
-
- // Go to Add Token screen
- let addTokenButton = await queryAsync($, 'button.btn-primary.wallet-view__add-token-button')
- assert.ok(addTokenButton[0], 'add token button present')
- addTokenButton[0].click()
-
- // Verify Add Token screen
- let addTokenWrapper = await queryAsync($, '.page-container')
- assert.ok(addTokenWrapper[0], 'add token wrapper renders')
-
- let addTokenTitle = await queryAsync($, '.page-container__title')
- assert.equal(addTokenTitle[0].textContent, 'Add Tokens', 'add token title is correct')
-
- // Cancel Add Token
- const cancelAddTokenButton = await queryAsync($, 'button.btn-default.btn--large.page-container__footer-button')
- assert.ok(cancelAddTokenButton[0], 'cancel add token button present')
- cancelAddTokenButton.click()
-
- assert.ok($('.wallet-view')[0], 'cancelled and returned to account detail wallet view')
-
- // Return to Add Token Screen
- addTokenButton = await queryAsync($, 'button.btn-primary.wallet-view__add-token-button')
- assert.ok(addTokenButton[0], 'add token button present')
- addTokenButton[0].click()
-
- // Verify Add Token Screen
- addTokenWrapper = await queryAsync($, '.page-container')
- addTokenTitle = await queryAsync($, '.page-container__title')
- assert.ok(addTokenWrapper[0], 'add token wrapper renders')
- assert.equal(addTokenTitle[0].textContent, 'Add Tokens', 'add token title is correct')
-
- // Search for token
- const searchInput = (await findAsync(addTokenWrapper, '#search-tokens'))[0]
- searchInput.focus()
- await timeout(1000)
- nativeInputValueSetter.call(searchInput, 'a')
- searchInput.dispatchEvent(new Event('input', { bubbles: true}))
-
- // Click token to add
- const tokenWrapper = await queryAsync($, 'div.token-list__token')
- assert.ok(tokenWrapper[0], 'token found')
- const tokenImageProp = tokenWrapper.find('.token-list__token-icon').css('background-image')
- const tokenImageUrl = tokenImageProp.slice(5, -2)
- tokenWrapper[0].click()
-
- // Click Next button
- const nextButton = await queryAsync($, 'button.btn-primary.btn--large')
- assert.equal(nextButton[0].textContent, 'Next', 'next button rendered')
- nextButton[0].click()
-
- // Confirm Add token
- const confirmAddToken = await queryAsync($, '.confirm-add-token')
- assert.ok(confirmAddToken[0], 'confirm add token rendered')
- assert.ok($('button.btn-primary.btn--large')[0], 'confirm add token button found')
- $('button.btn-primary.btn--large')[0].click()
-
- // Verify added token image
- let heroBalance = await queryAsync($, '.transaction-view-balance__balance-container')
- assert.ok(heroBalance, 'rendered hero balance')
- assert.ok(tokenImageUrl.indexOf(heroBalance.find('img').attr('src')) > -1, 'token added')
-
- // Return to Add Token Screen
- addTokenButton = await queryAsync($, 'button.btn-primary.wallet-view__add-token-button')
- assert.ok(addTokenButton[0], 'add token button present')
- addTokenButton[0].click()
-
- addTokenWrapper = await queryAsync($, '.page-container')
- const addTokenTabs = await queryAsync($, '.page-container__tab')
- assert.equal(addTokenTabs.length, 2, 'expected number of tabs')
- assert.equal(addTokenTabs[1].textContent, 'Custom Token', 'Custom Token tab present')
- assert.ok(addTokenTabs[1], 'add custom token tab present')
- addTokenTabs[1].click()
- await timeout(1000)
-
- // Input token contract address
- const customInput = (await findAsync(addTokenWrapper, '#custom-address'))[0]
- customInput.focus()
- await timeout(1000)
- nativeInputValueSetter.call(customInput, '0x177af043D3A1Aed7cc5f2397C70248Fc6cDC056c')
- customInput.dispatchEvent(new Event('input', { bubbles: true}))
-
-
- // Click Next button
- // nextButton = await queryAsync($, 'button.btn-primary--lg')
- // assert.equal(nextButton[0].textContent, 'Next', 'next button rendered')
- // nextButton[0].click()
-
- // // Verify symbol length error since contract address won't return symbol
- const errorMessage = await queryAsync($, '#custom-symbol-helper-text')
- assert.ok(errorMessage[0], 'error rendered')
-
- $('button.btn-default.btn--large')[0].click()
-
- // await timeout(100000)
-
- // Confirm Add token
- // assert.equal(
- // $('.page-container__subtitle')[0].textContent,
- // 'Would you like to add these tokens?',
- // 'confirm add token rendered'
- // )
- // assert.ok($('button.btn-primary--lg')[0], 'confirm add token button found')
- // $('button.btn-primary--lg')[0].click()
-
- // Verify added token image
- heroBalance = await queryAsync($, '.transaction-view-balance__balance-container')
- assert.ok(heroBalance, 'rendered hero balance')
- assert.ok(heroBalance.find('.identicon')[0], 'token added')
-}
diff --git a/test/integration/lib/currency-localization.js b/test/integration/lib/currency-localization.js
index 8d5acf5d0..f6b751ba2 100644
--- a/test/integration/lib/currency-localization.js
+++ b/test/integration/lib/currency-localization.js
@@ -25,5 +25,5 @@ async function runCurrencyLocalizationTest (assert, done) {
const txView = await queryAsync($, '.transaction-view')
const heroBalance = await findAsync($(txView), '.transaction-view-balance__balance')
const fiatAmount = await findAsync($(heroBalance), '.transaction-view-balance__secondary-balance')
- assert.equal(fiatAmount[0].textContent, '₱102,707.97 PHP')
+ assert.equal(fiatAmount[0].textContent, '₱102,707.97PHP')
}
diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js
index 7f3c114e4..271dd91cf 100644
--- a/test/integration/lib/send-new-ui.js
+++ b/test/integration/lib/send-new-ui.js
@@ -40,7 +40,7 @@ async function customizeGas (assert, price, limit, ethFee, usdFee) {
const sendGasField = await queryAsync($, '.send-v2__gas-fee-display')
assert.equal(
- (await findAsync(sendGasField, '.currency-display__input-wrapper > input')).val(),
+ (await findAsync(sendGasField, '.currency-display-component'))[0].textContent,
ethFee,
'send gas field should show customized gas total'
)
@@ -94,12 +94,12 @@ async function runSendFlowTest (assert, done) {
sendToDropdownList.children()[2].click()
const sendToAccountAddress = sendToFieldInput.val()
- assert.equal(sendToAccountAddress, '0x2f8d4a878cfa04a6e60d46362f5644deab66572d', 'send to dropdown selects the correct address')
+ assert.equal(sendToAccountAddress, '0x2f8D4a878cFA04A6E60D46362f5644DeAb66572D', 'send to dropdown selects the correct address')
const sendAmountField = await queryAsync($, '.send-v2__form-row:eq(2)')
- sendAmountField.find('.currency-display')[0].click()
+ sendAmountField.find('.unit-input')[0].click()
- const sendAmountFieldInput = await findAsync(sendAmountField, '.currency-display__input')
+ const sendAmountFieldInput = await findAsync(sendAmountField, '.unit-input__input')
sendAmountFieldInput.val('5.1')
reactTriggerChange(sendAmountField.find('input')[0])
@@ -112,9 +112,9 @@ 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, '0', '$0.00 USD')
- await customizeGas(assert, 1, 21000, '0.000021', '$0.03 USD')
- await customizeGas(assert, 500, 60000, '0.03', '$36.03 USD')
+ 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')
@@ -130,11 +130,11 @@ async function runSendFlowTest (assert, done) {
const confirmToName = (await queryAsync($, '.sender-to-recipient__name')).last()
assert.equal(confirmToName[0].textContent, 'Send Account 3', 'confirm screen should show correct to name')
- const confirmScreenRowFiats = await queryAsync($, '.confirm-detail-row__fiat')
+ const confirmScreenRowFiats = await queryAsync($, '.confirm-detail-row__secondary')
const confirmScreenGas = confirmScreenRowFiats[0]
assert.equal(confirmScreenGas.textContent, '$3.60', 'confirm screen should show correct gas')
const confirmScreenTotal = confirmScreenRowFiats[1]
- assert.equal(confirmScreenTotal.textContent, '$2,405.36', 'confirm screen should show correct total')
+ assert.equal(confirmScreenTotal.textContent, '$2,405.37', 'confirm screen should show correct total')
const confirmScreenBackButton = await queryAsync($, '.confirm-page-container-header__back-button')
confirmScreenBackButton[0].click()
@@ -150,9 +150,9 @@ async function runSendFlowTest (assert, done) {
sendToFieldInputInEdit.val('0xd85a4b6a394794842887b8284293d69163007bbb')
const sendAmountFieldInEdit = await queryAsync($, '.send-v2__form-row:eq(2)')
- sendAmountFieldInEdit.find('.currency-display')[0].click()
+ sendAmountFieldInEdit.find('.unit-input')[0].click()
- const sendAmountFieldInputInEdit = sendAmountFieldInEdit.find('.currency-display__input')
+ const sendAmountFieldInputInEdit = sendAmountFieldInEdit.find('.unit-input__input')
sendAmountFieldInputInEdit.val('1.0')
reactTriggerChange(sendAmountFieldInputInEdit[0])