Skip to content
Merged
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
22 changes: 16 additions & 6 deletions desktop/tests/e2e/scroll-history.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1577,16 +1577,26 @@ test("older-history spinner stays visible in viewport while fetching mid-scroll"
const timeline = page.getByTestId("message-timeline");
await expect(timeline.locator("[data-message-id]").first()).toBeVisible();

await timeline.hover();
await page.mouse.wheel(0, -1_500);
await page.waitForTimeout(100);
await page.mouse.wheel(0, 1_000);
await page.waitForTimeout(100);
await page.mouse.wheel(0, -1_000);
// Trigger the older fetch near the top, then move the reader mid-scroll
// while the fetch is still in flight. Set scrollTop directly instead of
// mouse.wheel: wheel deltas vary across CI environments and can land the
// timeline at scrollTop 0, which is the one position this test must avoid.
await timeline.evaluate((element) => {
const timelineElement = element as HTMLDivElement;
timelineElement.scrollTop = 150;
timelineElement.dispatchEvent(new Event("scroll", { bubbles: true }));
});

const indicator = page.getByTestId("message-timeline-fetching-older");
await expect(indicator).toBeVisible({ timeout: 2_000 });

await timeline.evaluate((element) => {
const timelineElement = element as HTMLDivElement;
timelineElement.scrollTop = timelineElement.clientHeight;
timelineElement.dispatchEvent(new Event("scroll", { bubbles: true }));
});
await expect(indicator).toBeVisible();

const { scrollTop } = await getTimelineMetrics(page);
expect(scrollTop).toBeGreaterThan(8);

Expand Down
Loading