test(web): ignore scroll-driven animations when waiting for settled layout

The model selector's clipped-text fade runs on a scroll timeline, which
never finishes, so document-wide waits never settled.
This commit is contained in:
Turtle authored and Yudong Han committed 2026-10-22 12:48:28 +08:00
1 parent ca575ff573
commit bde671f984
2 files changed
+7 -4

No files matched your search

+2 -1
View File
@@ -57,7 +57,8 @@ describe.skipIf(webSnapshotMode() === 'record')('web e2e: context details placem
})
await page.evaluate(async () => {
await Promise.all(document.getAnimations()
.filter(animation => animation.effect?.getComputedTiming().iterations !== Infinity)
.filter(animation => animation.timeline === document.timeline
&& animation.effect?.getComputedTiming().iterations !== Infinity)
.map(animation => animation.finished.catch(() => undefined)))
})
await expect.poll(async () => {
+5 -3
View File
@@ -169,13 +169,15 @@ function firstRecallPulse(page: Page): Promise<boolean> {
}
/**
* Wait until nothing under the page is animating, so a probe measures the settled
* layout instead of a frame of a column slide.
* Wait until no time-based animation under the page is running, so a probe measures
* the settled layout instead of a frame of a column slide. Scroll-driven animations
* never finish and are ignored.
* @param page - the page under test.
*/
async function settled(page: Page): Promise<void> {
await expect.poll(() => page.evaluate(() => document.getAnimations()
.every(animation => animation.playState === 'finished' || animation.playState === 'idle')),
.every(animation => animation.timeline !== document.timeline
|| animation.playState === 'finished' || animation.playState === 'idle')),
{ timeout: 20_000 }).toBe(true)
}