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.
This commit is contained in:
Marc-André Bombeck committed 2026-10-23 13:13:48 +02:00
1 parent de970ac079
commit 041c33ec55
1 file changed
+9 -2
+9 -2
View File
@@ -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"]',