Skip to content

test(e2e): settle the sidebar toggle after the breakpoint change - #1326

Merged
agegr merged 1 commit into
agegr:mainfrom
brynne8:test/e2e-sidebar-toggle-settle
Oct 20, 2026
Merged

agegr merged 1 commit into
agegr:mainfrom
brynne8:test/e2e-sidebar-toggle-settle

Conversation

@brynne8

@brynne8 brynne8 commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

What it does

Makes the sidebar-toggle wait after the mobile→desktop breakpoint change deterministic
instead of racy, in e2e/run.mjs only.

Returning from the mobile breakpoint restores the desktop sidebar preference in an effect,
so the toggle can swap from Show sidebar to Hide sidebar between the isVisible()
check and the click. The click then waits its full 30s for a button that will not come back.

The change retries the click against a short deadline (5 attempts, 1s each, 200ms apart) and
ignores only that attempt's own timeout. The hideSidebar.waitFor(...) that follows is
unchanged, so if the sidebar never opens the test still throws rather than passing.

Why it matters

The flake is not ours and not caused by any product change. The observed CI failure:

locator.click: Timeout 30000ms exceeded.
waiting for getByRole('button', { name: 'Show sidebar', exact: true })
  - locator resolved to hidden <button …>Show sidebar</button>
at e2e/run.mjs:496:60

It has flaked at least three unrelated PRs: #1322, #1324 and another contributor's #1308.
Each red run costs a full e2e re-run and obscures real regressions in the same job.

Note the fork's earlier 947c7fe does not cover this signature: its reload fallback only
fires when neither toggle appears within 10s, whereas here a toggle is present and the race
is between the check and the click.

Scope

One test-stability change on today's main; one change per PR. No product code, no other
tests, no reformatting.

Testing

  • bun run lint — clean.
  • bun x tsc --noEmit — clean.
  • npm test (Node 26.7.0) — 2777 passed, 0 failed, 1 skipped.
  • Local npm run test:e2e was not run: upstream's e2e/run.mjs launches Chromium and no
    Chromium binary is installed in this environment (Executable doesn't exist at …/chromium_headless_shell-1243/…). Only WebKit is present. The race is intermittent, so a
    local clean run would not have proved much either; CI is the real check.

Provenance

Derived from the fork's 947c7fe / 314fc57 sidebar-toggle stabilisation, extended for the
check-then-click signature those commits do not cover.

Returning from the mobile breakpoint restores the desktop sidebar preference in an
effect, so the toggle can swap from "Show sidebar" to "Hide sidebar" between the
`isVisible()` check and the click. The click then waits its full 30s for a button
that will not come back, and the suite dies with

  locator.click: Timeout 30000ms exceeded. waiting for
  getByRole('button', { name: 'Show sidebar', exact: true }) at e2e/run.mjs:496:60

Seen on several unrelated PRs (agegr#1322, agegr#1324 ourselves, agegr#1308 from another
contributor).

The click now retries against a short deadline and only its own timeout is
ignored; the wait for "Hide sidebar" that follows still fails if the sidebar never
opens, so a real regression is not hidden. The fork's earlier 947c7fe reload
fallback does not cover this signature: it fires only when neither toggle appears
within its 10s bound.
@agegr

agegr commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Thanks @brynne8, this is the right fix. The recent CI failures at run.mjs:496 all show the click waiting for "Show sidebar": it is one button whose label switches, so when the isMobile effect reopens the sidebar between isVisible() and click(), the click waits out its 30 s. I checked the loop against a mock toggle: if the sidebar never opens, the final waitFor still fails, and a click that lands just as the label switches (closing the sidebar again) is reopened on the next attempt. It also passed three full e2e runs merged with main. One small note: the CI logs show waiting for getByRole(...) rather than "resolved to hidden", but the code comment describes it correctly. Good to merge.

@agegr
agegr merged commit a26d85f into agegr:main Oct 20, 2026
2 checks passed
@KD-MM2 KD-MM2 mentioned this pull request Oct 21, 2026
4 tasks
windli2018 pushed a commit to aiti-ai/aiti-ai that referenced this pull request Nov 6, 2026
…gr#1326)

Returning from the mobile breakpoint restores the desktop sidebar preference in an
effect, so the toggle can swap from "Show sidebar" to "Hide sidebar" between the
`isVisible()` check and the click. The click then waits its full 30s for a button
that will not come back, and the suite dies with

  locator.click: Timeout 30000ms exceeded. waiting for
  getByRole('button', { name: 'Show sidebar', exact: true }) at e2e/run.mjs:496:60

Seen on several unrelated PRs (agegr#1322, agegr#1324 ourselves, agegr#1308 from another
contributor).

The click now retries against a short deadline and only its own timeout is
ignored; the wait for "Hide sidebar" that follows still fails if the sidebar never
opens, so a real regression is not hidden. The fork's earlier 947c7fe reload
fallback does not cover this signature: it fires only when neither toggle appears
within its 10s bound.
windli2018 pushed a commit to aiti-ai/aiti-ai that referenced this pull request Nov 8, 2026
…gr#1326)

Returning from the mobile breakpoint restores the desktop sidebar preference in an
effect, so the toggle can swap from "Show sidebar" to "Hide sidebar" between the
`isVisible()` check and the click. The click then waits its full 30s for a button
that will not come back, and the suite dies with

  locator.click: Timeout 30000ms exceeded. waiting for
  getByRole('button', { name: 'Show sidebar', exact: true }) at e2e/run.mjs:496:60

Seen on several unrelated PRs (agegr#1322, agegr#1324 ourselves, agegr#1308 from another
contributor).

The click now retries against a short deadline and only its own timeout is
ignored; the wait for "Hide sidebar" that follows still fails if the sidebar never
opens, so a real regression is not hidden. The fork's earlier 947c7fe reload
fallback does not cover this signature: it fires only when neither toggle appears
within its 10s bound.
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