story-kit: start 147_bug_activity_indicator_still_only_shows_thinking_despite_bug_140_fix

This commit is contained in:
Dave
2026-02-24 15:26:39 +00:00
parent 5556296ddf
commit 03ca8624cd
4 changed files with 313 additions and 33 deletions

View File

@@ -473,4 +473,85 @@ describe("Chat activity status indicator (Bug 140)", () => {
// The activity indicator should NOT be visible (just streaming bubble)
expect(screen.queryByTestId("activity-indicator")).not.toBeInTheDocument();
});
it("shows activity label for Claude Code tool names (Read, Bash, etc.)", async () => {
render(<Chat projectPath="/tmp/project" onCloseProject={vi.fn()} />);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
// Simulate sending a message to set loading=true
const input = screen.getByPlaceholderText("Send a message...");
await act(async () => {
fireEvent.change(input, { target: { value: "Read my file" } });
});
await act(async () => {
fireEvent.keyDown(input, { key: "Enter", shiftKey: false });
});
// Simulate tokens arriving
act(() => {
capturedWsHandlers?.onToken("Let me read that.");
});
// Claude Code sends tool name "Read" (not "read_file")
act(() => {
capturedWsHandlers?.onActivity("Read");
});
const indicator = await screen.findByTestId("activity-indicator");
expect(indicator).toBeInTheDocument();
expect(indicator).toHaveTextContent("Reading file...");
});
it("shows activity label for Claude Code Bash tool", async () => {
render(<Chat projectPath="/tmp/project" onCloseProject={vi.fn()} />);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
const input = screen.getByPlaceholderText("Send a message...");
await act(async () => {
fireEvent.change(input, { target: { value: "Run the tests" } });
});
await act(async () => {
fireEvent.keyDown(input, { key: "Enter", shiftKey: false });
});
act(() => {
capturedWsHandlers?.onToken("Running tests now.");
});
act(() => {
capturedWsHandlers?.onActivity("Bash");
});
const indicator = await screen.findByTestId("activity-indicator");
expect(indicator).toBeInTheDocument();
expect(indicator).toHaveTextContent("Executing command...");
});
it("shows generic label for unknown tool names", async () => {
render(<Chat projectPath="/tmp/project" onCloseProject={vi.fn()} />);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
const input = screen.getByPlaceholderText("Send a message...");
await act(async () => {
fireEvent.change(input, { target: { value: "Do something" } });
});
await act(async () => {
fireEvent.keyDown(input, { key: "Enter", shiftKey: false });
});
act(() => {
capturedWsHandlers?.onToken("Working on it.");
});
act(() => {
capturedWsHandlers?.onActivity("SomeCustomTool");
});
const indicator = await screen.findByTestId("activity-indicator");
expect(indicator).toBeInTheDocument();
expect(indicator).toHaveTextContent("Using SomeCustomTool...");
});
});