From 041c33ec55ef7a4aa6be867cb0b6032e5195bcdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 23 Oct 2026 13:13:48 +0200 Subject: [PATCH] test(e2e): wait for hover transitions to settle before the check-in axe scans The scan waited a fixed 300 ms after moving the pointer away. It now waits until no CSS transition is running, which is the state the wait stood for. --- e2e/mental-health-check-in.spec.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/e2e/mental-health-check-in.spec.ts b/e2e/mental-health-check-in.spec.ts index 85440382e..399bf49f2 100644 --- a/e2e/mental-health-check-in.spec.ts +++ b/e2e/mental-health-check-in.spec.ts @@ -42,9 +42,16 @@ const CASES: readonly Case[] = [ async function expectNoSeriousViolations(page: Page, label: string) { // The pointer rests where the last tap landed; a hover tint under it is - // not what the screen shows at rest. + // not what the screen shows at rest. Moving it away starts the tint's + // transition back, so the scan waits for every transition to settle rather + // than for a guessed number of milliseconds. Transitions only: a spinner's + // or a skeleton's endless animation would never settle. await page.mouse.move(0, 0); - await page.waitForTimeout(300); + await page.waitForFunction(() => + document + .getAnimations() + .every((a) => !(a instanceof CSSTransition) || a.playState !== "running"), + ); const results = await new AxeBuilder({ page }) .include( '[data-slot="mental-health-check-in"], [data-slot="mental-health-result"]',