diff --git a/ui/src/ui/views/exec-approval.test.ts b/ui/src/ui/views/exec-approval.test.ts index 4c9b942961c..b16e881f8df 100644 --- a/ui/src/ui/views/exec-approval.test.ts +++ b/ui/src/ui/views/exec-approval.test.ts @@ -129,7 +129,10 @@ describe("approval and confirmation modals", () => { }); it("renders exec approval as a labelled modal", async () => { + vi.useFakeTimers(); + vi.setSystemTime(new Date("2026-04-29T00:00:00.000Z")); render(renderExecApprovalPrompt(createExecState()), container); + vi.useRealTimers(); const { modal, dialog } = await getRenderedDialog(); @@ -140,11 +143,14 @@ describe("approval and confirmation modals", () => { "Exec approval needed", ); expect( - modal.shadowRoot?.querySelector("#openclaw-modal-dialog-description")?.textContent, - ).toContain("expires in"); + modal.shadowRoot?.querySelector("#openclaw-modal-dialog-description")?.textContent?.trim(), + ).toBe("expires in 1m"); expect(container.querySelector("#exec-approval-title")?.textContent?.trim()).toBe( "Exec approval needed", ); + expect(container.querySelector("#exec-approval-description")?.textContent?.trim()).toBe( + "expires in 1m", + ); }); it("renders command spans in exec approvals", async () => {