-
Notifications
You must be signed in to change notification settings - Fork 753
Run fake dojo tests on every PR #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7dd37fe
Add scripts for running dojo for e2e
maxkorp 6e051ea
make examples have configurable ports
maxkorp 4d78fa4
Add new temp e2e suite
maxkorp 607da0e
Add github workflow to run on PRs
maxkorp 7f2df14
misc file cleanup
maxkorp 6a22a09
Fix runtime error if no readme
maxkorp 0402ba8
remove unneeded mdx providers to allow build
maxkorp 072d359
bump pnpm to 10.13.1 to align with copilotkit repo
maxkorp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: e2e | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
e2e: | ||
name: E2E Tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '22' | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 10.13.1 | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
version: latest | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v6 | ||
|
||
- name: Setup pnpm cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.local/share/pnpm/store | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
|
||
- name: Install dependencies | ||
working-directory: typescript-sdk | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Prepare dojo for e2e | ||
working-directory: typescript-sdk/apps/dojo | ||
run: node ./scripts/prep-dojo-everything.js -e2e | ||
|
||
- name: Install e2e dependencies | ||
working-directory: typescript-sdk/apps/dojo/e2e2 | ||
run: | | ||
pnpm install --frozen-lockfile | ||
pnpm dlx playwright install --with-deps | ||
|
||
- name: write langgraph env files | ||
working-directory: typescript-sdk/integrations/langgraph | ||
env: | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }} | ||
run: | | ||
echo "OPENAI_API_KEY=${OPENAI_API_KEY}" > examples/python/.env | ||
echo "LANGSMITH_API_KEY=${LANGSMITH_API_KEY}" >> examples/python/.env | ||
echo "OPENAI_API_KEY=${OPENAI_API_KEY}" > examples/typescript/.env | ||
echo "LANGSMITH_API_KEY=${LANGSMITH_API_KEY}" >> examples/typescript/.env | ||
echo "OPENAI_API_KEY=${OPENAI_API_KEY}" > python/ag_ui_langgraph/.env | ||
echo "LANGSMITH_API_KEY=${LANGSMITH_API_KEY}" >> python/ag_ui_langgraph/.env | ||
|
||
- name: Run dojo+agents and tests | ||
working-directory: typescript-sdk/apps/dojo/e2e2 | ||
env: | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }} | ||
run: | | ||
node ../scripts/run-dojo-everything.js & | ||
npx wait-port 9999 | ||
sleep 10 | ||
pnpm exec playwright test --reporter=dot | ||
|
||
- name: Upload traces | ||
if: always() # Uploads artifacts even if tests fail | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: playwright-traces | ||
path: typescript-sdk/apps/dojo/e2e2/test-results/ | ||
retention-days: 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# Playwright | ||
node_modules/ | ||
/test-results/ | ||
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "e2e2", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": {}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@playwright/test": "^1.54.2", | ||
"@types/node": "^24.1.0" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
/** | ||
* Read environment variables from file. | ||
* https://github.com/motdotla/dotenv | ||
*/ | ||
// import dotenv from 'dotenv'; | ||
// import path from 'path'; | ||
// dotenv.config({ path: path.resolve(__dirname, '.env') }); | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
testDir: './tests', | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env.CI ? 1 : undefined, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: 'html', | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
// baseURL: 'http://localhost:3000', | ||
|
||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: 'on-first-retry', | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
|
||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
|
||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] }, | ||
}, | ||
|
||
/* Test against mobile viewports. */ | ||
// { | ||
// name: 'Mobile Chrome', | ||
// use: { ...devices['Pixel 5'] }, | ||
// }, | ||
// { | ||
// name: 'Mobile Safari', | ||
// use: { ...devices['iPhone 12'] }, | ||
// }, | ||
|
||
/* Test against branded browsers. */ | ||
// { | ||
// name: 'Microsoft Edge', | ||
// use: { ...devices['Desktop Edge'], channel: 'msedge' }, | ||
// }, | ||
// { | ||
// name: 'Google Chrome', | ||
// use: { ...devices['Desktop Chrome'], channel: 'chrome' }, | ||
// }, | ||
], | ||
|
||
/* Run your local dev server before starting the tests */ | ||
// webServer: { | ||
// command: 'npm run start', | ||
// url: 'http://localhost:3000', | ||
// reuseExistingServer: !process.env.CI, | ||
// }, | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
packages: | ||
- '.' |
22 changes: 22 additions & 0 deletions
22
typescript-sdk/apps/dojo/e2e2/tests/agno-agentic-chat.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('renders initial message', async ({ page }) => { | ||
await page.goto('http://localhost:9999/agno/feature/agentic_chat'); | ||
|
||
await expect(page.getByText('Hi, I\'m an agent. Want to chat?')).toBeVisible(); | ||
}); | ||
|
||
test('responds to user message', async ({ page }) => { | ||
await page.goto('http://localhost:9999/agno/feature/agentic_chat'); | ||
|
||
const textarea = page.getByPlaceholder('Type a message...'); | ||
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.'); | ||
await page.keyboard.press('Enter'); | ||
|
||
page.locator('.copilotKitInputControls button.copilotKitInputControlButton').click(); | ||
|
||
await expect(page.locator('.copilotKitMessage')).toHaveCount(3); | ||
await expect(page.locator('.copilotKitMessage.copilotKitAssistantMessage')).toHaveCount(2); | ||
await expect(page.locator('.copilotKitMessage.copilotKitUserMessage')).toHaveCount(1); | ||
await expect(page.locator('.copilotKitMessage.copilotKitAssistantMessage').last()).toHaveText('four', { ignoreCase: true }); | ||
}); |
22 changes: 22 additions & 0 deletions
22
typescript-sdk/apps/dojo/e2e2/tests/crewai-agentic-chat.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('renders initial message', async ({ page }) => { | ||
await page.goto('http://localhost:9999/crewai/feature/agentic_chat'); | ||
|
||
await expect(page.getByText('Hi, I\'m an agent. Want to chat?')).toBeVisible(); | ||
}); | ||
|
||
test('responds to user message', async ({ page }) => { | ||
await page.goto('http://localhost:9999/crewai/feature/agentic_chat'); | ||
|
||
const textarea = page.getByPlaceholder('Type a message...'); | ||
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.'); | ||
await page.keyboard.press('Enter'); | ||
|
||
page.locator('.copilotKitInputControls button.copilotKitInputControlButton').click(); | ||
|
||
await expect(page.locator('.copilotKitMessage')).toHaveCount(3); | ||
await expect(page.locator('.copilotKitMessage.copilotKitAssistantMessage')).toHaveCount(2); | ||
await expect(page.locator('.copilotKitMessage.copilotKitUserMessage')).toHaveCount(1); | ||
await expect(page.locator('.copilotKitMessage.copilotKitAssistantMessage').last()).toHaveText('four', { ignoreCase: true }); | ||
}); |
22 changes: 22 additions & 0 deletions
22
typescript-sdk/apps/dojo/e2e2/tests/langgraph-agentic-chat.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('renders initial message', async ({ page }) => { | ||
await page.goto('http://localhost:9999/langgraph/feature/agentic_chat'); | ||
|
||
await expect(page.getByText('Hi, I\'m an agent. Want to chat?')).toBeVisible(); | ||
}); | ||
|
||
test('responds to user message', async ({ page }) => { | ||
await page.goto('http://localhost:9999/langgraph/feature/agentic_chat'); | ||
|
||
const textarea = page.getByPlaceholder('Type a message...'); | ||
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.'); | ||
await page.keyboard.press('Enter'); | ||
|
||
page.locator('.copilotKitInputControls button.copilotKitInputControlButton').click(); | ||
|
||
await expect(page.locator('.copilotKitMessage')).toHaveCount(3); | ||
await expect(page.locator('.copilotKitMessage.copilotKitAssistantMessage')).toHaveCount(2); | ||
await expect(page.locator('.copilotKitMessage.copilotKitUserMessage')).toHaveCount(1); | ||
await expect(page.locator('.copilotKitMessage.copilotKitAssistantMessage').last()).toHaveText('four', { ignoreCase: true }); | ||
}); |
22 changes: 22 additions & 0 deletions
22
typescript-sdk/apps/dojo/e2e2/tests/llama-index-agentic-chat.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('renders initial message', async ({ page }) => { | ||
await page.goto('http://localhost:9999/llama-index/feature/agentic_chat'); | ||
|
||
await expect(page.getByText('Hi, I\'m an agent. Want to chat?')).toBeVisible(); | ||
}); | ||
|
||
test('responds to user message', async ({ page }) => { | ||
await page.goto('http://localhost:9999/llama-index/feature/agentic_chat'); | ||
|
||
const textarea = page.getByPlaceholder('Type a message...'); | ||
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.'); | ||
await page.keyboard.press('Enter'); | ||
|
||
page.locator('.copilotKitInputControls button.copilotKitInputControlButton').click(); | ||
|
||
await expect(page.locator('.copilotKitMessage')).toHaveCount(3); | ||
await expect(page.locator('.copilotKitMessage.copilotKitAssistantMessage')).toHaveCount(2); | ||
await expect(page.locator('.copilotKitMessage.copilotKitUserMessage')).toHaveCount(1); | ||
await expect(page.locator('.copilotKitMessage.copilotKitAssistantMessage').last()).toHaveText('four', { ignoreCase: true }); | ||
}); |
22 changes: 22 additions & 0 deletions
22
typescript-sdk/apps/dojo/e2e2/tests/mastra-agentic-chat.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('renders initial message', async ({ page }) => { | ||
await page.goto('http://localhost:9999/mastra/feature/agentic_chat'); | ||
|
||
await expect(page.getByText('Hi, I\'m an agent. Want to chat?')).toBeVisible(); | ||
}); | ||
|
||
test('responds to user message', async ({ page }) => { | ||
await page.goto('http://localhost:9999/mastra/feature/agentic_chat'); | ||
|
||
const textarea = page.getByPlaceholder('Type a message...'); | ||
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.'); | ||
await page.keyboard.press('Enter'); | ||
|
||
page.locator('.copilotKitInputControls button.copilotKitInputControlButton').click(); | ||
|
||
await expect(page.locator('.copilotKitMessage')).toHaveCount(3); | ||
await expect(page.locator('.copilotKitMessage.copilotKitAssistantMessage')).toHaveCount(2); | ||
await expect(page.locator('.copilotKitMessage.copilotKitUserMessage')).toHaveCount(1); | ||
await expect(page.locator('.copilotKitMessage.copilotKitAssistantMessage').last()).toHaveText('four', { ignoreCase: true }); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this leave us open to flakey tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could but so far even in CI everything is running in <5 seconds from dojo coming up, so I figured 10 seconds is a big enough buffer.
Ideally we can add a health check to all of the agents and make sure they're all running before we move on, but I didn't want to block on that.