test(desktop): fix Escape-before-mount race in channel browser e2e (#2101)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
morgmart
2026-07-18 20:04:57 -04:00
committed by GitHub
co-authored by Claude
parent 68bd8630e0
commit d011c3f747
@@ -257,8 +257,16 @@ test("canceling section create does not affect the next global create", async ({
await page
.getByTestId(`section-actions-${CUSTOM_SECTION.id}-quick-create`)
.click();
// Gate on the dialog mounting before dismissing it. Escape sent before mount
// is dropped (no handler yet), and not.toBeVisible() then passes vacuously
// against a dialog that hasn't rendered — so the dialog opens *after* the
// assertion and its overlay swallows every later click.
await expect(page.getByTestId("channel-browser-dialog")).toBeVisible();
await page.keyboard.press("Escape");
await expect(page.getByTestId("channel-browser-dialog")).not.toBeVisible();
// The overlay outlives the content by one exit animation; wait for it to
// detach so it can't intercept the next click.
await expect(page.getByTestId("dialog-overlay")).toHaveCount(0);
await page.getByTestId("section-actions-channels-quick-create").click();
const channelName = `global-after-cancel-${Date.now()}`;