aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorThomas Huang <tmashuang@users.noreply.github.com>2018-03-28 04:28:58 +0800
committerGitHub <noreply@github.com>2018-03-28 04:28:58 +0800
commit8648aee907bb67e4a0e80ee6f67562046f302ef5 (patch)
treefa24bed0df96260e0271f93d3f99977613e6a566 /test
parent775275e1387c140fabb3ddbef5544af0dcbc4df0 (diff)
parent0fe0d8b7a5ec3a143ece38df4d0811b6de02b63f (diff)
downloadtangerine-wallet-browser-8648aee907bb67e4a0e80ee6f67562046f302ef5.tar
tangerine-wallet-browser-8648aee907bb67e4a0e80ee6f67562046f302ef5.tar.gz
tangerine-wallet-browser-8648aee907bb67e4a0e80ee6f67562046f302ef5.tar.bz2
tangerine-wallet-browser-8648aee907bb67e4a0e80ee6f67562046f302ef5.tar.lz
tangerine-wallet-browser-8648aee907bb67e4a0e80ee6f67562046f302ef5.tar.xz
tangerine-wallet-browser-8648aee907bb67e4a0e80ee6f67562046f302ef5.tar.zst
tangerine-wallet-browser-8648aee907bb67e4a0e80ee6f67562046f302ef5.zip
Merge branch 'master' into selenium-e2e
Diffstat (limited to 'test')
-rw-r--r--test/integration/lib/add-token.js39
-rw-r--r--test/integration/lib/confirm-sig-requests.js6
-rw-r--r--test/integration/lib/mascara-first-time.js6
-rw-r--r--test/integration/lib/send-new-ui.js8
-rw-r--r--test/unit/migrations/022-test.js32
5 files changed, 64 insertions, 27 deletions
diff --git a/test/integration/lib/add-token.js b/test/integration/lib/add-token.js
index 42ed28dca..cc04beb21 100644
--- a/test/integration/lib/add-token.js
+++ b/test/integration/lib/add-token.js
@@ -26,7 +26,7 @@ async function runAddTokenFlowTest (assert, done) {
assert.ok($('.token-list-item').length === 0, 'no tokens added')
// Go to Add Token screen
- let addTokenButton = await queryAsync($, 'button.btn-clear.wallet-view__add-token-button')
+ let addTokenButton = await queryAsync($, 'button.btn-primary.wallet-view__add-token-button')
assert.ok(addTokenButton[0], 'add token button present')
addTokenButton[0].click()
@@ -34,26 +34,26 @@ 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-cancel.add-token__button')
+ const cancelAddTokenButton = await queryAsync($, 'button.btn-secondary--lg.add-token__cancel-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-clear.wallet-view__add-token-button')
+ 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($, '.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')
@@ -68,7 +68,7 @@ async function runAddTokenFlowTest (assert, done) {
tokenWrapper[0].click()
// Click Next button
- let nextButton = await queryAsync($, 'button.btn-clear.add-token__button')
+ let nextButton = await queryAsync($, 'button.btn-primary--lg')
assert.equal(nextButton[0].textContent, 'Next', 'next button rendered')
nextButton[0].click()
@@ -78,8 +78,8 @@ async function runAddTokenFlowTest (assert, done) {
'Would you like to add these tokens?',
'confirm add token rendered'
)
- assert.ok($('button.btn-clear.add-token__button')[0], 'confirm add token button found')
- $('button.btn-clear.add-token__button')[0].click()
+ assert.ok($('button.btn-primary--lg')[0], 'confirm add token button found')
+ $('button.btn-primary--lg')[0].click()
// Verify added token image
let heroBalance = await queryAsync($, '.hero-balance')
@@ -87,13 +87,15 @@ async function runAddTokenFlowTest (assert, done) {
assert.ok(tokenImageUrl.indexOf(heroBalance.find('img').attr('src')) > -1, 'token added')
// Return to Add Token Screen
- addTokenButton = await queryAsync($, 'button.btn-clear.wallet-view__add-token-button')
+ addTokenButton = await queryAsync($, 'button.btn-primary.wallet-view__add-token-button')
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')
@@ -101,14 +103,15 @@ async function runAddTokenFlowTest (assert, done) {
reactTriggerChange(customInput[0])
// Click Next button
- nextButton = await queryAsync($, 'button.btn-clear.add-token__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($, '.add-token__add-custom-error-message')
assert.ok(errorMessage[0], 'error rendered')
- $('button.btn-cancel.add-token__button')[0].click()
+
+ $('button.btn-secondary--lg')[0].click()
// // Confirm Add token
// assert.equal(
@@ -116,8 +119,8 @@ async function runAddTokenFlowTest (assert, done) {
// 'Would you like to add these tokens?',
// 'confirm add token rendered'
// )
- // assert.ok($('button.btn-clear.add-token__button')[0], 'confirm add token button found')
- // $('button.btn-clear.add-token__button')[0].click()
+ // 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($, '.hero-balance')
diff --git a/test/integration/lib/confirm-sig-requests.js b/test/integration/lib/confirm-sig-requests.js
index 9737a2283..f1116d1a6 100644
--- a/test/integration/lib/confirm-sig-requests.js
+++ b/test/integration/lib/confirm-sig-requests.js
@@ -27,7 +27,7 @@ async function runConfirmSigRequestsTest(assert, done) {
let confirmSigRowValue = await queryAsync($, '.request-signature__row-value')
assert.ok(confirmSigRowValue[0].textContent.match(/^\#\sTerms\sof\sUse/))
- let confirmSigSignButton = await queryAsync($, '.request-signature__footer__sign-button')
+ let confirmSigSignButton = await queryAsync($, 'button.btn-primary--lg')
confirmSigSignButton[0].click()
confirmSigHeadline = await queryAsync($, '.request-signature__headline')
@@ -39,7 +39,7 @@ async function runConfirmSigRequestsTest(assert, done) {
confirmSigRowValue = await queryAsync($, '.request-signature__row-value')
assert.equal(confirmSigRowValue[0].textContent, '0x879a053d4800c6354e76c7985a865d2922c82fb5b3f4577b2fe08b998954f2e0')
- confirmSigSignButton = await queryAsync($, '.request-signature__footer__sign-button')
+ confirmSigSignButton = await queryAsync($, 'button.btn-primary--lg')
confirmSigSignButton[0].click()
confirmSigHeadline = await queryAsync($, '.request-signature__headline')
@@ -49,7 +49,7 @@ async function runConfirmSigRequestsTest(assert, done) {
assert.equal(confirmSigRowValue[0].textContent, 'Hi, Alice!')
assert.equal(confirmSigRowValue[1].textContent, '1337')
- confirmSigSignButton = await queryAsync($, '.request-signature__footer__sign-button')
+ confirmSigSignButton = await queryAsync($, 'button.btn-primary--lg')
confirmSigSignButton[0].click()
const txView = await queryAsync($, '.tx-view')
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 3fc7c79f8..163f3658c 100644
--- a/test/integration/lib/send-new-ui.js
+++ b/test/integration/lib/send-new-ui.js
@@ -21,13 +21,15 @@ global.ethQuery = {
sendTransaction: () => {},
}
+global.ethereumProvider = {}
+
async function runSendFlowTest(assert, done) {
console.log('*** start runSendFlowTest')
const selectState = await queryAsync($, 'select')
selectState.val('send new ui')
reactTriggerChange(selectState[0])
- const sendScreenButton = await queryAsync($, 'button.btn-clear.hero-balance-button')
+ const sendScreenButton = await queryAsync($, 'button.btn-primary.hero-balance-button')
assert.ok(sendScreenButton[1], 'send screen button present')
sendScreenButton[1].click()
@@ -120,7 +122,7 @@ async function runSendFlowTest(assert, done) {
'send gas field should show customized gas total converted to USD'
)
- const sendButton = await queryAsync($, 'button.btn-clear.page-container__footer-button')
+ const sendButton = await queryAsync($, 'button.btn-primary--lg.page-container__footer-button')
assert.equal(sendButton[0].textContent, 'Next', 'next button rendered')
sendButton[0].click()
await timeout()
@@ -160,7 +162,7 @@ async function runSendFlowTest(assert, done) {
sendAmountFieldInputInEdit.val('1.0')
reactTriggerChange(sendAmountFieldInputInEdit[0])
- const sendButtonInEdit = await queryAsync($, '.btn-clear.page-container__footer-button')
+ 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()
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)
+ })
+})