feat(FN-4619): add regression test for initial loading thinking state in Pl

Adds a regression test for initial loading thinking in the Planning Mode Modal and includes a changeset documenting the new behavior as a minor feature.

Fusion-Task-Id: FN-4619
This commit is contained in:
Fusion
2026-05-15 10:00:48 -07:00
committed by gsxdsm
parent 3ea9bbba7a
commit 4d99a72c94
2 changed files with 41 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
"@runfusion/fusion": patch
---
Fix Planning Mode so the loading view can show streamed thinking output during the initial question turn, including buffered SSE thinking events that arrive before the first question event.

View File

@@ -550,6 +550,42 @@ describe("PlanningModeModal", () => {
}, undefined); }, undefined);
}, { timeout: 2000 }); }, { timeout: 2000 });
}); });
it("shows streamed thinking in loading view before first question arrives", async () => {
mockConnectPlanningStream.mockImplementation((_sessionId: string, _projectId: string | undefined, handlers: any) => {
setTimeout(() => {
handlers.onThinking?.("Analyzing requirements...");
}, 0);
return {
close: vi.fn(),
isConnected: vi.fn().mockReturnValue(true),
};
});
render(
<PlanningModeModal
isOpen={true}
onClose={mockOnClose}
onTaskCreated={mockOnTaskCreated}
onTasksCreated={vi.fn()}
tasks={mockTasks}
/>,
);
fireEvent.change(screen.getByPlaceholderText(/e.g., Build a user authentication/), {
target: { value: "Draft a migration plan" },
});
fireEvent.click(screen.getByText("Start Planning"));
await waitFor(() => {
expect(screen.getByText("AI is thinking...")).toBeDefined();
expect(screen.getByText("Analyzing requirements...")).toBeDefined();
});
expect(screen.getByRole("button", { name: "Hide thinking" })).toBeDefined();
expect(document.querySelector(".planning-thinking-output")).not.toBeNull();
});
}); });
describe("modal height constraint regression", () => { describe("modal height constraint regression", () => {