forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeclarative-hashbrown.spec.ts
More file actions
54 lines (47 loc) · 1.89 KB
/
Copy pathdeclarative-hashbrown.spec.ts
File metadata and controls
54 lines (47 loc) · 1.89 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
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* E2E spec for the Declarative UI: Hashbrown demo. Selectors match the
* chart/metric components' `data-testid` hooks. Covers 3 suggestion
* flows + page-load smoke; timeouts are streaming-friendly because
* hashbrown assembles UI progressively from structured output.
*/
import { test, expect } from "@playwright/test";
test.describe("Declarative UI: Hashbrown", () => {
test.beforeEach(async ({ page }) => {
await page.goto("/demos/declarative-hashbrown");
});
test("page loads with header, suggestion pills, and chat composer", async ({
page,
}) => {
await expect(
page.getByRole("heading", { name: "Declarative UI: Hashbrown" }),
).toBeVisible();
await expect(page.getByText("Sales dashboard").first()).toBeVisible();
await expect(page.getByText("Revenue by category").first()).toBeVisible();
await expect(page.getByText("Expense trend").first()).toBeVisible();
});
test("sales-dashboard suggestion triggers a hashbrown render", async ({
page,
}) => {
await page.getByText("Sales dashboard").first().click();
const metricCard = page.locator('[data-testid="metric-card"]').first();
const chart = page
.locator('[data-testid="bar-chart"], [data-testid="pie-chart"]')
.first();
await expect(metricCard).toBeVisible({ timeout: 60000 });
await expect(chart).toBeVisible({ timeout: 60000 });
});
test("revenue-by-category suggestion renders a pie chart", async ({
page,
}) => {
await page.getByText("Revenue by category").first().click();
await expect(page.locator('[data-testid="pie-chart"]').first()).toBeVisible(
{ timeout: 60000 },
);
});
test("expense-trend suggestion renders a bar chart", async ({ page }) => {
await page.getByText("Expense trend").first().click();
await expect(page.locator('[data-testid="bar-chart"]').first()).toBeVisible(
{ timeout: 60000 },
);
});
});