import { expect, test } from "@playwright/test"; import { mockLangGraphAPI } from "./utils/mock-api"; const MOCK_AGENTS = [ { name: "test-agent", description: "A test agent for E2E tests", system_prompt: "You are a test agent.", }, ]; test.describe("Agent chat", () => { test("agent gallery page loads and shows agents", async ({ page }) => { mockLangGraphAPI(page, { agents: MOCK_AGENTS }); await page.goto("/workspace/agents"); // The agent card should appear with the agent name await expect(page.getByText("test-agent")).toBeVisible({ timeout: 15_000, }); }); test("agent chat page loads with input box", async ({ page }) => { mockLangGraphAPI(page, { agents: MOCK_AGENTS }); await page.goto("/workspace/agents/test-agent/chats/new"); // The prompt input textarea should be visible const textarea = page.getByPlaceholder(/how can i assist you/i); await expect(textarea).toBeVisible({ timeout: 15_000 }); }); test("agent chat page shows agent badge", async ({ page }) => { mockLangGraphAPI(page, { agents: MOCK_AGENTS }); await page.goto("/workspace/agents/test-agent/chats/new"); // The agent badge should display in the header (scoped to header to avoid // matching the welcome area which also shows the agent name) await expect( page.locator("header span", { hasText: "test-agent" }), ).toBeVisible({ timeout: 15_000 }); }); });