Skip to content

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

Merged
tlongwell-block merged 1 commit into
mainfrom
fix-channel-browser-escape-race
Jul 19, 2026
Merged

test(desktop): fix Escape-before-mount race in channel browser e2e#2101
tlongwell-block merged 1 commit into
mainfrom
fix-channel-browser-escape-race

Conversation

@morgmart

Copy link
Copy Markdown
Contributor

Why

channel-browser.spec.ts:251 › canceling section create does not affect the next global create fails intermittently in CI — it's currently red on at least two unrelated branches (#2097 and cynthiac/profile-polish), and it never reproduces locally on a fast machine.

Root cause

The test clicks quick-create and sends Escape on the very next line:

await page.getByTestId(`section-actions-${CUSTOM_SECTION.id}-quick-create`).click();
await page.keyboard.press("Escape");
await expect(page.getByTestId("channel-browser-dialog")).not.toBeVisible();

On a slow runner the dialog hasn't mounted when Escape lands, so the keypress hits no handler and is dropped. not.toBeVisible() then passes vacuously — the dialog isn't merely hidden, it doesn't exist yet. The dialog mounts after the assertion, and its data-state="open" overlay intercepts pointer events for the rest of the test, timing out the next quick-create click at 30s.

That's why the CI log shows an overlay that is open rather than animating closed:

<div data-state="open" ... data-testid="dialog-overlay" ...> intercepts pointer events

A probe confirmed the sequence directly — at the instant the spec asserts "not visible," dialog-overlay count is 0, and the overlay appears immediately afterward.

Fix

Gate on the dialog actually being visible before dismissing it — the pattern this same file already uses at line ~498 — then wait for the overlay to detach so it can't outlive the content by one exit animation and swallow the next click.

Testing

A/B under 20× CDP CPU throttling (imitating the CI runner):

sequence result
old (no mount gate) fails — reproduces the exact CI error, dialog-overlay ... intercepts pointer events
new (this PR) passes

Full spec channel-browser.spec.ts: 29/29 serial. Test-only change — no product code touched.

"canceling section create does not affect the next global create" sends
Escape immediately after clicking quick-create. On a slow runner the
dialog hasn't mounted yet, so the keypress lands with no handler and is
dropped — and the follow-up not.toBeVisible() passes vacuously against a
dialog that hasn't rendered. The dialog then mounts *after* the
assertion and its overlay intercepts every subsequent click, timing out
the next quick-create at 30s.

Gate on the dialog being visible before dismissing it (the pattern this
file already uses further down), and wait for the overlay to detach so it
can't outlive the content by an exit animation and eat the next click.

Verified by A/B under 20x CDP CPU throttling: the old sequence reproduces
the exact CI error ("dialog-overlay ... intercepts pointer events",
data-state="open"), the new one passes. Full spec: 29/29.

Co-Authored-By: Claude <noreply@anthropic.com>
@morgmart
morgmart requested a review from a team as a code owner July 18, 2026 23:49
@tlongwell-block
tlongwell-block merged commit d011c3f into main Jul 19, 2026
25 checks passed
@tlongwell-block
tlongwell-block deleted the fix-channel-browser-escape-race branch July 19, 2026 00:05
tlongwell-block pushed a commit that referenced this pull request Jul 19, 2026
Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
Co-authored-by: Tyler Longwell <tlongwell@block.xyz>

* origin/main:
  test(desktop): fix Escape-before-mount race in channel browser e2e (#2101)
  style(desktop): match PendingInviteGate to startup interstitials (#2097)
  Remove additional agents gallery (#2098)
  fix(agents): stop the reply loop and the premature kickoff closer (#2094)
  chore(release): release Buzz Desktop version 0.4.18 (#2091)
  fix(desktop): recover first community joins (#2087)
  fix(chart): support CPU-only relay autoscaling (#2086)
  feat(chart): add relay horizontal autoscaling (#2077)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants