Repository navigation
test(Spinner): wait for announcements before tracing rotor paints - #10195
Conversation
Co-authored-by: astracat-bot[bot] <323722387+astracat-bot[bot]@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Spinner · Storybook | 20.3 kB (0) · 6.1 kB CSS (0) | 351 (0) | ✓ · ✓ · — |
Package size: no published package changed; no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 19 rows, core 19 rows; run pnpm api:report.
Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.
Current run: CI concluded cancelled; parts of this report may be missing.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Approved pending CI: the CI run on this head was cancelled with "CI is full" before its build and test jobs ran, so it needs a re-run.
The added wait lets the shared live region's scheduled clear of the Spinners' "Loading" announcement finish before the rendering trace starts, so the paint assertion again measures only the turning ring. On one Storybook build, the paint test fails on the base with one Paint and passes with this change, and a ring given a per-frame paint still fails it.
[Automated review]
Supersedes #10174 (co-authored by astracat-bot)
The same change as #10174, byte for byte, re-cut on current
mainfrom a maintainer branch with the bot as co-author.Maintainer impact
The Spinner motion contract fails on main with one Paint event where it expects zero. The failure reproduces on all three runs of the unchanged test at 1ef21f8.
Intended invariant
The motion test measures the ring's steady-state compositor animation, as described by the Spinner contract's motion verification map. The standalone Spinner also announces loading through the shared channel, and AST-086 FR9 requires that channel to clear its text shortly afterward. That one-time clear is not a rotor repaint.
Change
Wait for the shared live regions to become empty before starting the rendering trace. The new mount announcement's two-second clear previously fell inside the two-second tracing window and caused the unrelated Paint event. This change separates setup from the motion measurement without disabling announcements or removing any trace events. The measurement duration, zero-Paint and zero-Layout assertions, style-recalculation bound, and test timeout are unchanged.
No behavior change. Only seven lines of test setup are added; component code, stories, public APIs, visual direction, and policy are unchanged. No Changeset is needed.
Evidence
The original test fails 3/3 runs with Paint = 1. With the setup fix, it passes 5/5 repeated runs, and all six tests in SpinnerMotion.a11y.chromium.spec.ts pass, including the busy-main-thread, timing, reduced-motion, phase, and storyboard checks. A temporary SVG stroke animation still fails the corrected test with Paint = 240; that mutation is removed.
The 65 Spinner unit tests pass. The Storybook build,
pnpm check:repo, strict ESLint for the changed file, Prettier, diff whitespace check, and pre-review report pass. The pre-review report has no findings.Testing
Run
pnpm exec playwright test packages/core/src/Spinner/__tests__/SpinnerMotion.a11y.chromium.spec.ts --config=playwright.config.ts --project=chromiumagainst a built Storybook. The repeated regression check uses the same command with--grep='turning paints nothing on the main thread' --repeat-each=5. Unit coverage usespnpm exec vitest run packages/core/src/Spinner/Spinner.test.tsx --project ui --maxWorkers=1.Review note
The test now waits for the actual announcement lifecycle rather than guessing a longer delay. It also permits no shared regions when page-load announcements are suppressed. I considered silencing the story's Spinners, but kept their normal accessibility behavior intact and scoped the correction to tracing setup instead. Full repository unit tests and package builds were not run; validation is focused on the changed browser contract and unchanged Spinner behavior.