Skip to content

Commit e8e2636

Browse files
committed
fix(functional-tests): guard teardown against slow stage navigation
The "Delete test user accounts" teardown fails the same way across runs. Line 38 clicks "Open user menu" before the page settles, so a slow stage redirect detaches the frame. Line 55 waits for an exact /en URL, which aborts when the app lands on a path with a trailing segment. Wait for the menu button to be visible before clicking. Loosen the post-delete URL wait to match the /en prefix.
1 parent f301e14 commit e8e2636

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

functional-tests/tests/global-teardown.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ async function deleteTestUserAccounts(browser: Browser) {
3535

3636
await page.goto(`${getBaseTestEnvUrl()}/user/settings/manage-account`);
3737

38-
await page.getByRole("button", { name: "Open user menu" }).click();
38+
// Stage can redirect slowly. Wait for the menu button before clicking so
39+
// we don't race an in-flight navigation.
40+
const userMenuButton = page.getByRole("button", { name: "Open user menu" });
41+
await userMenuButton.waitFor({ state: "visible" });
42+
await userMenuButton.click();
3943
const manageAccountLink = page.getByRole("menuitem", {
4044
name: "Manage your ⁨Mozilla account⁩",
4145
exact: false,
@@ -52,7 +56,10 @@ async function deleteTestUserAccounts(browser: Browser) {
5256
name: "Delete account",
5357
});
5458
await deleteButtonConfirm.click();
55-
await page.waitForURL(`${getBaseTestEnvUrl()}/en`);
59+
// After deletion the app redirects to the localized home page. Match the
60+
// /en prefix instead of an exact URL so a trailing path or query does not
61+
// abort the wait.
62+
await page.waitForURL(`${getBaseTestEnvUrl()}/en**`);
5663

5764
await page.goto(manageFxaAccountUrl!);
5865
await page.getByRole("link", { name: "Delete Account" }).click();

0 commit comments

Comments
 (0)