diff --git a/e2e/local-homeserver.spec.ts b/e2e/local-homeserver.spec.ts index bae50395d..5dda97090 100644 --- a/e2e/local-homeserver.spec.ts +++ b/e2e/local-homeserver.spec.ts @@ -109,9 +109,17 @@ test.describe('local homeserver regression', () => { ); await loginUI(page, alice); await openRoom(page, room); + // Wait for the timeline to settle at the newest message first: a wheel + // during the initial jump-to-bottom gets snapped back (test race, seen + // ~1 in 5 runs once matrix-js-sdk 44 changed the load timing). + await expect(page.getByText('filler 39')).toBeInViewport(); await page.mouse.move(600, 350); - await page.mouse.wheel(0, -600); - await expect(page.getByRole('button', { name: /Jump to Latest/ })).toBeVisible(); + await expect(async () => { + await page.mouse.wheel(0, -600); + await expect(page.getByRole('button', { name: /Jump to Latest/ })).toBeVisible({ + timeout: 2000, + }); + }).toPass({ timeout: 20_000 }); await page.locator('[data-slate-editor]').first().click(); await page.keyboard.type('sent while scrolled up'); await page.keyboard.press('Enter');