From a13d8583a091299c09f8b06eb72372857119248c Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Wed, 10 Nov 2021 06:30:42 -0330 Subject: [PATCH] Fix flaky account removal e2e test (#12607) * Add delay to fix flaky account removal e2e test * Await for element to update instead of awaiting an arbitrary delay * Update test/e2e/tests/from-import-ui.spec.js Co-authored-by: Mark Stacey * code formatting * Remove redundant code Co-authored-by: Mark Stacey Co-authored-by: PeterYinusa --- test/e2e/tests/from-import-ui.spec.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/e2e/tests/from-import-ui.spec.js b/test/e2e/tests/from-import-ui.spec.js index 0bd3b683a..5c0e0c8ee 100644 --- a/test/e2e/tests/from-import-ui.spec.js +++ b/test/e2e/tests/from-import-ui.spec.js @@ -233,10 +233,15 @@ describe('Metamask Import UI', function () { // should remove the account await driver.clickElement({ text: 'Remove', tag: 'button' }); - const currentActiveAccountName = await driver.findElement( - '.selected-account__name', + // Wait until selected account switches away from removed account to first account + await driver.waitForSelector( + { + css: '.selected-account__name', + text: 'Account 1', + }, + { timeout: 10000 }, ); - assert.equal(await currentActiveAccountName.getText(), 'Account 1'); + await driver.delay(regularDelayMs); await driver.clickElement('.account-menu__icon');