From 0e0c87e732d6f1effcbaee041cc5f44e81cb30b7 Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Wed, 15 May 2019 07:17:26 -0230 Subject: [PATCH] Adds e2e test for removing imported accounts. --- app/_locales/en/messages.json | 2 +- test/e2e/beta/from-import-beta-ui.spec.js | 55 ++++++++++++++++++++++- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index bef278f79743..47c1cfde8994 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -1249,7 +1249,7 @@ "message": "Revert" }, "remove": { - "message": "remove" + "message": "Remove" }, "removeAccount": { "message": "Remove account" diff --git a/test/e2e/beta/from-import-beta-ui.spec.js b/test/e2e/beta/from-import-beta-ui.spec.js index a913caa79dd5..625330dbbedb 100644 --- a/test/e2e/beta/from-import-beta-ui.spec.js +++ b/test/e2e/beta/from-import-beta-ui.spec.js @@ -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 @@ -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)