Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/dojo-e2e.yml
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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.0.0
version: 10.13.1

- name: Setup pnpm cache
uses: actions/cache@v4
Expand Down
7 changes: 7 additions & 0 deletions typescript-sdk/apps/dojo/e2e2/.gitignore
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/
14 changes: 14 additions & 0 deletions typescript-sdk/apps/dojo/e2e2/package.json
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"
}
}
79 changes: 79 additions & 0 deletions typescript-sdk/apps/dojo/e2e2/playwright.config.ts
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,
// },
});
67 changes: 67 additions & 0 deletions typescript-sdk/apps/dojo/e2e2/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions typescript-sdk/apps/dojo/e2e2/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- '.'
22 changes: 22 additions & 0 deletions typescript-sdk/apps/dojo/e2e2/tests/agno-agentic-chat.spec.ts
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 typescript-sdk/apps/dojo/e2e2/tests/crewai-agentic-chat.spec.ts
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 });
});
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 });
});
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 typescript-sdk/apps/dojo/e2e2/tests/mastra-agentic-chat.spec.ts
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 });
});
Loading