Merge branch 'develop' of github.com:MetaMask/metamask-extension into trezor-v5

feature/default_network_editable
brunobar79 6 years ago
commit 90886c5e05
  1. 7
      app/scripts/metamask-controller.js
  2. 13
      test/e2e/beta/metamask-beta-ui.spec.js
  3. 4
      test/e2e/beta/run-all.sh
  4. 2
      test/unit/app/controllers/metamask-controller-test.js

@ -668,7 +668,9 @@ module.exports = class MetamaskController extends EventEmitter {
this.preferencesController.setAddresses(newAccounts) this.preferencesController.setAddresses(newAccounts)
newAccounts.forEach(address => { newAccounts.forEach(address => {
if (!oldAccounts.includes(address)) { if (!oldAccounts.includes(address)) {
this.preferencesController.setAccountLabel(address, `${deviceName.toUpperCase()} ${parseInt(index, 10) + 1}`) // Set the account label to Trezor 1 / Ledger 1, etc
this.preferencesController.setAccountLabel(address, `${deviceName[0].toUpperCase()}${deviceName.slice(1)} ${parseInt(index, 10) + 1}`)
// Select the account
this.preferencesController.setSelectedAddress(address) this.preferencesController.setSelectedAddress(address)
} }
}) })
@ -800,7 +802,8 @@ module.exports = class MetamaskController extends EventEmitter {
// Remove account from the preferences controller // Remove account from the preferences controller
this.preferencesController.removeAddress(address) this.preferencesController.removeAddress(address)
// Remove account from the account tracker controller // Remove account from the account tracker controller
this.accountTracker.removeAccount(address) this.accountTracker.removeAccount([address])
// Remove account from the keyring // Remove account from the keyring
await this.keyringController.removeAccount(address) await this.keyringController.removeAccount(address)
return address return address

@ -460,8 +460,6 @@ describe('MetaMask', function () {
const transactions = await findElements(driver, By.css('.tx-list-item')) const transactions = await findElements(driver, By.css('.tx-list-item'))
assert.equal(transactions.length, 2) assert.equal(transactions.length, 2)
await findElement(driver, By.xpath(`//span[contains(text(), 'Submitted')]`))
const txStatuses = await findElements(driver, By.css('.tx-list-status')) const txStatuses = await findElements(driver, By.css('.tx-list-status'))
await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/)) await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/))
@ -515,8 +513,6 @@ describe('MetaMask', function () {
await confirmButton.click() await confirmButton.click()
await delay(regularDelayMs) await delay(regularDelayMs)
await findElement(driver, By.xpath(`//span[contains(text(), 'Submitted')]`))
const txStatuses = await findElements(driver, By.css('.tx-list-status')) const txStatuses = await findElements(driver, By.css('.tx-list-status'))
await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/)) await driver.wait(until.elementTextMatches(txStatuses[0], /Confirmed/))
@ -525,15 +521,6 @@ describe('MetaMask', function () {
await delay(regularDelayMs) await delay(regularDelayMs)
}) })
it('confirms a deploy contract transaction in the popup', async () => {
const windowHandles = await driver.getAllWindowHandles()
const popup = windowHandles[2]
await driver.switchTo().window(popup)
const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
await confirmButton.click()
await delay(regularDelayMs)
})
it('calls and confirms a contract method where ETH is sent', async () => { it('calls and confirms a contract method where ETH is sent', async () => {
await driver.switchTo().window(dapp) await driver.switchTo().window(dapp)
await delay(regularDelayMs) await delay(regularDelayMs)

@ -6,5 +6,5 @@ set -o pipefail
export PATH="$PATH:./node_modules/.bin" export PATH="$PATH:./node_modules/.bin"
shell-parallel -s 'npm run ganache:start' -x 'sleep 5 && static-server test/e2e/beta/contract-test/ --port 8080' -x 'sleep 5 && mocha test/e2e/beta/metamask-beta-ui.spec' shell-parallel -s 'npm run ganache:start -- -b 2' -x 'sleep 5 && static-server test/e2e/beta/contract-test/ --port 8080' -x 'sleep 5 && mocha test/e2e/beta/metamask-beta-ui.spec'
shell-parallel -s 'npm run ganache:start -- -d' -x 'sleep 5 && static-server test/e2e/beta/contract-test/ --port 8080' -x 'sleep 5 && mocha test/e2e/beta/from-import-beta-ui.spec' shell-parallel -s 'npm run ganache:start -- -d -b 2' -x 'sleep 5 && static-server test/e2e/beta/contract-test/ --port 8080' -x 'sleep 5 && mocha test/e2e/beta/from-import-beta-ui.spec'

@ -573,7 +573,7 @@ describe('MetaMaskController', function () {
assert(metamaskController.preferencesController.removeAddress.calledWith(addressToRemove)) assert(metamaskController.preferencesController.removeAddress.calledWith(addressToRemove))
}) })
it('should call accountTracker.removeAccount', async function () { it('should call accountTracker.removeAccount', async function () {
assert(metamaskController.accountTracker.removeAccount.calledWith(addressToRemove)) assert(metamaskController.accountTracker.removeAccount.calledWith([addressToRemove]))
}) })
it('should call keyringController.removeAccount', async function () { it('should call keyringController.removeAccount', async function () {
assert(metamaskController.keyringController.removeAccount.calledWith(addressToRemove)) assert(metamaskController.keyringController.removeAccount.calledWith(addressToRemove))

Loading…
Cancel
Save