From f8283ef15bfef2ba454822ee2774fe97574b853e Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 28 Jul 2026 08:49:57 -0400 Subject: [PATCH] test(ui): pause fake clock before send so working-timer e2e assertions are deterministic (#115187) --- ui/src/e2e/chat-run-lifecycle.e2e.test.ts | 4 ++++ ui/src/e2e/mantis-chat-proof.e2e.test.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ui/src/e2e/chat-run-lifecycle.e2e.test.ts b/ui/src/e2e/chat-run-lifecycle.e2e.test.ts index b12a1d44ae03..7a4c05bbae73 100644 --- a/ui/src/e2e/chat-run-lifecycle.e2e.test.ts +++ b/ui/src/e2e/chat-run-lifecycle.e2e.test.ts @@ -109,6 +109,10 @@ describeControlUiE2e("Control UI chat run lifecycle", () => { await currentPage.goto(`${server?.baseUrl ?? ""}chat`); await currentPage.getByText("saved 875.3k tokens", { exact: true }).waitFor(); await currentPage.locator(".agent-chat__input textarea").fill("keep working"); + // Pause the virtual clock before sending: the working timer starts at the + // send click, and an unpaused installed clock still ticks in real time, + // letting slow CI inflate the fast-forwarded "2m 57s" to "2m 59s". + await currentPage.clock.pauseAt((await currentPage.evaluate(() => Date.now())) + 5_000); await currentPage.getByRole("button", { name: "Send message" }).click(); await gateway.waitForRequest("chat.send"); await currentPage.locator(".chat-working-indicator").waitFor(); diff --git a/ui/src/e2e/mantis-chat-proof.e2e.test.ts b/ui/src/e2e/mantis-chat-proof.e2e.test.ts index 2b6aeac0f72e..07d651bf95c0 100644 --- a/ui/src/e2e/mantis-chat-proof.e2e.test.ts +++ b/ui/src/e2e/mantis-chat-proof.e2e.test.ts @@ -96,6 +96,10 @@ describeMantisWebUiChat("Mantis Control UI web chat proof", () => { await page.goto(`${server.baseUrl}chat`); await page.getByText("Mantis web UI proof is ready.").waitFor({ timeout: 10_000 }); await page.locator(".agent-chat__composer-combobox textarea").fill(prompt); + // Pause the virtual clock before sending: the working timer starts at the + // send click, and an unpaused installed clock still ticks in real time, + // letting slow CI inflate the fast-forwarded "2m 57s" to "2m 59s". + await page.clock.pauseAt((await page.evaluate(() => Date.now())) + 5_000); await page.getByRole("button", { name: "Send message" }).click(); const sendRequest = await gateway.waitForRequest("chat.send");