81 lines
2.4 KiB
TypeScript
81 lines
2.4 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test'
|
|
|
|
/**
|
|
* Playwright E2E configuration for Fischer AgentKit frontend.
|
|
*
|
|
* Architecture:
|
|
* - Backend (uvicorn direct, avoids agentkit serve interactive prompts) runs on
|
|
* port 8000 to match the Vite dev-server proxy target in vite.config.ts.
|
|
* - Frontend (Vite dev server) runs on port 5173 (strictPort in vite.config.ts).
|
|
* - Tests target the frontend at http://localhost:5173; API/WS calls are
|
|
* transparently proxied to the backend.
|
|
*
|
|
* The `globalSetup` script creates a test admin user in the auth DB before
|
|
* any test runs, so login-based tests have valid credentials available.
|
|
*/
|
|
|
|
// Project root relative to this config file
|
|
// (src/agentkit/server/frontend/ → 4 levels up to project root)
|
|
const PROJECT_ROOT = '../../../..'
|
|
|
|
export default defineConfig({
|
|
testDir: './e2e',
|
|
fullyParallel: false,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 1 : 0,
|
|
workers: 1,
|
|
reporter: [['list'], ['html', { open: 'never' }]],
|
|
timeout: 90_000,
|
|
expect: { timeout: 15_000 },
|
|
globalSetup: './e2e/global-setup.ts',
|
|
|
|
use: {
|
|
baseURL: 'http://localhost:5173',
|
|
trace: 'on-first-retry',
|
|
screenshot: 'only-on-failure',
|
|
video: 'retain-on-failure',
|
|
actionTimeout: 15_000,
|
|
navigationTimeout: 30_000,
|
|
},
|
|
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
// Use system Chrome to avoid slow browser downloads.
|
|
channel: 'chrome',
|
|
},
|
|
},
|
|
],
|
|
|
|
webServer: [
|
|
{
|
|
// Use uvicorn directly — `agentkit serve` has Confirm.ask() prompts
|
|
// that fail in non-tty subprocess environments.
|
|
// Env vars set inline to avoid Playwright's env property replacing
|
|
// the entire process.env (which would lose PATH, API keys, etc.).
|
|
command:
|
|
'AGENTKIT_GUI_MODE=1 NO_PROXY=127.0.0.1,localhost no_proxy=127.0.0.1,localhost ' +
|
|
'python3 -c "import uvicorn; uvicorn.run(' +
|
|
"'agentkit.server.app:create_app', " +
|
|
"host='127.0.0.1', port=8000, factory=True)\"",
|
|
url: 'http://127.0.0.1:8000/api/v1/health',
|
|
cwd: PROJECT_ROOT,
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 120_000,
|
|
stdout: 'pipe',
|
|
stderr: 'pipe',
|
|
},
|
|
{
|
|
command: 'npm run dev',
|
|
url: 'http://localhost:5173',
|
|
cwd: '.',
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 60_000,
|
|
stdout: 'pipe',
|
|
stderr: 'pipe',
|
|
},
|
|
],
|
|
})
|