Skip to content

test(Spinner): wait for announcements before tracing rotor paints - #10195

Merged
imdreamrunner merged 1 commit into
mainfrom
recut/test-spinner-wait-for-announcements
Nov 6, 2026
Merged

imdreamrunner merged 1 commit into
mainfrom
recut/test-spinner-wait-for-announcements

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Supersedes #10174 (co-authored by astracat-bot)

The same change as #10174, byte for byte, re-cut on current main from 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=chromium against 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 uses pnpm 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.

Co-authored-by: astracat-bot[bot] <323722387+astracat-bot[bot]@users.noreply.github.com>
@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 6, 2026
@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 6, 2026 1:26am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 6, 2026
@astracat-bot

astracat-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 6, 2026, 1:35 AM UTC

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 35d0a66

Storybook · Sandbox · built from this PR's head

Modified components

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

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

@cixzhang
cixzhang marked this pull request as draft November 6, 2026 01:48
@cixzhang
cixzhang marked this pull request as ready for review November 6, 2026 01:48
@imdreamrunner
imdreamrunner merged commit e191eed into main Nov 6, 2026
149 of 164 checks passed
@cixzhang
cixzhang deleted the recut/test-spinner-wait-for-announcements branch November 6, 2026 03:42

This branch was successfully deployed

1 active deployment
Preview — 35d0a664 Deployed Nov 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants