Files
compiler-explorer/cypress/support
Matt Godbolt (bot acct) 36d2d7e6be Fix flaky pane tests: wait for initial compile before opening dropdown (#8822)
Fixes #8815.

The "Individual pane testing" `beforeEach` opened the add-pane dropdown
(and force-enabled its buttons) immediately after `cy.visit('/')`. The
initial compilation's result handler calls `updateButtons()`,
re-rendering the dropdown contents — if that landed between Cypress
locating a pane button and clicking it, the click failed with `page
updated while this command was executing`. It always hit the *Clojure
Macro* pane because panes few compilers support are exactly the buttons
whose state changes when compiler capabilities arrive.
`claude-explain.cy.ts`'s pane opener had the identical unguarded click.

The wait helpers are layered, not parallel:
- `waitForCompilationToSettle()` (new primitive): the compile status
icon reaches a terminal state (`fa-check-circle`/`fa-times-circle`). The
result handler calls `updateButtons()` immediately *before* setting that
icon (`compiler.ts:1930-1932`), so the signal is ordered after the
hazard. Works for any source, successful or failed, and for recompiles
after content changes.
- `setupAndWaitForCompilation()` (existing helper, now built on the
primitive): adds the default-source `'square'` output assertion, as
before.

The pane tests use `setupAndWaitForCompilation()`;
`openClaudeExplainPane()` uses the primitive because several of its
tests replace the default source (whose output assertion would then
fail) before opening the pane.

Verified locally against the CI server configuration (`npm run dev --
--language c++ --no-local`): `frontend.cy.ts` (24),
`claude-explain.cy.ts` (16), and `compile.cy.ts` (14, exercising the
rebuilt helper) all pass. Being a flake fix, repeated CI runs are the
real proof; the failure hit at least 4 times today across unrelated PRs,
so a regression should surface quickly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-06-14 20:18:14 +01:00
..