Skip to content

Sleep after closing toast in E2E to reduce flake - #1832

Merged
david-crespo merged 1 commit into
mainfrom
e2e-modal-fade-sleep
Dec 4, 2023
Merged

david-crespo merged 1 commit into
mainfrom
e2e-modal-fade-sleep

Conversation

@david-crespo

@david-crespo david-crespo commented Dec 4, 2023 •

Copy link
Copy Markdown
Collaborator

The tests have passed a bunch of times in a row, but flake being flake, that doesn't prove anything. Will revert if we see the flake again.

@vercel

vercel Bot commented Dec 4, 2023

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Dec 4, 2023 9:14pm

@david-crespo david-crespo changed the title ignore, testing Sleep after closing toast in E2E to reduce flake Dec 4, 2023
@david-crespo
david-crespo marked this pull request as ready for review December 4, 2023 22:13
@david-crespo
david-crespo enabled auto-merge (squash) December 4, 2023 22:22
@david-crespo
david-crespo merged commit faadb6d into main Dec 4, 2023
@david-crespo
david-crespo deleted the e2e-modal-fade-sleep branch December 4, 2023 22:30
david-crespo added a commit to oxidecomputer/omicron that referenced this pull request Dec 7, 2023
oxidecomputer/console@ae8218d...1802c28

* [1802c285](oxidecomputer/console@1802c285) oxidecomputer/console#1839
* [ce09b547](oxidecomputer/console@ce09b547) bump postcss-pseudo-classes for fake vuln
* [e09b803b](oxidecomputer/console@e09b803b) might as well get vitest 1.0 in there too
* [83dd73ee](oxidecomputer/console@83dd73ee) minor bumps for react router, msw, vite, tailwind, recharts
* [6ae6beeb](oxidecomputer/console@6ae6beeb) oxidecomputer/console#1829
* [a0bf47aa](oxidecomputer/console@a0bf47aa) oxidecomputer/console#1836
* [6c9420ad](oxidecomputer/console@6c9420ad) oxidecomputer/console#1835
* [64e97b01](oxidecomputer/console@64e97b01) api-diff also takes a commit
* [22bef0bb](oxidecomputer/console@22bef0bb) oxidecomputer/console#1833
* [2fe50f51](oxidecomputer/console@2fe50f51) oxidecomputer/console#1810
* [faadb6d3](oxidecomputer/console@faadb6d3) oxidecomputer/console#1832
* [9e82f9ab](oxidecomputer/console@9e82f9ab) oxidecomputer/console#1811
* [5e11fd83](oxidecomputer/console@5e11fd83) tweak api-diff
* [dae20577](oxidecomputer/console@dae20577) oxidecomputer/console#1827
* [ed0ef62e](oxidecomputer/console@ed0ef62e) minor tweaks to api-diff script
* [1c790d27](oxidecomputer/console@1c790d27) oxidecomputer/console#1819
* [97be7724](oxidecomputer/console@97be7724) oxidecomputer/console#1826
* [87f4d8b8](oxidecomputer/console@87f4d8b8) oxidecomputer/console#1814
* [65ae1212](oxidecomputer/console@65ae1212) oxidecomputer/console#1820
* [5a6dcea7](oxidecomputer/console@5a6dcea7) oxidecomputer/console#1822
* [4e1bbe13](oxidecomputer/console@4e1bbe13) oxidecomputer/console#1821
* [17408f64](oxidecomputer/console@17408f64) oxidecomputer/console#1813
david-crespo added a commit to oxidecomputer/omicron that referenced this pull request Dec 7, 2023
### User-facing changes

* [1802c285](oxidecomputer/console@1802c285)
oxidecomputer/console#1839
* [6ae6beeb](oxidecomputer/console@6ae6beeb)
oxidecomputer/console#1829
* [a0bf47aa](oxidecomputer/console@a0bf47aa)
oxidecomputer/console#1836
* [9e82f9ab](oxidecomputer/console@9e82f9ab)
oxidecomputer/console#1811
* [5a6dcea7](oxidecomputer/console@5a6dcea7)
oxidecomputer/console#1822

### All changes

oxidecomputer/console@ae8218d...1802c28

* [1802c285](oxidecomputer/console@1802c285)
oxidecomputer/console#1839
* [ce09b547](oxidecomputer/console@ce09b547)
bump postcss-pseudo-classes for fake vuln
* [e09b803b](oxidecomputer/console@e09b803b)
might as well get vitest 1.0 in there too
* [83dd73ee](oxidecomputer/console@83dd73ee)
minor bumps for react router, msw, vite, tailwind, recharts
* [6ae6beeb](oxidecomputer/console@6ae6beeb)
oxidecomputer/console#1829
* [a0bf47aa](oxidecomputer/console@a0bf47aa)
oxidecomputer/console#1836
* [6c9420ad](oxidecomputer/console@6c9420ad)
oxidecomputer/console#1835
* [64e97b01](oxidecomputer/console@64e97b01)
api-diff also takes a commit
* [22bef0bb](oxidecomputer/console@22bef0bb)
oxidecomputer/console#1833
* [2fe50f51](oxidecomputer/console@2fe50f51)
oxidecomputer/console#1810
* [faadb6d3](oxidecomputer/console@faadb6d3)
oxidecomputer/console#1832
* [9e82f9ab](oxidecomputer/console@9e82f9ab)
oxidecomputer/console#1811
* [5e11fd83](oxidecomputer/console@5e11fd83)
tweak api-diff
* [dae20577](oxidecomputer/console@dae20577)
oxidecomputer/console#1827
* [ed0ef62e](oxidecomputer/console@ed0ef62e)
minor tweaks to api-diff script
* [1c790d27](oxidecomputer/console@1c790d27)
oxidecomputer/console#1819
* [97be7724](oxidecomputer/console@97be7724)
oxidecomputer/console#1826
* [87f4d8b8](oxidecomputer/console@87f4d8b8)
oxidecomputer/console#1814
* [65ae1212](oxidecomputer/console@65ae1212)
oxidecomputer/console#1820
* [5a6dcea7](oxidecomputer/console@5a6dcea7)
oxidecomputer/console#1822
* [4e1bbe13](oxidecomputer/console@4e1bbe13)
oxidecomputer/console#1821
* [17408f64](oxidecomputer/console@17408f64)
oxidecomputer/console#1813
david-crespo added a commit that referenced this pull request Nov 13, 2026
I looked into speeding up local e2e runs and fixing some flakes we keep
seeing in CI. Not sure whether the speedup is worth it here, but it is
pretty big for the occasional local full suite run.

