test(web): let the sampled fold transition settle before the next posture change

assertFoldResize finishes the sampled grid-template-columns transition from the
page side; CSS delivers the matching transitionend in a later rendering update.
The sidebar-drawer e2e then changes the posture again. When that end event
arrives after the new window is armed, AppFrame's settle handler drops
data-animating and cancels the new transition, so the next assertFoldResize poll
never sees a running transition (master CI runs 43002182954 and 43076752328
failed at apps/web/tests/sidebar-drawer.e2e.ts:500).

Give the frame a rendering update and wait for data-animating to clear at the
end of the helper, so the next step starts from a settled frame.
This commit is contained in:
dsh-ci-bot committed 2026-11-12 05:44:38 +08:00
1 parent adf06d4804
commit ed6721f6dc
1 file changed
+22
+22
View File
@@ -216,6 +216,28 @@ async function assertFoldResize(toggle: Locator, from: number, to: number): Prom
expect(sample.middle.width).toBeGreaterThan(Math.min(from, to))
expect(sample.middle.width).toBeLessThan(Math.max(from, to))
expect(sample.middle.gap).toBeCloseTo(sample.start.gap, 1)
// The sample above finishes this track transition from the page side, and CSS
// delivers the matching transitionend in a later rendering update. Give it that
// update and wait for the frame to settle before the caller changes the layout
// again: an end event from this sample delivered after the next toggle would
// settle the new window, drop data-animating and cancel the transition the next
// assertFoldResize looks for.
await toggle.evaluate(() => new Promise<void>((resolve) => {
let frames = 0
const tick = () => {
frames += 1
if (frames >= 2) resolve()
else requestAnimationFrame(tick)
}
requestAnimationFrame(tick)
// A hidden or throttled page may withhold animation frames; the settle poll below
// still covers that case through AppFrame's own 600ms fallback.
setTimeout(resolve, 2_000)
}))
await expect.poll(
() => toggle.evaluate(button => button.closest('[data-animating]') === null),
{ timeout: 5_000 },
).toBe(true)
}
it('overlays the conversation and closes after navigation without losing its sidebar content', async () => {