From ed6721f6dc0b573b7b38b85e245ef9ee9bbd5576 Mon Sep 17 00:00:00 2001 From: dsh-ci-bot Date: Thu, 12 Nov 2026 05:44:38 +0800 Subject: [PATCH 1/2] 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. --- apps/web/tests/sidebar-drawer.e2e.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/apps/web/tests/sidebar-drawer.e2e.ts b/apps/web/tests/sidebar-drawer.e2e.ts index 99b5c3fd43..b8768155bb 100644 --- a/apps/web/tests/sidebar-drawer.e2e.ts +++ b/apps/web/tests/sidebar-drawer.e2e.ts @@ -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((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 () => { From 0f8d6ab12bb6cc80b8646f15d3dc727d21659c33 Mon Sep 17 00:00:00 2001 From: dsh-ci-bot Date: Thu, 12 Nov 2026 06:15:51 +0800 Subject: [PATCH 2/2] test(web): cancel the sampled fold transitions before the next posture change finish() only moves a transition to its end state; the matching transitionend is dispatched in a later rendering update. That end event arrived after the caller armed the next fold window, so AppFrame settled the new window, dropped data-animating and cancelled the transition the next assertFoldResize waits for. Awaiting two animation frames narrowed that window without closing it: AppFrame's own 600 ms fallback can settle and cancel the transition before the end event is dispatched, so the end event can still be pending when the helper returns. Cancel the sampled transitions instead. A cancelled transition dispatches transitioncancel, which AppFrame does not observe, so the helper leaves no end event pending. The frame then settles through AppFrame's 600 ms fallback, and the helper waits for data-animating to clear before it returns. The sampled start/middle/end values and the final grid are unchanged: cancelling drops the transition effect and the computed grid lands on the same target. --- apps/web/tests/sidebar-drawer.e2e.ts | 36 +++++++++++++--------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/apps/web/tests/sidebar-drawer.e2e.ts b/apps/web/tests/sidebar-drawer.e2e.ts index b8768155bb..4a5caf7249 100644 --- a/apps/web/tests/sidebar-drawer.e2e.ts +++ b/apps/web/tests/sidebar-drawer.e2e.ts @@ -184,7 +184,11 @@ async function assertMaskFade(frame: Locator, from: number, to: number): Promise }) } -/** Sample both width transitions on the same clock to detect detached sidebar controls. */ +/** + * Sample both width transitions on the same clock to detect detached sidebar controls. + * Returns only after this sample's transitions can no longer dispatch an end event, so + * the caller's next posture change starts from a window that no pending event settles. + */ async function assertFoldResize(toggle: Locator, from: number, to: number): Promise { await expect.poll(() => toggle.evaluate((button, target) => { const frame = button.closest('[data-animating]') @@ -208,7 +212,14 @@ async function assertFoldResize(toggle: Locator, from: number, to: number): Prom const start = at(0) const middle = at(0.5) const end = at(1) - for (const transition of transitions) transition.finish() + // Cancel instead of finish: a finished transition queues its transitionend for a + // later rendering update, and an end event arriving after the caller's next posture + // change settles the new window, drops data-animating and cancels the transition the + // next assertFoldResize looks for. A cancelled transition dispatches transitioncancel, + // which AppFrame does not observe, so this sample leaves no end event pending. Both + // values stay at the end state: cancelling drops the transition effect, and the + // computed grid lands on the same target the finished transition would show. + for (const transition of transitions) transition.cancel() frame.style.removeProperty('--ds-transition-duration-slow') return { endpoints: [start.width, end.width], start, middle } }) @@ -216,24 +227,9 @@ 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((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) - })) + // AppFrame removes data-animating either from a transitionend or from its own 600 ms + // fallback, which is the only remaining settle path once the transitions are cancelled. + // Wait for that settle so the caller's next posture change starts from a clear window. await expect.poll( () => toggle.evaluate(button => button.closest('[data-animating]') === null), { timeout: 5_000 },