mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
- server.sh removes e2e/.tmp when the backend exits, forwarding SIGTERM so Playwright's graceful shutdown still applies - a cleanup reporter removes playwright-report and test-results after a passing run; failed runs keep them for debugging and CI upload
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test'
|
|
import { BASE_URL, E2E_ROOT, REPORT_DIR, REPO_ROOT, STORAGE_STATE, TEST_RESULTS_DIR, createServerEnv } from './env'
|
|
|
|
export default defineConfig({
|
|
testDir: E2E_ROOT,
|
|
outputDir: TEST_RESULTS_DIR,
|
|
fullyParallel: false,
|
|
forbidOnly: Boolean(process.env.CI),
|
|
retries: process.env.CI ? 2 : 0,
|
|
workers: process.env.CI ? 1 : undefined,
|
|
timeout: 60_000,
|
|
expect: { timeout: 15_000 },
|
|
reporter: [
|
|
['list'],
|
|
['html', { open: 'never', outputFolder: REPORT_DIR }],
|
|
['./cleanup-reporter.ts'],
|
|
],
|
|
use: {
|
|
baseURL: BASE_URL,
|
|
trace: 'on-first-retry',
|
|
screenshot: 'only-on-failure',
|
|
video: 'retain-on-failure',
|
|
},
|
|
projects: [
|
|
{
|
|
name: 'setup',
|
|
testMatch: /auth\.setup\.ts/,
|
|
},
|
|
{
|
|
name: 'chromium',
|
|
testMatch: /.*\.spec\.ts/,
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
storageState: STORAGE_STATE,
|
|
},
|
|
dependencies: ['setup'],
|
|
},
|
|
],
|
|
webServer: {
|
|
command: 'bash e2e/server.sh',
|
|
cwd: REPO_ROOT,
|
|
url: `${BASE_URL}/api/health`,
|
|
timeout: 180_000,
|
|
reuseExistingServer: false,
|
|
gracefulShutdown: { signal: 'SIGTERM', timeout: 15_000 },
|
|
env: createServerEnv(),
|
|
},
|
|
})
|