Skip to content

Commit dd44146

Browse files
authored
Try to reduce flake in a vitest browser test (#3353)
Tentative fix for an intermittent Firefox Vitest browser flake seen in [this run](https://github.com/oxidecomputer/console/actions/runs/32997554927/job/98270746108) and [earlier](https://github.com/oxidecomputer/console/actions/runs/32167049254/job/95809059849), where Escape occasionally leaves the ActionMenu open. `userEvent.type(search, '{Escape}')` explicitly focuses the search input before sending Escape, which may prevent Firefox CI from missing the key. Could not repro the flake locally even with CPU maxed out, so I really have no idea if this will work.
1 parent d44615b commit dd44146

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
- Treat Vitest browser specs as small e2e tests: query by accessible role, label, or visible text and use retrying browser matchers. Avoid selectors coupled to CSS classes or internal DOM structure; inspect layout or computed styles only when the behavior has no semantic representation.
3434
- For sweeping styling changes, coordinate with the visual regression harness and follow `test/visual/README.md` for the workflow.
3535
- Fix root causes of flaky timing rather than adding `sleep()` workarounds in tests.
36+
- When an intermittent browser or E2E failure does not reproduce under normal repetition, retry under controlled CPU contention before concluding it is CI-only. Keep the load bounded so the browser and test runner can still make progress, enable failure-only traces when available, and use a shell trap to clean up every churn process.
3637
- Local Playwright runs write a compact plain-text report to `.e2e-logs/` (gitignored, one timestamped `.log` per run, last 10 kept) via the custom reporter at `test/e2e/compact-reporter.ts`. Top line is `status: ... total=N passed=N ...`; each failure is a `── UNEXPECTED|FLAKY file:line title` block followed by the error (ANSI stripped). Latest run: `ls .e2e-logs | tail -1` — Read it directly, no parsing needed.
3738

3839
# Data fetching pattern

app/ui/lib/ActionMenu.browser.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ test('filters items and resets the search when dismissed', async () => {
6767
.element(screen.getByRole('option', { name: 'New instance' }))
6868
.not.toBeInTheDocument()
6969

70-
await userEvent.keyboard('{Escape}')
70+
// Target the input because global keyboard input can miss it in Firefox CI.
71+
await userEvent.type(search, '{Escape}')
7172
await expect
7273
.element(screen.getByRole('dialog', { name: 'Quick actions' }))
7374
.not.toBeInTheDocument()

0 commit comments

Comments
 (0)