From 8778c697744f8334c5794cd37502e8eb77ee5585 Mon Sep 17 00:00:00 2001 From: chengyongru Date: Mon, 19 Oct 2026 17:31:52 +0800 Subject: [PATCH] test(webui): await rendered canonical reconciliation --- webui/src/tests/thread-shell.test.tsx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/webui/src/tests/thread-shell.test.tsx b/webui/src/tests/thread-shell.test.tsx index e1f1fe5d5..8f96bd915 100644 --- a/webui/src/tests/thread-shell.test.tsx +++ b/webui/src/tests/thread-shell.test.tsx @@ -3290,20 +3290,22 @@ describe("ThreadShell", () => { act(() => client._emitSessionUpdate("layout-recheck", "thread")); - await waitFor(() => expect(historyCalls).toBe(2)); - await waitFor(() => - expect(client.reconcileCanonicalCompletion).toHaveBeenCalledTimes(1), - ); - expect(screen.queryByText("layout partial")).not.toBeInTheDocument(); - expect(screen.getByText("layout canonical answer")).toBeInTheDocument(); - expect(screen.getByRole("button", { name: "Stop response" })).toBeInTheDocument(); + await waitFor(() => { + expect(historyCalls).toBe(2); + expect(client.reconcileCanonicalCompletion).toHaveBeenCalledTimes(1); + expect(screen.queryByText("layout partial")).not.toBeInTheDocument(); + expect(screen.getByText("layout canonical answer")).toBeInTheDocument(); + expect(screen.getByRole("button", { name: "Stop response" })).toBeInTheDocument(); + }); act(() => client._emitSessionUpdate("layout-recheck", "thread")); - await waitFor(() => expect(historyCalls).toBe(3)); - await waitFor(() => expect(screen.getByText("layout canonical answer")).toBeInTheDocument()); - expect(screen.queryByText("layout partial")).not.toBeInTheDocument(); - expect(client.reconcileCanonicalCompletion).toHaveBeenCalledTimes(2); + await waitFor(() => { + expect(historyCalls).toBe(3); + expect(screen.getByText("layout canonical answer")).toBeInTheDocument(); + expect(screen.queryByText("layout partial")).not.toBeInTheDocument(); + expect(client.reconcileCanonicalCompletion).toHaveBeenCalledTimes(2); + }); }); it("adopts a completed equal-length history when returning after an inactive outage", async () => {