feat(09-03): configure Playwright for E2E testing

- Set testDir to './tests/e2e' for E2E tests
- Configure single worker for database safety
- Add desktop and mobile viewports (Desktop Chrome, Pixel 5)
- Enable screenshots on failure, disable video
- Add webServer to auto-build and preview app
- Create separate docker config for deployment tests
This commit is contained in:
Thomas Richter
2026-02-03 23:33:12 +01:00
parent 623811908b
commit 3664afb028
3 changed files with 47 additions and 11 deletions

View File

@@ -1,20 +1,31 @@
import { defineConfig } from '@playwright/test';
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests',
fullyParallel: true,
testDir: './tests/e2e',
fullyParallel: false, // Shared database - avoid race conditions
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: 'html',
workers: 1, // Single worker for database safety
reporter: [['html', { open: 'never' }], ['github']],
use: {
baseURL: process.env.BASE_URL || 'http://localhost:3000',
trace: 'on-first-retry'
baseURL: process.env.BASE_URL || 'http://localhost:4173',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'off'
},
projects: [
{
name: 'chromium',
use: { browserName: 'chromium' }
name: 'chromium-desktop',
use: { ...devices['Desktop Chrome'] }
},
{
name: 'chromium-mobile',
use: { ...devices['Pixel 5'] }
}
]
],
webServer: {
command: 'npm run build && npm run preview',
port: 4173,
reuseExistingServer: !process.env.CI
}
});