### Speedup

A Playwright [trace](https://playwright.dev/docs/trace-viewer) is a
recording of a test run that you open in the trace viewer: a DOM
snapshot before and after each action, plus screenshots, network
requests and console output. Locally we ran with `trace:
'retain-on-failure'`, which records a trace for every test and throws it
away when the test passes. Local runs now default to `off`; pass
`--trace retain-on-failure` when chasing a flake (noted in AGENTS.md and
the `debug-e2e` skill). CI keeps `on-first-retry`, which only records on
retries.

Wall-clock time on my 14-core Mac, Chrome only, 9 workers (the local
default), with tracing on and off runs interleaved. Times include
starting the dev server.

| Run | Runs each | Tracing on | Tracing off | Saved |
| ---------------------------------------------------- | --------- |
------------------------- | --------------------------- | ----- |
| One test (`can resize a failed or stopped instance`) | 5 | 12.0–14.2 s
(median 12.1) | 11.3–12.1 s (median 11.5) | ~5% |
| `instance.e2e.ts` (19 tests) | 3 | 21.8–22.9 s (median 22.7) |
19.4–20.2 s (median 20.2)\* | ~11% |
| Full suite (429 tests) | 2 | 236.5–245.3 s | 182.7–183.0 s | ~24% |

\* The range leaves out a third tracing-off run that took 44.6 s. The
median includes it.

I also considered running e2e against the production build. Every test
starts in a fresh browser context, so every page load refetches every
unbundled module from the Vite dev server. The production build is
faster for the full suite: on the Mac, main took 210 s and the
production build with tracing off took 154–156 s (two runs each, 402
tests). But the build runs before every invocation, so a single test got
slower, 7.9 s against 6.2 s on the dev server, and the break-even is
probably somewhere around 20–30 tests. Locally we mostly run one file or
one test, and CI runs the full suite. Supporting both dev and prod
servers also meant some noisy fixes for 13 tests that assumed the dev
server, across 10 files, and e2e would no longer run with StrictMode
double effects or React dev warnings. It could still make sense for CI
later.

### Flakes

- **`support-bundles › bundle deleted mid-view 404s`** failed on Firefox
in 3 of the last 11 CI runs, once on [all three attempts on
main](https://github.com/oxidecomputer/console/actions/runs/43102126272).
It has 3 s to see the bundle in `destroying`, and the toast helpers
slept 1 s after every dismissal (added in #1832, nobody knew why). They
now wait for the toast to leave the DOM. On Firefox it went from 5/10
passing to 10/10, and 10 toast-heavy specs showed no new failures.
- **`vpcs › can nav to VpcPage from /`** failed its first attempt on
Chrome in 7 of the last 11 CI runs. The `VPCs` link locator also matched
the `project-no-vpcs` link in the projects table, still on screen on a
slow runner. With `exact: true` and Chrome's CPU throttled 2x, it went
from 0/20 passing to 20/20.
- **`route-announcer › route announcer`** failed on Firefox in 7 of the
last 11 CI runs. react-aria removes each announcement after 7 s, before
a slow runner gets to the assertion. The test now records announcements
as they appear. With a 7.5 s pause added after a nav, the old test
failed 5/5 on Firefox and the new one passed 5/5.
- Serial console (`theme.e2e.ts:99`), fixed in app/msw-mock-api.ts.
- Cause: the mock stream slept after each of 160 boot log lines, so on a
busy runner every late timer added to the total. With Firefox held to
the slow cores, the stream took 19 s instead of 4.8 s, against a 15 s
timeout.
- Fix: each line is now due at a fixed offset from the start, and late
lines go out together.
- Result: 0/6 → 6/6 with one worker on slow cores. With three workers it
was 0/9 → 3/9, where page load alone took about 10 s, which is harsher
than CI.
   - CI history: flaked in 11 of the last 120 runs, all Firefox.
- Scroll restore (`scroll-restore.e2e.ts:12`), fixed in
test/e2e/utils.ts.
- Cause: the test scrolled before web fonts loaded. When the fonts
arrived, the h1 above the viewport resized and scroll anchoring moved
scrollY from 143 to 140.5, which then got saved and restored.
- Fix: the scrollTo helper waits for document.fonts.ready first, which
covers all its callers.
- Result: 31/40 → 40/40. The unmodified spec didn't fail locally in 60
runs, so this was reproduced with a copy of the spec plus a no-op init
script under heavy CPU load.
- CI history: the most frequent of the three, 32 Firefox runs and 2
Chrome out of 120.
- Not fixed: a rarer failure in the same test ("expected 190, got 143",
once in CI and twice locally). The subagent's unconfirmed guess is that
useScrollRestoration skips saving when a nav has cached data.

This branch was successfully deployed

1 active deployment
Preview — 025aa83e Deployed Dec 4, 2023 by vercel[bot]
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.

1 participant