From 3b2759836b514336787a150a6236f88e8704536a Mon Sep 17 00:00:00 2001 From: "lusendong.6789" Date: Sun, 8 Nov 2026 14:03:25 +0800 Subject: [PATCH] test(browser): anchor the conversation quiet-time clock Signed-off-by: lusendong.6789 Co-authored-by: TRAE CLI --- .../conversation-activity.mjs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/personal-workspace-browser/conversation-activity.mjs b/examples/personal-workspace-browser/conversation-activity.mjs index 3410ffd3c5..8e95d3b4d4 100644 --- a/examples/personal-workspace-browser/conversation-activity.mjs +++ b/examples/personal-workspace-browser/conversation-activity.mjs @@ -46,11 +46,11 @@ export const conversationActivityScenario = { const turn = await send("请检查当前任务状态,并说明下一步。"); await page.getByRole("status", {name: "正在回复", exact: true}).waitFor(); const pending = page.locator(".personal-message").filter({ has: page.getByRole("button", { name: "中断本轮", exact: true }) }); - await page.clock.install(); - await page.clock.fastForward(25000); - // Compare the same instant across views; clock.install alone keeps - // advancing and can cross a second boundary while navigation completes. - await page.clock.pauseAt(await page.evaluate(() => Date.now())); + const clockStart = await page.evaluate(() => Date.now()); + await page.clock.install({time: clockStart}); + // Pause at one anchored future instant; an observed current time can + // already be in the past when the browser receives the next command. + await page.clock.pauseAt(clockStart + 25000); await pending.locator(".personal-message-quiet").waitFor(); const elapsedBefore = await pending.locator(".personal-message-elapsed").textContent(); await page.getByRole("navigation", { name: "管家视图" }).getByRole("button", { name: "总览", exact: true }).click();