Skip to content

Commit 0b361f7

Browse files
committed
Add test suites for langgraph fastapi and typescript
1 parent 360f639 commit 0b361f7

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test('renders initial message', async ({ page }) => {
4+
await page.goto('http://localhost:9999/langgraph-fastapi/feature/agentic_chat');
5+
6+
await expect(page.getByText('Hi, I\'m an agent. Want to chat?')).toBeVisible();
7+
});
8+
9+
test('responds to user message', async ({ page }) => {
10+
await page.goto('http://localhost:9999/langgraph-fastapi/feature/agentic_chat');
11+
12+
const textarea = page.getByPlaceholder('Type a message...');
13+
textarea.fill('How many sides are in a square? Please answer in one word. Do not use any punctuation, just the number in word form.');
14+
await page.keyboard.press('Enter');
15+
16+
page.locator('.copilotKitInputControls button.copilotKitInputControlButton').click();
17+
18+
await expect(page.locator('.copilotKitMessage')).toHaveCount(3);
19+
await expect(page.locator('.copilotKitMessage.copilotKitAssistantMessage')).toHaveCount(2);
20+
await expect(page.locator('.copilotKitMessage.copilotKitUserMessage')).toHaveCount(1);
21+
await expect(page.locator('.copilotKitMessage.copilotKitAssistantMessage').last()).toHaveText('four', { ignoreCase: true });
22+
});
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test('renders initial message', async ({ page }) => {
4+
await page.goto('http://localhost:9999/langgraph-typescript/feature/agentic_chat');
5+
6+
await expect(page.getByText('Hi, I\'m an agent. Want to chat?')).toBeVisible();
7+
});
8+
9+
test('responds to user message', async ({ page }) => {
10+
await page.goto('http://localhost:9999/langgraph-typescript/feature/agentic_chat');
11+
12+
const textarea = page.getByPlaceholder('Type a message...');
13+
textarea.fill('How many sides are in a square? Please answer in one word. Do not use any punctuation, just the number in word form.');
14+
await page.keyboard.press('Enter');
15+
16+
page.locator('.copilotKitInputControls button.copilotKitInputControlButton').click();
17+
18+
await expect(page.locator('.copilotKitMessage')).toHaveCount(3);
19+
await expect(page.locator('.copilotKitMessage.copilotKitAssistantMessage')).toHaveCount(2);
20+
await expect(page.locator('.copilotKitMessage.copilotKitUserMessage')).toHaveCount(1);
21+
await expect(page.locator('.copilotKitMessage.copilotKitAssistantMessage').last()).toHaveText('four', { ignoreCase: true });
22+
});

0 commit comments

Comments
 (0)