Skip to content

Commit

Permalink
Fix flaky BIP-32 E2E test
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Oct 22, 2022
1 parent 8075a39 commit 6413607
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/e2e/snaps/test-snap-bip-32.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ describe('Test Snap bip-32', function () {
await driver.fill('#password', 'correct horse battery staple');
await driver.press('#password', driver.Key.ENTER);

// open a new tab and navigate to test snaps page and connect
await driver.openNewPage(TEST_SNAPS_WEBSITE_URL);
// navigate to test snaps page and connect
await driver.driver.get(TEST_SNAPS_WEBSITE_URL);
await driver.delay(1000);

// find and scroll to the correct card and click first
const snapButton = await driver.findElement('#sendUpdateHello');
Expand All @@ -36,7 +37,7 @@ describe('Test Snap bip-32', function () {
await driver.clickElement('#connectBip32');

// switch to metamask extension and click connect
await driver.waitUntilXWindowHandles(3, 5000, 10000);
await driver.waitUntilXWindowHandles(2, 5000, 10000);
let windowHandles = await driver.getAllWindowHandles();
await driver.switchToWindowWithTitle(
'MetaMask Notification',
Expand All @@ -50,9 +51,10 @@ describe('Test Snap bip-32', function () {
10000,
);

await driver.delay(1000);
await driver.delay(2000);

// approve install of snap
await driver.waitUntilXWindowHandles(2, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
await driver.switchToWindowWithTitle(
'MetaMask Notification',
Expand All @@ -73,7 +75,7 @@ describe('Test Snap bip-32', function () {
});

// switch back to test-snaps window
await driver.waitUntilXWindowHandles(2, 5000, 10000);
await driver.waitUntilXWindowHandles(1, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);

Expand All @@ -94,7 +96,7 @@ describe('Test Snap bip-32', function () {
tag: 'button',
});

await driver.waitUntilXWindowHandles(2, 5000, 10000);
await driver.waitUntilXWindowHandles(1, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);

Expand Down Expand Up @@ -124,7 +126,7 @@ describe('Test Snap bip-32', function () {
tag: 'button',
});

await driver.waitUntilXWindowHandles(2, 5000, 10000);
await driver.waitUntilXWindowHandles(1, 5000, 10000);
windowHandles = await driver.getAllWindowHandles();
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);

Expand Down

0 comments on commit 6413607

Please sign in to comment.