-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
71 lines (59 loc) · 1.73 KB
/
Copy pathplaywright.config.ts
File metadata and controls
71 lines (59 loc) · 1.73 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
61
62
63
64
65
66
67
68
69
70
71
import { defineConfig, devices } from '@playwright/test';
/**
* Playwright configuration for SonoLens E2E tests
*
* Tests run against preview deployments in CI, or local dev server in development.
* All external APIs (Spotify, OpenAI) are mocked for fast, deterministic execution.
*/
export default defineConfig({
testDir: './tests/e2e',
// Run tests sequentially for predictable state
fullyParallel: false,
// Fail CI if test.only() is accidentally left in
forbidOnly: !!process.env.CI,
// Retry failed tests in CI to handle flakiness
retries: process.env.CI ? 2 : 0,
// Single worker for deterministic testing
workers: 1,
// Reporter configuration
reporter: process.env.CI
? [['github'], ['html']] // Use both in CI
: 'html', // Interactive HTML report in development
use: {
// Base URL: Use env var if set (e.g. Vercel Preview), otherwise localhost
baseURL:
process.env.PLAYWRIGHT_TEST_BASE_URL ||
(process.env.CI ? 'http://localhost:4173' : 'http://localhost:5173'),
// Trace on first retry for debugging
trace: 'on-first-retry',
// Screenshots and videos on failure
screenshot: 'only-on-failure',
video: 'retain-on-failure',
// Timeouts
actionTimeout: 10000,
navigationTimeout: 30000
},
// Test configuration
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] }
}
],
// Start server only if we're not testing a remote URL
webServer: process.env.PLAYWRIGHT_TEST_BASE_URL
? undefined
: process.env.CI
? {
command: 'npm run preview',
url: 'http://localhost:4173',
reuseExistingServer: false,
timeout: 120000
}
: {
command: 'npm run dev',
url: 'http://localhost:5173',
reuseExistingServer: true,
timeout: 120000
}
});