From 6dddd246d103fa92ce5a90b3b3ba98e09968bbc9 Mon Sep 17 00:00:00 2001 From: seaona <54408225+seaona@users.noreply.github.com> Date: Thu, 24 Nov 2022 19:09:54 +0100 Subject: [PATCH] [e2e] [MV3] Fix Add Account e2e flaky test for MV3 build (#16603) * Wait until element is not present * Wait for non empty element on add account test * Wait for non empty element for all instances of get account text * Point to account value directly * Add accounts as const --- test/e2e/tests/add-account.spec.js | 32 +++++++++++++++++------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/test/e2e/tests/add-account.spec.js b/test/e2e/tests/add-account.spec.js index 5e1c15bd0..226c8bda9 100644 --- a/test/e2e/tests/add-account.spec.js +++ b/test/e2e/tests/add-account.spec.js @@ -21,6 +21,8 @@ describe('Add account', function () { }, ], }; + const secondAccount = '0x3ED0eE22E0685Ebbf07b2360A8331693c413CC59'; + const thirdAccount = '0xD38d853771Fb546bd8B18b2F3638491bC0B0E906'; it('should display correct new account name after create', async function () { await withFixtures( @@ -80,9 +82,10 @@ describe('Add account', function () { const detailsModal = await driver.findVisibleElement('span .modal'); // get the public address for the "second account" await driver.waitForSelector('.qr-code__address'); - const secondAccountAddress = await driver.findElement( - '.qr-code__address', - ); + const secondAccountAddress = await driver.findElement({ + text: secondAccount, + tag: 'div', + }); const secondAccountPublicAddress = await secondAccountAddress.getText(); await driver.clickElement('.account-modal__close'); @@ -106,9 +109,10 @@ describe('Add account', function () { 'span .modal', ); await driver.waitForSelector('.qr-code__address'); - const thirdAccountAddress = await driver.findElement( - '.qr-code__address', - ); + const thirdAccountAddress = await driver.findElement({ + text: thirdAccount, + tag: 'div', + }); const thirdAccountPublicAddress = await thirdAccountAddress.getText(); await driver.clickElement('.account-modal__close'); @@ -162,10 +166,10 @@ describe('Add account', function () { ); // get the public address for the "second account" await driver.waitForSelector('.qr-code__address'); - const recreatedSecondAccountAddress = await driver.findElement( - '.qr-code__address', - ); - + const recreatedSecondAccountAddress = await driver.findElement({ + text: secondAccount, + tag: 'div', + }); assert.equal( await recreatedSecondAccountAddress.getText(), secondAccountPublicAddress, @@ -188,10 +192,10 @@ describe('Add account', function () { ); // get the public address for the "third account" - await driver.waitForSelector('.qr-code__address'); - const recreatedThirdAccountAddress = await driver.findElement( - '.qr-code__address', - ); + const recreatedThirdAccountAddress = await driver.findElement({ + text: thirdAccount, + tag: 'div', + }); assert.strictEqual( await recreatedThirdAccountAddress.getText(), thirdAccountPublicAddress,