Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions desktop/tests/e2e/scroll-history.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,11 @@ test("mounted rows cover the viewport beneath the composer in both directions",
// A stale shifted range can stop with no mounted row covering part of the
// viewport and remain blank until another scroll event. The idle samples below
// deliberately dispatch no follow-up scroll.
//
// Setup note (issue #155): a genuine prepend must come through older-page
// pagination. Live-emitting backdated messages after the channel is open does
// not grow the timeline — `mergeLiveChannelWindowEvent` correctly drops events
// below the open oldest boundary and waits for ordinary relay paging.
test("fast middle-page scroll settles with continuous mounted coverage", async ({
page,
}) => {
Expand All @@ -1295,6 +1300,8 @@ test("fast middle-page scroll settles with continuous mounted coverage", async (
typeof window.__BUZZ_E2E_PREPEND_MOCK_HISTORY__ === "function",
);

// Seed the live window plus enough older mock history that the first
// scroll-up can page at least one 50-event window into the timeline.
await page.evaluate(() => {
for (let index = 0; index < 180; index += 1) {
window.__BUZZ_E2E_EMIT_MOCK_MESSAGE__?.({
Expand All @@ -1303,6 +1310,12 @@ test("fast middle-page scroll settles with continuous mounted coverage", async (
createdAt: 1_700_000_000 + index,
});
}
window.__BUZZ_E2E_PREPEND_MOCK_HISTORY__?.({
channelName: "general",
count: 100,
lineCount: 3,
createdAtStart: 1_699_999_000,
});
});

await page.getByTestId("channel-general").click();
Expand All @@ -1316,19 +1329,21 @@ test("fast middle-page scroll settles with continuous mounted coverage", async (
return element && element.scrollHeight > element.clientHeight * 3;
});

// Land a genuine prepend first. This is what turns `shift` on; subsequent
// ordinary list updates and measurements must happen with it cleared.
// Land a genuine prepend via older-page fetch. This is what turns `shift`
// on; subsequent ordinary list updates and measurements must happen with it
// cleared. Drive the scroll with real wheel input so Virtua observes the
// offset change and the top-edge sentinel can arm the page fetch.
const scrollHeightBeforePrepend = (await getTimelineMetrics(page))
.scrollHeight;
await page.evaluate(() => {
for (let index = 0; index < 100; index += 1) {
window.__BUZZ_E2E_EMIT_MOCK_MESSAGE__?.({
channelName: "general",
content: `prepended settle row ${index}\nolder line two ${index}\nolder line three ${index}`,
createdAt: 1_699_999_000 + index,
});
await timeline.hover();
for (let attempt = 0; attempt < 32; attempt += 1) {
const metrics = await getTimelineMetrics(page);
if (metrics.scrollTop < 500) {
break;
}
});
await page.mouse.wheel(0, -2000);
await page.waitForTimeout(25);
}
await expect
.poll(() =>
getTimelineMetrics(page).then((metrics) => metrics.scrollHeight),
Expand Down
7 changes: 7 additions & 0 deletions docs/crew/STATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,13 @@ and in flight.
- `channel-agent-presence.spec.ts` now passes its needs-you smoke-shard
scenario in 12/12 clean runs; the fix was an E2E fixture-fidelity gap, not
a product break (issue #130).
- `scroll-history.spec.ts` *fast middle-page scroll settles with continuous
mounted coverage* now passes; the failure was a harness setup bug, not a
virtualizer/page-fetch product break. The test live-emitted backdated
messages to force a prepend, but `mergeLiveChannelWindowEvent` correctly
drops events below the open oldest boundary (they wait for ordinary relay
paging). Setup now seeds older mock history and wheels up for a real
older-page prepend before the middle-scroll coverage asserts (issue #155).
- Earlier focused live relay test: `1/1` passed with an isolated Buzz relay.
- Typecheck, file-size gate, Biome checks, production build, and
`git diff --check` passed.
Expand Down
Loading