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

fix(e2e): flaky test-e2e-chrome on add-custom-network.spec.js (#19487)

This commit is contained in:
Howard Braham 2023-06-07 11:09:06 -07:00 committed by GitHub
parent 789779f4d5
commit 2647ae16d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,14 +101,14 @@ describe('Custom network', function () {
}, },
); );
}); });
it("don't add bad rpc custom network", async function () {
it('dont add bad rpc custom network', async function () {
await withFixtures( await withFixtures(
{ {
dapp: true, dapp: true,
fixtures: new FixtureBuilder() fixtures: new FixtureBuilder()
.withPermissionControllerConnectedToTestDapp() .withPermissionControllerConnectedToTestDapp()
.build(), .build(),
ganacheOptions,
title: this.test.title, title: this.test.title,
}, },
async ({ driver }) => { async ({ driver }) => {
@ -140,16 +140,23 @@ describe('Custom network', function () {
'MetaMask Notification', 'MetaMask Notification',
windowHandles, windowHandles,
); );
const errMsg1 = 'verify the network details';
await driver.findElement({
tag: 'a',
text: errMsg1,
});
await driver.clickElement({ await driver.clickElement({
tag: 'button', tag: 'button',
text: 'Approve', text: 'Approve',
}); });
const errMsg = const errMsg2 =
'Chain ID returned by the custom network does not match the submitted chain ID.'; 'Chain ID returned by the custom network does not match the submitted chain ID.';
await driver.findElement({ await driver.findElement({
tag: 'span', tag: 'span',
text: errMsg, text: errMsg2,
}); });
const approveBtn = await driver.findElement({ const approveBtn = await driver.findElement({
@ -166,7 +173,7 @@ describe('Custom network', function () {
); );
}); });
it("don't add unreachable custom network", async function () { it('dont add unreachable custom network', async function () {
await withFixtures( await withFixtures(
{ {
dapp: true, dapp: true,
@ -363,7 +370,7 @@ describe('Custom network', function () {
); );
}); });
it('Add a custom network and then delete that same network', async function () { it('Delete the Arbitrum network', async function () {
await withFixtures( await withFixtures(
{ {
fixtures: new FixtureBuilder() fixtures: new FixtureBuilder()
@ -398,21 +405,13 @@ describe('Custom network', function () {
tag: 'div', tag: 'div',
}); });
await driver.clickElement({ // Click first Delete button
tag: 'button', await driver.clickElement('button.btn-danger');
text: 'Delete',
});
await driver.waitForSelector('.modal-container__footer', { // Click modal Delete button
timeout: 15000, await driver.clickElement('button.btn-danger-primary');
});
// should be deleted from the modal shown again to complete deletion custom network
await driver.clickElement({
tag: 'button',
text: 'Delete',
});
// it checks if custom network is delete // Checks if Arbitrum is deleted
const existNetwork = await driver.isElementPresent(arbitrumNetwork); const existNetwork = await driver.isElementPresent(arbitrumNetwork);
assert.equal(existNetwork, false, 'Network is not deleted'); assert.equal(existNetwork, false, 'Network is not deleted');
}, },