From ff34b6c28e5b0b1679606d3a1aa0b950c8e80dd7 Mon Sep 17 00:00:00 2001 From: Dudu-0223 Date: Sun, 30 Aug 2026 16:12:43 +0800 Subject: [PATCH] test(web): pin expanded snapshots to bottom --- apps/web/tests/scaffold.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/web/tests/scaffold.ts b/apps/web/tests/scaffold.ts index ffdc5a747a..de15103c84 100644 --- a/apps/web/tests/scaffold.ts +++ b/apps/web/tests/scaffold.ts @@ -1196,10 +1196,14 @@ export async function captureExpandedTurnProcessAria( try { if (options.scrollToBottom === true) { const backToBottom = page.getByRole('button', { name: 'Back to bottom', exact: true }) - if (await backToBottom.isVisible()) { - await backToBottom.click() - await expect.poll(() => backToBottom.count(), { timeout: 10_000 }).toBe(0) - } + const scroll = page.locator('[data-conversation-scroll]') + await expect.poll(async () => { + const distanceFromBottom = await scroll.evaluate((host) => { + host.scrollTop = host.scrollHeight + return host.scrollHeight - host.clientHeight - host.scrollTop + }) + return Math.abs(distanceFromBottom) <= 1 && await backToBottom.count() === 0 + }, { timeout: 10_000 }).toBe(true) } return await captureStableAria(page, selector, workspaceCwd) } finally {