From f4d93776d9341d51023a126c7e4931acdd9a7af4 Mon Sep 17 00:00:00 2001 From: PeterYinusa <53189696+PeterYinusa@users.noreply.github.com> Date: Thu, 26 Aug 2021 18:08:48 +0200 Subject: [PATCH] refactor account details test to use fixtures (#11926) --- test/e2e/metamask-ui.spec.js | 19 ------------- test/e2e/tests/account-details.spec.js | 38 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 test/e2e/tests/account-details.spec.js diff --git a/test/e2e/metamask-ui.spec.js b/test/e2e/metamask-ui.spec.js index 1b19b45ec..f295276af 100644 --- a/test/e2e/metamask-ui.spec.js +++ b/test/e2e/metamask-ui.spec.js @@ -187,25 +187,6 @@ describe('MetaMask', function () { }); }); - describe('Show account information', function () { - it('shows the QR code for the account', async function () { - await driver.clickElement('[data-testid="account-options-menu-button"]'); - await driver.clickElement( - '[data-testid="account-options-menu__account-details"]', - ); - await driver.findVisibleElement('.qr-code__wrapper'); - await driver.delay(regularDelayMs); - - // wait for permission modal to be visible. - const permissionModal = await driver.findVisibleElement('span .modal'); - await driver.clickElement('.account-modal__close'); - - // wait for permission modal to be removed from DOM. - await permissionModal.waitForElementState('hidden'); - await driver.delay(regularDelayMs); - }); - }); - describe('Import Secret Recovery Phrase', function () { it('logs out of the vault', async function () { await driver.clickElement('.account-menu__icon'); diff --git a/test/e2e/tests/account-details.spec.js b/test/e2e/tests/account-details.spec.js new file mode 100644 index 000000000..82f28ad15 --- /dev/null +++ b/test/e2e/tests/account-details.spec.js @@ -0,0 +1,38 @@ +const { strict: assert } = require('assert'); +const { withFixtures } = require('../helpers'); + +describe('Show account details', function () { + const ganacheOptions = { + accounts: [ + { + secretKey: + '0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC', + balance: 25000000000000000000, + }, + ], + }; + it('should show the QR code for the account', async function () { + await withFixtures( + { + fixtures: 'imported-account', + ganacheOptions, + title: this.test.title, + }, + async ({ driver }) => { + await driver.navigate(); + await driver.fill('#password', 'correct horse battery staple'); + await driver.press('#password', driver.Key.ENTER); + + await driver.clickElement( + '[data-testid="account-options-menu-button"]', + ); + await driver.clickElement( + '[data-testid="account-options-menu__account-details"]', + ); + + const qrCode = await driver.findElement('.qr-code__wrapper'); + assert.equal(await qrCode.isDisplayed(), true); + }, + ); + }); +});