Skip to content

Commit f82b48a

Browse files
committed
Invitations from the organization switcher, and openTo waits for the page
The merge queue's run failed two things: - sidebar-current-row: #2644 moved Invitations into the account menu's organization switcher. The test opens the menu, styles it, then opens the switcher and chooses Invitations, and waits for both menus to close. - no-fixed-settle-waits: run-ended-unheard's openTo waited a fixed 250 ms while the finished turn was still being drawn. It waits for a closed line, or for what it is after, instead.
1 parent 5de3bcf commit f82b48a

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

‎app/tests/run-ended-unheard-layout.test.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,13 @@ async function openTo(page: Page, said: string) {
639639
}, level);
640640
for (let index = 0; index < count; index += 1)
641641
await page.locator(`summary[data-open-at="${level}"]`).nth(index).click();
642-
// Nothing to open yet: the finished turn is still being drawn.
643-
if (count === 0) await page.waitForTimeout(250);
642+
// Nothing to open yet: the finished turn is still being drawn, so wait for its line or `said`.
643+
if (count === 0)
644+
await page
645+
.locator("details:not([open]) > summary")
646+
.or(found)
647+
.first()
648+
.waitFor({ state: "attached", timeout: 15_000 });
644649
}
645650
await found.waitFor({ state: "attached", timeout: 15_000 });
646651
}

‎app/tests/sidebar-current-row.test.tsx‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,27 @@ describe.skipIf(!asked)("the strip on a page no section owns", () => {
240240
expect(named(onBots, "open")).toEqual(["Bots"]);
241241
expect(named(onBots, "current")).toEqual([]);
242242

243+
// Invitations is in the organization's switcher, the account menu's organization row
244+
// (#2644): it lists the invitations waiting, and this person has one.
245+
// Styled once the menu is open, before its row is pressed: styled after, the page moves
246+
// under a pointer that has not, and the switcher closes.
243247
await account.click();
244-
const entry = page.getByRole("menuitem", { name: /Invitations/ });
245-
await entry.waitFor();
248+
const switcher = page.locator(
249+
'[data-slot="organization-switcher"]',
250+
);
251+
await switcher.waitFor();
246252
await style(page);
247253
await still(page);
254+
await switcher.click();
255+
const entry = page.getByRole("menuitem", { name: /Invitations/ });
256+
await entry.waitFor();
248257
const box = await entry.boundingBox();
249258
await entry.click();
250259
await page.waitForURL(`${ORIGIN}/invitations`);
251-
await page.getByRole("menu").waitFor({ state: "detached" });
260+
// The account menu and its switcher both gone.
261+
await page.waitForFunction(
262+
() => document.querySelector('[role="menu"]') === null,
263+
);
252264
// A few frames for the browser to work out what is under the pointer now.
253265
await page.evaluate(
254266
() =>

0 commit comments

Comments
 (0)