aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@gmail.com>2018-08-24 10:19:48 +0800
committerAlexander Tseung <alextsg@gmail.com>2018-08-24 10:19:48 +0800
commitc0e97d17393c9ce5024af8626c1bafc5d5b4efe4 (patch)
treedbe6a7883f5851aaef0229674296eeadd34b4bcb
parent342522c6cf23670f931e69ba822eedfd2d6ee252 (diff)
downloadtangerine-wallet-browser-c0e97d17393c9ce5024af8626c1bafc5d5b4efe4.tar
tangerine-wallet-browser-c0e97d17393c9ce5024af8626c1bafc5d5b4efe4.tar.gz
tangerine-wallet-browser-c0e97d17393c9ce5024af8626c1bafc5d5b4efe4.tar.bz2
tangerine-wallet-browser-c0e97d17393c9ce5024af8626c1bafc5d5b4efe4.tar.lz
tangerine-wallet-browser-c0e97d17393c9ce5024af8626c1bafc5d5b4efe4.tar.xz
tangerine-wallet-browser-c0e97d17393c9ce5024af8626c1bafc5d5b4efe4.tar.zst
tangerine-wallet-browser-c0e97d17393c9ce5024af8626c1bafc5d5b4efe4.zip
Fix tests
-rw-r--r--test/e2e/beta/metamask-beta-ui.spec.js8
-rw-r--r--test/integration/lib/add-token.js4
-rw-r--r--test/integration/lib/currency-localization.js6
-rw-r--r--test/integration/lib/send-new-ui.js2
-rw-r--r--test/integration/lib/tx-list-items.js6
-rw-r--r--ui/app/components/transaction-action/tests/transaction-action.component.test.js14
6 files changed, 25 insertions, 15 deletions
diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js
index d427318ce..c9f759780 100644
--- a/test/e2e/beta/metamask-beta-ui.spec.js
+++ b/test/e2e/beta/metamask-beta-ui.spec.js
@@ -602,7 +602,7 @@ describe('MetaMask', function () {
})
it('renders the correct ETH balance', async () => {
- const balance = await findElement(driver, By.css('.token-view-balance__primary-balance'))
+ const balance = await findElement(driver, By.css('.transaction-view-balance__primary-balance'))
await delay(regularDelayMs)
if (process.env.SELENIUM_BROWSER !== 'firefox') {
await driver.wait(until.elementTextMatches(balance, /^92.*ETH.*$/), 10000)
@@ -675,7 +675,7 @@ describe('MetaMask', function () {
})
it('renders the balance for the new token', async () => {
- const balance = await findElement(driver, By.css('.token-view-balance .token-view-balance__token-balance'))
+ const balance = await findElement(driver, By.css('.transaction-view-balance .transaction-view-balance__token-balance'))
await driver.wait(until.elementTextMatches(balance, /^100\s*TST\s*$/))
const tokenAmount = await balance.getText()
assert.ok(/^100\s*TST\s*$/.test(tokenAmount))
@@ -854,7 +854,7 @@ describe('MetaMask', function () {
// test cancelled on firefox until https://github.com/mozilla/geckodriver/issues/906 is resolved,
// or possibly until we use latest version of firefox in the tests
if (process.env.SELENIUM_BROWSER !== 'firefox') {
- const tokenBalanceAmount = await findElement(driver, By.css('.token-view-balance__token-balance'))
+ const tokenBalanceAmount = await findElement(driver, By.css('.transaction-view-balance__token-balance'))
assert.equal(await tokenBalanceAmount.getText(), '43 TST')
}
})
@@ -1015,7 +1015,7 @@ describe('MetaMask', function () {
})
it('renders the balance for the chosen token', async () => {
- const balance = await findElement(driver, By.css('.token-view-balance__token-balance'))
+ const balance = await findElement(driver, By.css('.transaction-view-balance__token-balance'))
await driver.wait(until.elementTextMatches(balance, /0\sBAT/))
await delay(regularDelayMs)
})
diff --git a/test/integration/lib/add-token.js b/test/integration/lib/add-token.js
index 6e85b3631..bb9d0d10f 100644
--- a/test/integration/lib/add-token.js
+++ b/test/integration/lib/add-token.js
@@ -86,7 +86,7 @@ async function runAddTokenFlowTest (assert, done) {
$('button.btn-primary.btn--large')[0].click()
// Verify added token image
- let heroBalance = await queryAsync($, '.token-view-balance__balance-container')
+ 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')
@@ -134,7 +134,7 @@ async function runAddTokenFlowTest (assert, done) {
// $('button.btn-primary--lg')[0].click()
// Verify added token image
- heroBalance = await queryAsync($, '.token-view-balance__balance-container')
+ 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 eee354276..8d5acf5d0 100644
--- a/test/integration/lib/currency-localization.js
+++ b/test/integration/lib/currency-localization.js
@@ -22,8 +22,8 @@ async function runCurrencyLocalizationTest (assert, done) {
await timeout(1000)
reactTriggerChange(selectState[0])
await timeout(1000)
- const txView = await queryAsync($, '.token-view')
- const heroBalance = await findAsync($(txView), '.token-view-balance__balance')
- const fiatAmount = await findAsync($(heroBalance), '.token-view-balance__secondary-balance')
+ 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')
}
diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js
index 177c9817d..7f3c114e4 100644
--- a/test/integration/lib/send-new-ui.js
+++ b/test/integration/lib/send-new-ui.js
@@ -58,7 +58,7 @@ async function runSendFlowTest (assert, done) {
selectState.val('send new ui')
reactTriggerChange(selectState[0])
- const sendScreenButton = await queryAsync($, 'button.btn-primary.token-view-balance__button')
+ const sendScreenButton = await queryAsync($, 'button.btn-primary.transaction-view-balance__button')
assert.ok(sendScreenButton[1], 'send screen button present')
sendScreenButton[1].click()
diff --git a/test/integration/lib/tx-list-items.js b/test/integration/lib/tx-list-items.js
index 732e14577..a29a668ca 100644
--- a/test/integration/lib/tx-list-items.js
+++ b/test/integration/lib/tx-list-items.js
@@ -46,7 +46,7 @@ async function runTxListItemsTest (assert, done) {
const failedTx = txListItems[4]
const failedTxRenderedStatus = await findAsync($(failedTx), '.transaction-list-item__status')
- assert.equal(failedTxRenderedStatus[0].textContent, 'failed', 'failedTx has correct label')
+ assert.equal(failedTxRenderedStatus[0].textContent, 'Failed', 'failedTx has correct label')
const shapeShiftTx = txListItems[5]
const shapeShiftTxStatus = await findAsync($(shapeShiftTx), '.flex-column div:eq(1)')
@@ -54,9 +54,9 @@ async function runTxListItemsTest (assert, done) {
const confirmedTokenTx = txListItems[6]
const confirmedTokenTxAddress = await findAsync($(confirmedTokenTx), '.transaction-list-item__status')
- assert.equal(confirmedTokenTxAddress[0].textContent, 'confirmed', 'confirmedTokenTx has correct address')
+ assert.equal(confirmedTokenTxAddress[0].textContent, 'Confirmed', 'confirmedTokenTx has correct address')
const rejectedTx = txListItems[7]
const rejectedTxRenderedStatus = await findAsync($(rejectedTx), '.transaction-list-item__status')
- assert.equal(rejectedTxRenderedStatus[0].textContent, 'rejected', 'rejectedTx has correct label')
+ assert.equal(rejectedTxRenderedStatus[0].textContent, 'Rejected', 'rejectedTx has correct label')
}
diff --git a/ui/app/components/transaction-action/tests/transaction-action.component.test.js b/ui/app/components/transaction-action/tests/transaction-action.component.test.js
index 158bc8dc4..218792847 100644
--- a/ui/app/components/transaction-action/tests/transaction-action.component.test.js
+++ b/ui/app/components/transaction-action/tests/transaction-action.component.test.js
@@ -1,10 +1,18 @@
import React from 'react'
import assert from 'assert'
import { shallow } from 'enzyme'
+import sinon from 'sinon'
import TransactionAction from '../transaction-action.component'
describe('TransactionAction Component', () => {
const tOrDefault = key => key
+ global.eth = {
+ getCode: sinon.stub().callsFake(address => {
+ console.log('CALLED')
+ const code = address === 'approveAddress' ? 'contract' : '0x'
+ return Promise.resolve(code)
+ }),
+ }
describe('Outgoing transaction', () => {
it('should render -- when methodData is still fetching', () => {
@@ -46,7 +54,7 @@ describe('TransactionAction Component', () => {
gas: '0x5208',
gasPrice: '0x3b9aca00',
nonce: '0x96',
- to: '0x50a9d56c2b8ba9a5c7f2c08c3d26e0499f23a706',
+ to: 'sentEtherAddress',
value: '0x2386f26fc10000',
},
}
@@ -58,6 +66,7 @@ describe('TransactionAction Component', () => {
/>, { context: { tOrDefault }})
assert.equal(wrapper.find('.transaction-action').length, 1)
+ wrapper.setState({ transactionAction: 'sentEther' })
assert.equal(wrapper.text(), 'sentEther')
})
@@ -83,7 +92,7 @@ describe('TransactionAction Component', () => {
gas: '0x5208',
gasPrice: '0x3b9aca00',
nonce: '0x96',
- to: '0x50a9d56c2b8ba9a5c7f2c08c3d26e0499f23a706',
+ to: 'approveAddress',
value: '0x2386f26fc10000',
data: '0x095ea7b300000000000000000000000050a9d56c2b8ba9a5c7f2c08c3d26e0499f23a7060000000000000000000000000000000000000000000000000000000000000003',
},
@@ -96,6 +105,7 @@ describe('TransactionAction Component', () => {
/>, { context: { tOrDefault }})
assert.equal(wrapper.find('.transaction-action').length, 1)
+ wrapper.setState({ transactionAction: 'approve' })
assert.equal(wrapper.text(), 'approve')
})
})