Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

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

Cindy Zhange191eed02757
diff --git a/packages/core/src/Spinner/__tests__/SpinnerMotion.a11y.chromium.spec.ts b/packages/core/src/Spinner/__tests__/SpinnerMotion.a11y.chromium.spec.ts
index 338bab7c38..98b60be3c4 100644
--- a/packages/core/src/Spinner/__tests__/SpinnerMotion.a11y.chromium.spec.ts
+++ b/packages/core/src/Spinner/__tests__/SpinnerMotion.a11y.chromium.spec.ts
@@ -203,6 +203,13 @@ test('the ring keeps turning while a script holds the main thread', async ({
test('turning paints nothing on the main thread', async ({page}) => {
await openSizes(page);
await page.waitForTimeout(200);
+ // Clearing the mount announcement repaints the shared live region, not the
+ // rotor. Let it clear before measuring steady-state motion.
+ await page.waitForFunction(() =>
+ Array.from(document.querySelectorAll('[data-astryx-live-region]')).every(
+ region => region.textContent === '',
+ ),
+ );
// Four rings turn for two seconds. A paint animation repaints every frame;
// a transform animation paints none. React listens for
// `animationiteration`, so Chromium recalculates style a few times at each