Skip to content

Commit ddcf79d

Browse files
committed
add comment and tweak
1 parent 54cf65f commit ddcf79d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

test/e2e/tests/request-queuing/ui.spec.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,19 @@ async function openDappAndSwitchChain(driver, dappUrl, chainId) {
6464

6565
async function selectDappClickSendGetNetwork(driver, dappUrl) {
6666
await driver.switchToWindowWithUrl(dappUrl);
67-
const currentWindowHandles = await driver.getAllWindowHandles();
67+
// Windows: MetaMask, TestDapp1, TestDapp2
6868
const expectedWindowHandles = 3;
69+
await driver.waitUntilXWindowHandles(expectedWindowHandles);
70+
const currentWindowHandles = await driver.getAllWindowHandles();
6971
await driver.clickElement('#sendButton');
7072

7173
// Under mv3, we don't need to add to the current number of window handles
7274
// because the offscreen document returned by getAllWindowHandles provides
7375
// an extra window handle
7476
const newWindowHandles = await driver.waitUntilXWindowHandles(
75-
process.env.ENABLE_MV3 ? expectedWindowHandles : expectedWindowHandles + 1,
77+
process.env.ENABLE_MV3
78+
? currentWindowHandles.length
79+
: currentWindowHandles.length + 1,
7680
);
7781
const [newNotificationWindowHandle] = newWindowHandles.filter(
7882
(h) => !currentWindowHandles.includes(h),

0 commit comments

Comments
 (0)