|
|
@@ -34,6 +34,7 @@ const FIXTURE = createChatScrollFixture({
|
|
|
turns: 88,
|
|
|
})
|
|
|
const MAX_MOUNTED_ROWS = 160
|
|
|
+const MAX_STREAM_SCROLL_CALLS = 8
|
|
|
const GEOMETRY_TOLERANCE = 2
|
|
|
const STREAM_MARKER = 'TRAJECTORY_VIRTUAL_STREAM_FINISHED'
|
|
|
const STREAM_TEXT = Array.from(
|
|
|
@@ -153,10 +154,15 @@ async function rowTop(page: Page, key: string): Promise<number | null> {
|
|
|
|
|
|
async function loadToFirstTurn(page: Page): Promise<void> {
|
|
|
const marker = FIXTURE.markers.user(1)
|
|
|
+ const loadMore = page.locator('[data-history-load] button')
|
|
|
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
|
- await scrollToRatio(page, 0)
|
|
|
if (await page.getByText(marker, { exact: false }).count() > 0) return
|
|
|
+ await expect.poll(() => loadMore.evaluateAll(buttons =>
|
|
|
+ buttons.length === 0 || !(buttons[0] as HTMLButtonElement).disabled,
|
|
|
+ ), { timeout: 15_000 }).toBe(true)
|
|
|
const before = await logicalRows(page)
|
|
|
+ await scrollToRatio(page, 0)
|
|
|
+ if (await page.getByText(marker, { exact: false }).count() > 0) return
|
|
|
const anchor = await firstVisibleRow(page)
|
|
|
await expect.poll(async () => ({
|
|
|
marker: await page.getByText(marker, { exact: false }).count() > 0,
|
|
|
@@ -337,7 +343,7 @@ describe('web e2e: Trajectory virtualization over tail-paged history', () => {
|
|
|
return (window as Window & { __trajectoryScrollCalls?: number })
|
|
|
.__trajectoryScrollCalls ?? 0
|
|
|
})
|
|
|
- expect(streamingScrollCalls).toBeLessThanOrEqual(5)
|
|
|
+ expect(streamingScrollCalls).toBeLessThanOrEqual(MAX_STREAM_SCROLL_CALLS)
|
|
|
expect(await mountedRows(page)).toBeLessThanOrEqual(MAX_MOUNTED_ROWS)
|
|
|
expect({
|
|
|
pageErrors: tripwire.pageErrors,
|