Skip to content

Commit 8e960e5

Browse files
committed
Add (and use) near-empty test suite while e2e work is in progress.
1 parent e8186a4 commit 8e960e5

File tree

8 files changed

+198
-3
lines changed

8 files changed

+198
-3
lines changed

.github/workflows/dojo-e2e.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ jobs:
5151
working-directory: typescript-sdk/apps/dojo
5252
run: node ./scripts/prep-dojo-everything.js -e2e
5353

54+
- name: Install e2e dependencies
55+
working-directory: typescript-sdk/apps/dojo/e2e2
56+
run: |
57+
pnpm install --frozen-lockfile
58+
pnpm dlx playwright install --with-deps
59+
5460
- name: write langgraph env files
5561
working-directory: typescript-sdk/integrations/langgraph
5662
env:
@@ -72,5 +78,5 @@ jobs:
7278
run: node ./scripts/run-dojo-everything.js &
7379

7480
- name: Run tests
75-
working-directory: typescript-sdk/apps/dojo
76-
run: npx wait-port 9999 && sleep 10 && echo "I AM ECHOING INSTEAD OF RUNNING TESTS"
81+
working-directory: typescript-sdk/apps/dojo/e2e2
82+
run: npx wait-port 9999 && sleep 10 && pnpm exec playwright test
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
# Playwright
3+
node_modules/
4+
/test-results/
5+
/playwright-report/
6+
/blob-report/
7+
/playwright/.cache/
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "e2e2",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {},
7+
"keywords": [],
8+
"author": "",
9+
"license": "ISC",
10+
"devDependencies": {
11+
"@playwright/test": "^1.54.2",
12+
"@types/node": "^24.1.0"
13+
}
14+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { defineConfig, devices } from '@playwright/test';
2+
3+
/**
4+
* Read environment variables from file.
5+
* https://github.com/motdotla/dotenv
6+
*/
7+
// import dotenv from 'dotenv';
8+
// import path from 'path';
9+
// dotenv.config({ path: path.resolve(__dirname, '.env') });
10+
11+
/**
12+
* See https://playwright.dev/docs/test-configuration.
13+
*/
14+
export default defineConfig({
15+
testDir: './tests',
16+
/* Run tests in files in parallel */
17+
fullyParallel: true,
18+
/* Fail the build on CI if you accidentally left test.only in the source code. */
19+
forbidOnly: !!process.env.CI,
20+
/* Retry on CI only */
21+
retries: process.env.CI ? 2 : 0,
22+
/* Opt out of parallel tests on CI. */
23+
workers: process.env.CI ? 1 : undefined,
24+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
25+
reporter: 'html',
26+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
27+
use: {
28+
/* Base URL to use in actions like `await page.goto('/')`. */
29+
// baseURL: 'http://localhost:3000',
30+
31+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
32+
trace: 'on-first-retry',
33+
},
34+
35+
/* Configure projects for major browsers */
36+
projects: [
37+
{
38+
name: 'chromium',
39+
use: { ...devices['Desktop Chrome'] },
40+
},
41+
42+
{
43+
name: 'firefox',
44+
use: { ...devices['Desktop Firefox'] },
45+
},
46+
47+
{
48+
name: 'webkit',
49+
use: { ...devices['Desktop Safari'] },
50+
},
51+
52+
/* Test against mobile viewports. */
53+
// {
54+
// name: 'Mobile Chrome',
55+
// use: { ...devices['Pixel 5'] },
56+
// },
57+
// {
58+
// name: 'Mobile Safari',
59+
// use: { ...devices['iPhone 12'] },
60+
// },
61+
62+
/* Test against branded browsers. */
63+
// {
64+
// name: 'Microsoft Edge',
65+
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
66+
// },
67+
// {
68+
// name: 'Google Chrome',
69+
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
70+
// },
71+
],
72+
73+
/* Run your local dev server before starting the tests */
74+
// webServer: {
75+
// command: 'npm run start',
76+
// url: 'http://localhost:3000',
77+
// reuseExistingServer: !process.env.CI,
78+
// },
79+
});

typescript-sdk/apps/dojo/e2e2/pnpm-lock.yaml

Lines changed: 67 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
packages:
2+
- '.'
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test('renders initial message', async ({ page }) => {
4+
await page.goto('http://localhost:9999/pydantic-ai/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/pydantic-ai/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').last()).toHaveText('four', { ignoreCase: true });
20+
});

typescript-sdk/apps/dojo/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
}
2626
},
2727
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
28-
"exclude": ["node_modules", "e2e"]
28+
"exclude": ["node_modules", "e2e", "e2e2"]
2929
}

0 commit comments

Comments
 (0)