-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
60 lines (56 loc) · 1.63 KB
/
playwright.config.ts
File metadata and controls
60 lines (56 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { defineConfig, devices } from '@playwright/test'
import 'dotenv/config'
const PORT = process.env.PORT || '3000'
export default defineConfig({
testDir: './tests/e2e',
// Increase overall test timeout for complex flows
timeout: 60 * 1000,
expect: {
// Increase expect timeout for slow renders
timeout: 15 * 1000,
},
// Run tests in series in CI for better database isolation
fullyParallel: !process.env.CI,
forbidOnly: !!process.env.CI,
// Increase retries for flaky test recovery
retries: process.env.CI ? 3 : 1,
// Single worker in CI for database isolation
workers: process.env.CI ? 1 : undefined,
reporter: process.env.CI ? [['html'], ['github']] : 'html',
// Global setup to clean fixtures before test run
globalSetup: './tests/setup/playwright-global-setup.ts',
use: {
baseURL: `http://localhost:${PORT}/`,
// Capture trace on first retry for debugging
trace: 'on-first-retry',
// Screenshot on failure for debugging
screenshot: 'only-on-failure',
// Video on first retry to help debug flaky tests
video: 'on-first-retry',
// Increase action timeout for slow interactions
actionTimeout: 15 * 1000,
// Increase navigation timeout for slow page loads
navigationTimeout: 30 * 1000,
},
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
},
},
],
webServer: {
command: process.env.CI ? 'bun run start:mocks' : 'bun run dev',
port: Number(PORT),
reuseExistingServer: !process.env.CI,
stdout: 'pipe',
stderr: 'pipe',
// Increase server startup timeout
timeout: 120 * 1000,
env: {
PORT,
PLAYWRIGHT_TEST_BASE_URL: `http://localhost:${PORT}`,
},
},
})