Skip to content

Commit

Permalink
Adds e2e test for removing imported accounts.
Browse files Browse the repository at this point in the history
  • Loading branch information
danjm committed May 15, 2019
1 parent 1d2cf52 commit 0e0c87e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@
"message": "Revert"
},
"remove": {
"message": "remove"
"message": "Remove"
},
"removeAccount": {
"message": "Remove account"
Expand Down
55 changes: 53 additions & 2 deletions test/e2e/beta/from-import-beta-ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ describe('Using MetaMask with an existing account', function () {
const testSeedPhrase = 'forum vessel pink push lonely enact gentle tail admit parrot grunt dress'
const testAddress = '0x0Cc5261AB8cE458dc977078A3623E2BaDD27afD3'
const testPrivateKey2 = '14abe6f4aab7f9f626fe981c864d0adeb5685f289ac9270c27b8fd790b4235d6'
const testPrivateKey3 = 'F4EC2590A0C10DE95FBF4547845178910E40F5035320C516A18C117DE02B5669'
const tinyDelayMs = 200
const regularDelayMs = 1000
const largeDelayMs = regularDelayMs * 2

Expand Down Expand Up @@ -323,11 +325,60 @@ describe('Using MetaMask with an existing account', function () {
})
})

describe('Connects to a Hardware wallet', () => {
it('choose Connect Hardware Wallet from the account menu', async () => {
describe('Imports and removes an account', () => {
it('choose Create Account from the account menu', async () => {
await driver.findElement(By.css('.account-menu__icon')).click()
await delay(regularDelayMs)

const [importAccount] = await findElements(driver, By.xpath(`//div[contains(text(), 'Import Account')]`))
await importAccount.click()
await delay(regularDelayMs)
})

it('enter private key', async () => {
const privateKeyInput = await findElement(driver, By.css('#private-key-box'))
await privateKeyInput.sendKeys(testPrivateKey3)
await delay(regularDelayMs)
const importButtons = await findElements(driver, By.xpath(`//button[contains(text(), 'Import')]`))
await importButtons[0].click()
await delay(regularDelayMs)
})

it('should open the remove account modal', async () => {
const [accountName] = await findElements(driver, By.css('.account-name'))
assert.equal(await accountName.getText(), 'Account 5')
await delay(regularDelayMs)

await driver.findElement(By.css('.account-menu__icon')).click()
await delay(regularDelayMs)

const accountListItems = await findElements(driver, By.css('.account-menu__account'))
assert.equal(accountListItems.length, 5)

const removeAccountIcons = await findElements(driver, By.css('.remove-account-icon'))
await removeAccountIcons[1].click()
await delay(tinyDelayMs)

await findElement(driver, By.css('.confirm-remove-account__account'))
})

it('should remove the account', async () => {
const removeButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Remove')]`))
await removeButton.click()

await delay(regularDelayMs)

const [accountName] = await findElements(driver, By.css('.account-name'))
assert.equal(await accountName.getText(), 'Account 1')
await delay(regularDelayMs)

const accountListItems = await findElements(driver, By.css('.account-menu__account'))
assert.equal(accountListItems.length, 4)
})
})

describe('Connects to a Hardware wallet', () => {
it('choose Connect Hardware Wallet from the account menu', async () => {
const [connectAccount] = await findElements(driver, By.xpath(`//div[contains(text(), 'Connect Hardware Wallet')]`))
await connectAccount.click()
await delay(regularDelayMs)
Expand Down

0 comments on commit 0e0c87e

Please sign in to comment.