From 90834c4da2dfa5a1487ff68dfa2ce2d227c9f139 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 11 Nov 2026 00:44:32 -0300 Subject: [PATCH] Check the headline glide through engine transitions, not timed samples CI on main failed in Firefox after #15: 300 ms after hover the first colour stop still read its resting value, and 1.5 s later it read the final value. A hidden CI window can advance animations too rarely for a timed mid-point sample, so the test asserted timing, not behaviour. The test now asks the engine for the CSSTransitions it created: three 900 ms transitions on the registered colour stops on hover and on leave, none under reduced motion, and the resting and final colours. It still fails against the pre-#15 CSS and passes 3/3 repeated runs in Firefox, WebKit and Chromium. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JBgAhZ6s45DnrKXbhbwYet --- tests/browser/interface.spec.mjs | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/tests/browser/interface.spec.mjs b/tests/browser/interface.spec.mjs index 5b9e824..4536a52 100644 --- a/tests/browser/interface.spec.mjs +++ b/tests/browser/interface.spec.mjs @@ -172,19 +172,35 @@ test("the headline gradient glides on hover and back, and stays still when motio title.evaluate((node) => getComputedStyle(node).getPropertyValue("--title-stop-1").trim(), ); + // Ask the engine for the transition it created instead of sampling colours + // on a timer: hidden CI windows can redraw too rarely to observe mid-points. + const transitions = () => + title.evaluate((node) => + node + .getAnimations() + .filter((animation) => animation.transitionProperty) + .map((animation) => [ + animation.transitionProperty, + animation.effect.getTiming().duration, + ]) + .sort(([a], [b]) => a.localeCompare(b)), + ); + const glide = [ + ["--title-stop-1", 900], + ["--title-stop-2", 900], + ["--title-stop-3", 900], + ]; const rest = await stop(); await title.hover(); - await page.waitForTimeout(300); - const between = await stop(); - await page.waitForTimeout(1200); - const hovered = await stop(); - expect(hovered).not.toBe(rest); - expect([rest, hovered]).not.toContain(between); + expect(await transitions()).toEqual(glide); + await expect.poll(transitions, { timeout: 4000 }).toEqual([]); + expect(await stop()).not.toBe(rest); await page.mouse.move(5, 5); - await expect.poll(stop, { timeout: 3000 }).toBe(rest); + expect(await transitions()).toEqual(glide); + await expect.poll(stop, { timeout: 4000 }).toBe(rest); await page.emulateMedia({ reducedMotion: "reduce" }); await title.hover(); - await page.waitForTimeout(300); + expect(await transitions()).toEqual([]); expect(await stop()).toBe(rest); });