test(web): pin expanded snapshots to bottom

This commit is contained in:
Dudu-0223 2026-08-30 16:12:43 +08:00
parent 5b91cdbf8b
commit ff34b6c28e

View file

@ -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 {