aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-06-07 02:08:29 +0800
committerkumavis <aaron@kumavis.me>2018-06-07 02:08:29 +0800
commit9d77b0a19648fa5c4de594bbecaab2137d5d5658 (patch)
treefe87a5798021ac1b3332a3a13a70f5c4a930e126 /test
parent32293a959c367ce5dd585111d4ee0d873072c830 (diff)
parentc2e3194dbf4e2a3fd2bdffb3300ec0cd822dc78e (diff)
downloadtangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.gz
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.bz2
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.lz
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.xz
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.zst
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.zip
Merge branch 'develop' of github.com:MetaMask/metamask-extension into network-remove-provider-engine
Diffstat (limited to 'test')
-rw-r--r--test/e2e/metamask.spec.js7
-rw-r--r--test/integration/lib/add-token.js10
-rw-r--r--test/integration/lib/confirm-sig-requests.js6
-rw-r--r--test/integration/lib/send-new-ui.js6
-rw-r--r--test/screens/new-ui.js12
-rw-r--r--test/unit/app/controllers/metamask-controller-test.js27
6 files changed, 49 insertions, 19 deletions
diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js
index 8ec7de16c..a08a34d96 100644
--- a/test/e2e/metamask.spec.js
+++ b/test/e2e/metamask.spec.js
@@ -121,7 +121,14 @@ describe('Metamask popup page', function () {
await delay(300)
})
+ it('adds a second account', async function () {
+ await driver.findElement(By.css('#app-content > div > div.full-width > div > div:nth-child(2) > span > div')).click()
+ await delay(300)
+ await driver.findElement(By.css('#app-content > div > div.full-width > div > div:nth-child(2) > span > div > div > span > div > li:nth-child(3) > span')).click()
+ })
+
it('shows account address', async function () {
+ await delay(300)
accountAddress = await driver.findElement(By.css('#app-content > div > div.app-primary.from-left > div > div > div:nth-child(1) > flex-column > div.flex-row > div')).getText()
})
diff --git a/test/integration/lib/add-token.js b/test/integration/lib/add-token.js
index e51c854d2..5a08c90cd 100644
--- a/test/integration/lib/add-token.js
+++ b/test/integration/lib/add-token.js
@@ -43,7 +43,7 @@ async function runAddTokenFlowTest (assert, done) {
assert.equal(addTokenTitle[0].textContent, 'Add Tokens', 'add token title is correct')
// Cancel Add Token
- const cancelAddTokenButton = await queryAsync($, 'button.btn-secondary--lg.page-container__footer-button')
+ const cancelAddTokenButton = await queryAsync($, 'button.btn-default.btn--large.page-container__footer-button')
assert.ok(cancelAddTokenButton[0], 'cancel add token button present')
cancelAddTokenButton.click()
@@ -75,15 +75,15 @@ async function runAddTokenFlowTest (assert, done) {
tokenWrapper[0].click()
// Click Next button
- let nextButton = await queryAsync($, 'button.btn-primary--lg')
+ let 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--lg')[0], 'confirm add token button found')
- $('button.btn-primary--lg')[0].click()
+ 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($, '.hero-balance')
@@ -120,7 +120,7 @@ async function runAddTokenFlowTest (assert, done) {
const errorMessage = await queryAsync($, '#custom-symbol-helper-text')
assert.ok(errorMessage[0], 'error rendered')
- $('button.btn-secondary--lg')[0].click()
+ $('button.btn-default.btn--large')[0].click()
// await timeout(100000)
diff --git a/test/integration/lib/confirm-sig-requests.js b/test/integration/lib/confirm-sig-requests.js
index 3936ac5fa..d5ed7c77c 100644
--- a/test/integration/lib/confirm-sig-requests.js
+++ b/test/integration/lib/confirm-sig-requests.js
@@ -38,7 +38,7 @@ async function runConfirmSigRequestsTest(assert, done) {
let confirmSigRowValue = await queryAsync($, '.request-signature__row-value')
assert.equal(confirmSigRowValue[0].textContent, '0x879a053d4800c6354e76c7985a865d2922c82fb5b3f4577b2fe08b998954f2e0')
- let confirmSigSignButton = await queryAsync($, 'button.btn-primary--lg')
+ let confirmSigSignButton = await queryAsync($, 'button.btn-primary.btn--large')
confirmSigSignButton[0].click()
confirmSigHeadline = await queryAsync($, '.request-signature__headline')
@@ -47,7 +47,7 @@ async function runConfirmSigRequestsTest(assert, done) {
confirmSigRowValue = await queryAsync($, '.request-signature__row-value')
assert.ok(confirmSigRowValue[0].textContent.match(/^\#\sTerms\sof\sUse/))
- confirmSigSignButton = await queryAsync($, 'button.btn-primary--lg')
+ confirmSigSignButton = await queryAsync($, 'button.btn-primary.btn--large')
confirmSigSignButton[0].click()
confirmSigHeadline = await queryAsync($, '.request-signature__headline')
@@ -57,7 +57,7 @@ async function runConfirmSigRequestsTest(assert, done) {
assert.equal(confirmSigRowValue[0].textContent, 'Hi, Alice!')
assert.equal(confirmSigRowValue[1].textContent, '1337')
- confirmSigSignButton = await queryAsync($, 'button.btn-primary--lg')
+ confirmSigSignButton = await queryAsync($, 'button.btn-primary.btn--large')
confirmSigSignButton[0].click()
const txView = await queryAsync($, '.tx-view')
diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js
index 3da3f4f95..176907926 100644
--- a/test/integration/lib/send-new-ui.js
+++ b/test/integration/lib/send-new-ui.js
@@ -129,7 +129,7 @@ async function runSendFlowTest(assert, done) {
await customizeGas(assert, 0, 21000, '0', '$0.00 USD')
await customizeGas(assert, 500, 60000, '0.003', '$3.60 USD')
- const sendButton = await queryAsync($, 'button.btn-primary--lg.page-container__footer-button')
+ const sendButton = await queryAsync($, 'button.btn-primary.btn--large.page-container__footer-button')
assert.equal(sendButton[0].textContent, 'Next', 'next button rendered')
sendButton[0].click()
await timeout()
@@ -169,13 +169,13 @@ async function runSendFlowTest(assert, done) {
sendAmountFieldInputInEdit.val('1.0')
reactTriggerChange(sendAmountFieldInputInEdit[0])
- const sendButtonInEdit = await queryAsync($, '.btn-primary--lg.page-container__footer-button')
+ const sendButtonInEdit = await queryAsync($, '.btn-primary.btn--large.page-container__footer-button')
assert.equal(sendButtonInEdit[0].textContent, 'Next', 'next button in edit rendered')
selectState.val('send new ui')
reactTriggerChange(selectState[0])
- const cancelButtonInEdit = await queryAsync($, '.btn-secondary--lg.page-container__footer-button')
+ const cancelButtonInEdit = await queryAsync($, '.btn-default.btn--large.page-container__footer-button')
cancelButtonInEdit[0].click()
// sendButtonInEdit[0].click()
diff --git a/test/screens/new-ui.js b/test/screens/new-ui.js
index 6b873ac85..e3ba7f6ab 100644
--- a/test/screens/new-ui.js
+++ b/test/screens/new-ui.js
@@ -11,9 +11,8 @@ const GIFEncoder = require('gifencoder')
const pngFileStream = require('png-file-stream')
const sizeOfPng = require('image-size/lib/types/png')
const By = webdriver.By
-const { delay, buildWebDriver } = require('./func')
const localesIndex = require('../../app/_locales/index.json')
-// const localesIndex = []
+const { delay, buildChromeWebDriver, buildFirefoxWebdriver, installWebExt, getExtensionIdChrome, getExtensionIdFirefox } = require('../e2e/func')
const eth = new Ethjs(new Ethjs.HttpProvider('http://localhost:8545'))
@@ -50,11 +49,10 @@ async function captureAllScreens() {
await cleanScreenShotDir()
- // setup selenium and install extension
const extPath = path.resolve('dist/chrome')
- driver = buildWebDriver(extPath)
- await driver.get('chrome://extensions-frame')
- const extensionId = await driver.executeScript('return document.querySelector("extensions-manager").shadowRoot.querySelector("extensions-view-manager extensions-item-list").shadowRoot.querySelector("#container > div.items-container > extensions-item:nth-child(2)").getAttribute("id")')
+ driver = buildChromeWebDriver(extPath)
+ const extensionId = await getExtensionIdChrome(driver)
+
await driver.get(`chrome-extension://${extensionId}/home.html`)
await delay(500)
tabs = await driver.getAllWindowHandles()
@@ -165,7 +163,7 @@ async function captureAllScreens() {
await delay(300)
await captureLanguageScreenShots('metamask account detail export private key screen - password entered')
- await driver.findElement(By.css('.btn-primary--lg.export-private-key__button')).click()
+ await driver.findElement(By.css('.btn-primary.btn--large.export-private-key__button')).click()
await delay(300)
await captureLanguageScreenShots('metamask account detail export private key screen - reveal key')
diff --git a/test/unit/app/controllers/metamask-controller-test.js b/test/unit/app/controllers/metamask-controller-test.js
index 1b2c95f48..13d74bce1 100644
--- a/test/unit/app/controllers/metamask-controller-test.js
+++ b/test/unit/app/controllers/metamask-controller-test.js
@@ -47,7 +47,7 @@ describe('MetaMaskController', function () {
encryptor: {
encrypt: function (password, object) {
this.object = object
- return Promise.resolve()
+ return Promise.resolve('mock-encrypted')
},
decrypt: function () {
return Promise.resolve(this.object)
@@ -64,6 +64,31 @@ describe('MetaMaskController', function () {
sandbox.restore()
})
+ describe('submitPassword', function () {
+ const password = 'password'
+
+ beforeEach(async function () {
+ await metamaskController.createNewVaultAndKeychain(password)
+ })
+
+ it('removes any identities that do not correspond to known accounts.', async function () {
+ const fakeAddress = '0xbad0'
+ metamaskController.preferencesController.addAddresses([fakeAddress])
+ await metamaskController.submitPassword(password)
+
+ const identities = Object.keys(metamaskController.preferencesController.store.getState().identities)
+ const addresses = await metamaskController.keyringController.getAccounts()
+
+ identities.forEach((identity) => {
+ assert.ok(addresses.includes(identity), `addresses should include all IDs: ${identity}`)
+ })
+
+ addresses.forEach((address) => {
+ assert.ok(identities.includes(address), `identities should include all Addresses: ${address}`)
+ })
+ })
+ })
+
describe('#getGasPrice', function () {
it('gives the 50th percentile lowest accepted gas price from recentBlocksController', async function () {