1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

[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
This commit is contained in:
seaona 2022-11-24 19:09:54 +01:00 committed by GitHub
parent 121969b1a7
commit 6dddd246d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,