diff options
Merge branch 'master' into i18n-translator-redux
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/lib/add-token.js | 17 | ||||
-rw-r--r-- | test/integration/lib/mascara-first-time.js | 6 | ||||
-rw-r--r-- | test/integration/lib/send-new-ui.js | 1 | ||||
-rw-r--r-- | test/unit/migrations/022-test.js | 32 |
4 files changed, 45 insertions, 11 deletions
diff --git a/test/integration/lib/add-token.js b/test/integration/lib/add-token.js index 228192e7b..cc04beb21 100644 --- a/test/integration/lib/add-token.js +++ b/test/integration/lib/add-token.js @@ -34,8 +34,8 @@ async function runAddTokenFlowTest (assert, done) { let addTokenWrapper = await queryAsync($, '.add-token__wrapper') assert.ok(addTokenWrapper[0], 'add token wrapper renders') - let addTokenTitle = await queryAsync($, '.add-token__title') - assert.equal(addTokenTitle[0].textContent, 'Add Token', 'add token title is correct') + let addTokenTitle = await queryAsync($, '.add-token__header__title') + assert.equal(addTokenTitle[0].textContent, 'Add Tokens', 'add token title is correct') // Cancel Add Token const cancelAddTokenButton = await queryAsync($, 'button.btn-secondary--lg.add-token__cancel-button') @@ -51,9 +51,9 @@ async function runAddTokenFlowTest (assert, done) { // Verify Add Token Screen addTokenWrapper = await queryAsync($, '.add-token__wrapper') - addTokenTitle = await queryAsync($, '.add-token__title') + addTokenTitle = await queryAsync($, '.add-token__header__title') assert.ok(addTokenWrapper[0], 'add token wrapper renders') - assert.equal(addTokenTitle[0].textContent, 'Add Token', 'add token title is correct') + assert.equal(addTokenTitle[0].textContent, 'Add Tokens', 'add token title is correct') // Search for token const searchInput = await queryAsync($, 'input.add-token__input') @@ -91,9 +91,11 @@ async function runAddTokenFlowTest (assert, done) { assert.ok(addTokenButton[0], 'add token button present') addTokenButton[0].click() - const addCustom = await queryAsync($, '.add-token__add-custom') - assert.ok(addCustom[0], 'add custom token button present') - addCustom[0].click() + const addTokenTabs = await queryAsync($, '.add-token__header__tabs__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() // Input token contract address const customInput = await queryAsync($, 'input.add-token__add-custom-input') @@ -108,6 +110,7 @@ async function runAddTokenFlowTest (assert, done) { // Verify symbol length error since contract address won't return symbol const errorMessage = await queryAsync($, '.add-token__add-custom-error-message') assert.ok(errorMessage[0], 'error rendered') + $('button.btn-secondary--lg')[0].click() // // Confirm Add token diff --git a/test/integration/lib/mascara-first-time.js b/test/integration/lib/mascara-first-time.js index bcbc94ff6..564852585 100644 --- a/test/integration/lib/mascara-first-time.js +++ b/test/integration/lib/mascara-first-time.js @@ -57,9 +57,9 @@ async function runFirstTimeUsageTest (assert, done) { ;(await findAsync(app, '.first-time-flow__button')).click() // Deposit Ether Screen - const buyEthTitle = (await findAsync(app, '.buy-ether__title'))[0] - assert.equal(buyEthTitle.textContent, 'Deposit Ether', 'deposit ether screen') - ;(await findAsync(app, '.buy-ether__do-it-later')).click() + const depositEthTitle = (await findAsync(app, '.page-container__title'))[0] + assert.equal(depositEthTitle.textContent, 'Deposit Ether', 'deposit ether screen') + ;(await findAsync(app, '.page-container__header-close')).click() const menu = (await findAsync(app, '.account-menu__icon'))[0] menu.click() diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index 7bd9a7a65..163f3658c 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -129,7 +129,6 @@ async function runSendFlowTest(assert, done) { selectState.val('send edit') reactTriggerChange(selectState[0]) - await timeout(10000) const confirmFromName = (await queryAsync($, '.sender-to-recipient__sender-name')).first() assert.equal(confirmFromName[0].textContent, 'Send Account 2', 'confirm screen should show correct from name') diff --git a/test/unit/migrations/022-test.js b/test/unit/migrations/022-test.js new file mode 100644 index 000000000..1333d929d --- /dev/null +++ b/test/unit/migrations/022-test.js @@ -0,0 +1,32 @@ +const assert = require('assert') +const migration22 = require('../../../app/scripts/migrations/022') +const properTime = (new Date()).getTime() +const storage = { + "meta": {}, + "data": { + "TransactionController": { + "transactions": [ + { "status": "submitted" }, + { "status": "submitted", "submittedTime": properTime }, + {"status": "confirmed"}, + ] + }, + }, +} + +describe('storage is migrated successfully where transactions that are submitted have submittedTimes', () => { + it('should add submittedTime key on the txMeta if appropriate', (done) => { + migration22.migrate(storage) + .then((migratedData) => { + const [txMeta1, txMeta2, txMeta3] = migratedData.data.TransactionController.transactions + assert.equal(migratedData.meta.version, 22) + // should have written a submitted time + assert(txMeta1.submittedTime) + // should not have written a submitted time because it already has one + assert.equal(txMeta2.submittedTime, properTime) + // should not have written a submitted time + assert(!txMeta3.submittedTime) + done() + }).catch(done) + }) +}) |