Repository navigation
test(interaction-harness): the frame-evidence trace judges one layout per frame the page drew - #9456
Conversation
… per frame the page drew "the trace counts no Layout for a transform animation and one per frame for `top`" required more than 18 layouts in a 400 ms window of a `top` animation: 24 frames at 60 Hz. A loaded runner draws fewer frames, and the check failed with 18 and 11 layouts, one per frame it drew, with nothing wrong in the harness. The page now records when it drew each frame of the animation (its rAF times), and the check counts those frames in the same window: at least 4 to judge, and a layout for each of them, less one for a frame the window's end splits. The transform half is unchanged.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
This looks good to merge: counting the frames the page actually drew keeps the top check passing on a slow runner, and an animation that skips per-frame layout (steps(4)) still fails it. One optional tidy-up: the frame recorder also runs during the transform half, where it adds a style recalculation per frame (Layout and Paint stay 0). Either start it only for top, or drop "The transform half is unchanged" from the description and commit message.
[Automated review]
| const animation = el.animate(keyframes, {duration: 600}); | ||
| const drawn: number[] = []; | ||
| (window as unknown as {drawn: number[]}).drawn = drawn; | ||
| const frame = (time: number) => { | ||
| drawn.push(performance.timeOrigin + time); | ||
| if (animation.playState === 'running') { | ||
| requestAnimationFrame(frame); | ||
| } | ||
| }; | ||
| requestAnimationFrame(frame); |
There was a problem hiding this comment.
Optional: this recorder also runs for the transform call, so that half now has a main-thread frame and a style recalculation every frame (Layout and Paint stay 0). If it should match main, start it only when prop === 'top'; otherwise the description's "The transform half is unchanged" could mention it.
Maintainer impact
The interaction harness's own spec fails now and then on a loaded runner in "frame evidence › the trace counts no Layout for a transform animation and one per frame for
top".topanimation: the 24 frames 400 ms holds at 60 Hz.Intended invariant
A layout-property animation lays out on every frame the page draws, and a transform animation lays out and paints on none. Both claims are judged against the frames actually drawn, whatever their rate.
Change
topanimation runs, the page records when it drew each frame (its rAF times).Evidence
topanimation runs, so fewer frames are drawn. Main fails 3 of 3 with "Expected: > 18, Received: 13", the shape seen on loaded runners.topin four steps (steps(4)), so it lays out on 4 of the frames drawn. It fails 3 of 3: Layout 3 against at least 23 frames.Scope
Testing
internal/interaction-harness/src/harness.interaction.browser.spec.tsin Chromium (playwright.interaction.config.ts).Local gates at 3e66124:
pnpm lint(0 errors);