forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreasoning-default.spec.ts
More file actions
41 lines (35 loc) · 1.48 KB
/
Copy pathreasoning-default.spec.ts
File metadata and controls
41 lines (35 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { test, expect } from "@playwright/test";
// QA reference: qa/reasoning-default.md
// Demo source: src/app/demos/reasoning-default/page.tsx
//
// This cell does NOT override the `reasoningMessage` slot. CopilotKit's
// built-in `CopilotChatReasoningMessage` renders the reasoning as a
// collapsible card. The page exposes a "Show reasoning" suggestion pill
// whose message matches the aimock fixture in showcase/aimock/d5-all.json,
// so streaming is deterministic in CI.
test.describe("Reasoning: Default", () => {
test.setTimeout(120_000);
test.beforeEach(async ({ page }) => {
await page.goto("/demos/reasoning-default");
});
test("page renders without errors", async ({ page }) => {
await expect(
page.locator('[data-testid="copilot-chat-input"]'),
).toBeVisible();
});
test("Show reasoning pill renders a reasoning-role message", async ({
page,
}) => {
const pill = page.getByRole("button", { name: /Show reasoning/i }).first();
await expect(pill).toBeVisible({ timeout: 30_000 });
await pill.click();
// The cell uses CopilotKit's default `CopilotChatReasoningMessage`,
// which doesn't emit a testid — its visible signal is the
// streaming/complete header label ("Thinking…" while streaming,
// "Thought for …" once complete). Asserting on either label proves
// the reasoning collapsible mounted.
await expect(page.getByText(/Thinking…|Thought for/i).first()).toBeVisible({
timeout: 60_000,
});
});
});