test: add e2e tests
This commit is contained in:
45
frontend/playwright.config.ts
Normal file
45
frontend/playwright.config.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
import path from 'path';
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './e2e',
|
||||
|
||||
// Auto-starts the SvelteKit dev server before E2E tests.
|
||||
// Reuses the existing server if already running (e.g. during active development).
|
||||
// The backend + DB + MinIO must be started separately (see README or CI workflow).
|
||||
webServer: {
|
||||
command: 'npm run dev',
|
||||
url: 'http://localhost:3000',
|
||||
reuseExistingServer: true,
|
||||
timeout: 30_000
|
||||
},
|
||||
fullyParallel: false, // tests share auth state → run sequentially within a worker
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
workers: 1,
|
||||
|
||||
use: {
|
||||
baseURL: process.env.E2E_BASE_URL ?? 'http://localhost:3000',
|
||||
screenshot: 'on', // always capture screenshots
|
||||
video: 'retain-on-failure',
|
||||
trace: 'retain-on-failure'
|
||||
},
|
||||
|
||||
projects: [
|
||||
// 1. Auth setup: logs in and saves the session cookie to disk
|
||||
{
|
||||
name: 'setup',
|
||||
testMatch: /auth\.setup\.ts/
|
||||
},
|
||||
// 2. All E2E tests, re-using the stored session
|
||||
{
|
||||
name: 'chromium',
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
storageState: path.join(__dirname, 'e2e/.auth/user.json')
|
||||
},
|
||||
dependencies: ['setup']
|
||||
}
|
||||
],
|
||||
|
||||
outputDir: 'test-results/e2e'
|
||||
});
|
||||
Reference in New Issue
Block a user