aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-10-30 08:25:05 +0800
committerkumavis <aaron@kumavis.me>2018-10-30 08:25:05 +0800
commitccbc2332829569b6bb416ced624ee3123c54b939 (patch)
treeb865d8b499a00921b4b38f2839dfc6c631aa4666 /test
parentf0602ca354a6d352c13a79a1cba884f54e5b9a83 (diff)
parent1bb4a8428c73c1f1137793b25900db159eec3fa8 (diff)
downloadtangerine-wallet-browser-ccbc2332829569b6bb416ced624ee3123c54b939.tar
tangerine-wallet-browser-ccbc2332829569b6bb416ced624ee3123c54b939.tar.gz
tangerine-wallet-browser-ccbc2332829569b6bb416ced624ee3123c54b939.tar.bz2
tangerine-wallet-browser-ccbc2332829569b6bb416ced624ee3123c54b939.tar.lz
tangerine-wallet-browser-ccbc2332829569b6bb416ced624ee3123c54b939.tar.xz
tangerine-wallet-browser-ccbc2332829569b6bb416ced624ee3123c54b939.tar.zst
tangerine-wallet-browser-ccbc2332829569b6bb416ced624ee3123c54b939.zip
Merge branch 'develop' of github.com:MetaMask/metamask-extension into sentry-enhancements2
Diffstat (limited to 'test')
-rw-r--r--test/data/mock-state.json4
-rw-r--r--test/e2e/beta/from-import-beta-ui.spec.js2
-rw-r--r--test/e2e/beta/metamask-beta-ui.spec.js28
-rwxr-xr-xtest/e2e/beta/run-drizzle.sh2
-rw-r--r--test/integration/lib/currency-localization.js2
-rw-r--r--test/integration/lib/send-new-ui.js6
-rw-r--r--test/unit/app/controllers/network-contoller-test.js2
-rw-r--r--test/unit/app/controllers/preferences-controller-test.js21
-rw-r--r--test/unit/ui/app/actions.spec.js2
-rw-r--r--test/unit/ui/app/components/identicon.spec.js36
10 files changed, 38 insertions, 67 deletions
diff --git a/test/data/mock-state.json b/test/data/mock-state.json
index 7e083c60e..8deff5531 100644
--- a/test/data/mock-state.json
+++ b/test/data/mock-state.json
@@ -111,7 +111,9 @@
"0x108cf70c7d384c552f42c07c41c0e1e46d77ea0d": 0.00039345803819379796,
"0xd8f6a2ffb0fc5952d16c9768b71cfd35b6399aa5": 0.00008189274407698049
},
+ "ticker": "ETH",
"currentCurrency": "usd",
+ "nativeCurrency": "ETH",
"conversionRate": 556.12,
"addressBook": [
{
@@ -1248,4 +1250,4 @@
"context": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
}
}
-} \ No newline at end of file
+}
diff --git a/test/e2e/beta/from-import-beta-ui.spec.js b/test/e2e/beta/from-import-beta-ui.spec.js
index b782a1c40..d2c3f8958 100644
--- a/test/e2e/beta/from-import-beta-ui.spec.js
+++ b/test/e2e/beta/from-import-beta-ui.spec.js
@@ -319,7 +319,7 @@ describe('Using MetaMask with an existing account', function () {
const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
assert.equal(txValues.length, 1)
- assert.equal(await txValues[0].getText(), '-1 ETH')
+ assert.ok(/-1\s*ETH/.test(await txValues[0].getText()))
})
})
diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js
index f29f242c1..eaa7d18cd 100644
--- a/test/e2e/beta/metamask-beta-ui.spec.js
+++ b/test/e2e/beta/metamask-beta-ui.spec.js
@@ -371,7 +371,7 @@ describe('MetaMask', function () {
it('balance renders', async () => {
const balance = await findElement(driver, By.css('.balance-display .token-amount'))
- await driver.wait(until.elementTextMatches(balance, /100.+ETH/))
+ await driver.wait(until.elementTextMatches(balance, /100\s*ETH/))
await delay(regularDelayMs)
})
})
@@ -420,7 +420,7 @@ describe('MetaMask', function () {
if (process.env.SELENIUM_BROWSER !== 'firefox') {
const txValues = await findElement(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txValues, /-1\sETH/), 10000)
+ await driver.wait(until.elementTextMatches(txValues, /-1\s*ETH/), 10000)
}
})
})
@@ -462,7 +462,7 @@ describe('MetaMask', function () {
assert.equal(transactions.length, 2)
const txValues = await findElement(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txValues, /-3\sETH/), 10000)
+ await driver.wait(until.elementTextMatches(txValues, /-3\s*ETH/), 10000)
})
})
@@ -540,7 +540,7 @@ describe('MetaMask', function () {
await findElements(driver, By.css('.transaction-list-item'))
const [txListValue] = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txListValue, /-4\sETH/), 10000)
+ await driver.wait(until.elementTextMatches(txListValue, /-4\s*ETH/), 10000)
await txListValue.click()
await delay(regularDelayMs)
@@ -574,7 +574,7 @@ describe('MetaMask', function () {
}, 10000)
const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txValues[0], /-4\sETH/), 10000)
+ await driver.wait(until.elementTextMatches(txValues[0], /-4\s*ETH/), 10000)
// const txAccounts = await findElements(driver, By.css('.tx-list-account'))
// const firstTxAddress = await txAccounts[0].getText()
@@ -606,7 +606,7 @@ describe('MetaMask', function () {
}, 10000)
const txValues = await findElement(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txValues, /-0\sETH/), 10000)
+ await driver.wait(until.elementTextMatches(txValues, /-0\s*ETH/), 10000)
await closeAllWindowHandlesExcept(driver, [extension, dapp])
await driver.switchTo().window(extension)
@@ -616,9 +616,9 @@ describe('MetaMask', function () {
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)
+ await driver.wait(until.elementTextMatches(balance, /^92.*\s*ETH.*$/), 10000)
const tokenAmount = await balance.getText()
- assert.ok(/^92.*ETH.*$/.test(tokenAmount))
+ assert.ok(/^92.*\s*ETH.*$/.test(tokenAmount))
await delay(regularDelayMs)
}
})
@@ -764,7 +764,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') {
- await driver.wait(until.elementTextMatches(txValues[0], /-50\sTST/), 10000)
+ await driver.wait(until.elementTextMatches(txValues[0], /-50\s*TST/), 10000)
}
driver.wait(async () => {
@@ -798,7 +798,7 @@ describe('MetaMask', function () {
await findElements(driver, By.css('.transaction-list__pending-transactions'))
const [txListValue] = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txListValue, /-7\sTST/), 10000)
+ await driver.wait(until.elementTextMatches(txListValue, /-7\s*TST/), 10000)
await txListValue.click()
await delay(regularDelayMs)
@@ -851,7 +851,7 @@ describe('MetaMask', function () {
}, 10000)
const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txValues[0], /-7\sTST/))
+ await driver.wait(until.elementTextMatches(txValues[0], /-7\s*TST/))
const txStatuses = await findElements(driver, By.css('.transaction-list-item__action'))
await driver.wait(until.elementTextMatches(txStatuses[0], /Sent\sToken/))
@@ -897,7 +897,7 @@ describe('MetaMask', function () {
const [txListItem] = await findElements(driver, By.css('.transaction-list-item'))
const [txListValue] = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txListValue, /-7\sTST/))
+ await driver.wait(until.elementTextMatches(txListValue, /-7\s*TST/))
await txListItem.click()
await delay(regularDelayMs)
})
@@ -974,7 +974,7 @@ describe('MetaMask', function () {
}, 10000)
const txValues = await findElements(driver, By.css('.transaction-list-item__amount--primary'))
- await driver.wait(until.elementTextMatches(txValues[0], /-7\sTST/))
+ await driver.wait(until.elementTextMatches(txValues[0], /-7\s*TST/))
const txStatuses = await findElements(driver, By.css('.transaction-list-item__action'))
await driver.wait(until.elementTextMatches(txStatuses[0], /Approve/))
})
@@ -1027,7 +1027,7 @@ describe('MetaMask', function () {
it('renders the balance for the chosen token', async () => {
const balance = await findElement(driver, By.css('.transaction-view-balance__token-balance'))
- await driver.wait(until.elementTextMatches(balance, /0\sBAT/))
+ await driver.wait(until.elementTextMatches(balance, /0\s*BAT/))
await delay(regularDelayMs)
})
})
diff --git a/test/e2e/beta/run-drizzle.sh b/test/e2e/beta/run-drizzle.sh
index 7bfffd7e6..bfb7e6fdb 100755
--- a/test/e2e/beta/run-drizzle.sh
+++ b/test/e2e/beta/run-drizzle.sh
@@ -11,7 +11,7 @@ sleep 5
cd test/e2e/beta/
rm -rf drizzle-test
mkdir drizzle-test && cd drizzle-test
-npm install truffle
+sudo npm install -g truffle
truffle unbox drizzle
echo "Deploying contracts for Drizzle test..."
truffle compile && truffle migrate
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 e13016e68..271dd91cf 100644
--- a/test/integration/lib/send-new-ui.js
+++ b/test/integration/lib/send-new-ui.js
@@ -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 ETH', '$0.00 USD')
- await customizeGas(assert, 1, 21000, '0.000021 ETH', '$0.03 USD')
- await customizeGas(assert, 500, 60000, '0.03 ETH', '$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')
diff --git a/test/unit/app/controllers/network-contoller-test.js b/test/unit/app/controllers/network-contoller-test.js
index 822311931..7959e6cc1 100644
--- a/test/unit/app/controllers/network-contoller-test.js
+++ b/test/unit/app/controllers/network-contoller-test.js
@@ -47,7 +47,7 @@ describe('# Network Controller', function () {
describe('#setNetworkState', function () {
it('should update the network', function () {
- networkController.setNetworkState(1)
+ networkController.setNetworkState(1, 'rpc')
const networkState = networkController.getNetworkState()
assert.equal(networkState, 1, 'network is 1')
})
diff --git a/test/unit/app/controllers/preferences-controller-test.js b/test/unit/app/controllers/preferences-controller-test.js
index 02f421de2..c64c47ae9 100644
--- a/test/unit/app/controllers/preferences-controller-test.js
+++ b/test/unit/app/controllers/preferences-controller-test.js
@@ -375,6 +375,11 @@ describe('preferences controller', function () {
await preferencesController.requestWatchAsset(req, res, asy.next, asy.end)
sandbox.assert.called(stubEnd)
sandbox.assert.notCalled(stubNext)
+ req.method = 'wallet_watchAsset'
+ req.params.type = 'someasset'
+ await preferencesController.requestWatchAsset(req, res, asy.next, asy.end)
+ sandbox.assert.calledTwice(stubEnd)
+ sandbox.assert.notCalled(stubNext)
})
it('should through error if method is supported but asset type is not', async function () {
req.method = 'metamask_watchAsset'
@@ -482,20 +487,20 @@ describe('preferences controller', function () {
describe('on updateFrequentRpcList', function () {
it('should add custom RPC url to state', function () {
- preferencesController.addToFrequentRpcList('rpc_url')
- preferencesController.addToFrequentRpcList('http://localhost:8545')
- assert.deepEqual(preferencesController.store.getState().frequentRpcList, ['rpc_url'])
- preferencesController.addToFrequentRpcList('rpc_url')
- assert.deepEqual(preferencesController.store.getState().frequentRpcList, ['rpc_url'])
+ preferencesController.addToFrequentRpcList('rpc_url', 1)
+ preferencesController.addToFrequentRpcList('http://localhost:8545', 1)
+ assert.deepEqual(preferencesController.store.getState().frequentRpcListDetail, [{ rpcUrl: 'rpc_url', chainId: 1, ticker: 'ETH', nickname: '' }] )
+ preferencesController.addToFrequentRpcList('rpc_url', 1)
+ assert.deepEqual(preferencesController.store.getState().frequentRpcListDetail, [{ rpcUrl: 'rpc_url', chainId: 1, ticker: 'ETH', nickname: '' }] )
})
it('should remove custom RPC url from state', function () {
- preferencesController.addToFrequentRpcList('rpc_url')
- assert.deepEqual(preferencesController.store.getState().frequentRpcList, ['rpc_url'])
+ preferencesController.addToFrequentRpcList('rpc_url', 1)
+ assert.deepEqual(preferencesController.store.getState().frequentRpcListDetail, [{ rpcUrl: 'rpc_url', chainId: 1, ticker: 'ETH', nickname: '' }] )
preferencesController.removeFromFrequentRpcList('other_rpc_url')
preferencesController.removeFromFrequentRpcList('http://localhost:8545')
preferencesController.removeFromFrequentRpcList('rpc_url')
- assert.deepEqual(preferencesController.store.getState().frequentRpcList, [])
+ assert.deepEqual(preferencesController.store.getState().frequentRpcListDetail, [])
})
})
})
diff --git a/test/unit/ui/app/actions.spec.js b/test/unit/ui/app/actions.spec.js
index 748a58b32..df7d2ee8f 100644
--- a/test/unit/ui/app/actions.spec.js
+++ b/test/unit/ui/app/actions.spec.js
@@ -1133,7 +1133,7 @@ describe('Actions', () => {
{ type: 'DISPLAY_WARNING', value: 'Had a problem changing networks!' },
]
- setRpcTargetSpy.callsFake((newRpc, callback) => {
+ setRpcTargetSpy.callsFake((newRpc, chainId, ticker, nickname, callback) => {
callback(new Error('error'))
})
diff --git a/test/unit/ui/app/components/identicon.spec.js b/test/unit/ui/app/components/identicon.spec.js
deleted file mode 100644
index a2f8d8246..000000000
--- a/test/unit/ui/app/components/identicon.spec.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import React from 'react'
-import assert from 'assert'
-import thunk from 'redux-thunk'
-import configureMockStore from 'redux-mock-store'
-import { mount } from 'enzyme'
-
-import IdenticonComponent from '../../../../../ui/app/components/identicon'
-
-describe('Identicon Component', () => {
-
- const state = {
- metamask: {
- useBlockie: false,
- },
- }
-
- const middlewares = [thunk]
- const mockStore = configureMockStore(middlewares)
- const store = mockStore(state)
-
- it('renders default eth_logo identicon with no props', () => {
- const wrapper = mount(<IdenticonComponent store={store}/>)
- assert.equal(wrapper.find('img.balance-icon').prop('src'), './images/eth_logo.svg')
- })
-
- it('renders custom image and add className props', () => {
- const wrapper = mount(<IdenticonComponent store={store} className={'test-image'} image={'test-image'} />)
- assert.equal(wrapper.find('img.test-image').prop('className'), 'test-image identicon')
- assert.equal(wrapper.find('img.test-image').prop('src'), 'test-image')
- })
-
- it('renders div with address prop', () => {
- const wrapper = mount(<IdenticonComponent store={store} className={'test-address'} address={'0xTest'} />)
- assert.equal(wrapper.find('div.test-address').prop('className'), 'test-address identicon')
- })
-})