diff --git a/packages/app/e2e/support/helpers/chat-outline.ts b/packages/app/e2e/support/helpers/chat-outline.ts index 7f903a79a..e3f488f19 100644 --- a/packages/app/e2e/support/helpers/chat-outline.ts +++ b/packages/app/e2e/support/helpers/chat-outline.ts @@ -77,6 +77,9 @@ export async function expectNoChatOutlinePreview(page: Page): Promise { export async function expectNoChatOutlinePreviewWhileCrossingToSidebar(page: Page): Promise { const railBox = await requireBoundingBox(chatOutlineRail(page)); + const clockStart = Date.now(); + await page.clock.install({ time: clockStart }); + await page.clock.pauseAt(clockStart + 60_000); await page.mouse.move(railBox.x + railBox.width + 2, railBox.y + railBox.height / 2); await page.evaluate(() => { document.body.dataset.chatOutlinePreviewObserved = String( @@ -91,19 +94,19 @@ export async function expectNoChatOutlinePreviewWhileCrossingToSidebar(page: Pag Object.assign(window, { __chatOutlinePreviewObserver: observer }); }); - for (let step = 0; step <= 10; step += 1) { + // Keep the transit slower than the activation delay at every point while making the whole + // crossing longer than it. Horizontal motion must keep postponing activation until leave + // cancels the final pending timer. + const transitSteps = 6; + for (let step = 0; step < transitSteps; step += 1) { await page.mouse.move( - railBox.x + railBox.width - 1 - (step * railBox.width) / 10, + railBox.x + railBox.width - 1 - (step * railBox.width) / transitSteps, railBox.y + railBox.height / 2, ); - await page.evaluate( - () => - new Promise((resolve) => { - requestAnimationFrame(() => requestAnimationFrame(() => resolve())); - }), - ); + await page.clock.runFor(100); } await page.mouse.move(railBox.x - 2, railBox.y + railBox.height / 2); + await page.clock.runFor(200); const previewAppeared = await page.evaluate(() => { const observer = Reflect.get(window, "__chatOutlinePreviewObserver") as