-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
256 lines (245 loc) · 12.1 KB
/
Copy pathplaywright.config.ts
File metadata and controls
256 lines (245 loc) · 12.1 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
import { defineConfig, devices } from '@playwright/test'
/**
* Global test ignore patterns - shared across all projects
* These patterns are applied to all browser configurations
*
* LOCAL TESTS (91+ tests across 7 spec files - run with `pnpm test:e2e`):
* - av-quality.spec.ts: 16 tests (audio/video quality metrics)
* - dtmf.spec.ts: 11 tests (DTMF tones, has internal webkit skip)
* - call-transfer.spec.ts: 8 tests (call transfer functionality)
* - incoming-call.spec.ts: 12 tests (incoming call handling)
* - call-hold.spec.ts: 7 tests (hold/resume functionality)
* - performance.spec.ts: 21 tests (page load, runtime performance)
* - basic-call-flow.spec.ts: 16 tests (full call flow scenarios)
* - accessibility.spec.ts: 24 tests (WCAG compliance, requires mockSipServer)
*
* CI TESTS (~17+ tests in chromium/firefox, WebKit skips more - mockSipServer-dependent tests excluded):
* - performance.spec.ts: Page Load (4), Resource Loading (3), Network (3), Benchmarks (1) = 11 tests
* - accessibility-ci.spec.ts: 6 tests (basic WCAG compliance without mockSipServer)
* - pbx-recordings-smoke.spec.ts: 2 tests (usePbxRecordings list → play → getPlaybackUrl with mock provider)
* - app-functionality-ci.spec.ts: Skipped in CI (Vue components don't render in time)
* - Note: Tests requiring mockSipServer/SIP client don't work reliably in CI
* - WebKit has additional issues with app loading in CI (see WEBKIT_KNOWN_ISSUES.md)
* - All 91+ tests pass locally and can be run for development verification
*/
const GLOBAL_TEST_IGNORE = [
// Debug/diagnostic tests - intentionally skipped
/simple-debug\.spec\.ts/, // Debug test for manual troubleshooting
/quick-test\.spec\.ts/, // Debug test for quick checks
/quick-diag\.spec\.ts/, // Diagnostic test for connection debugging
/diagnose-registration\.spec\.ts/, // Diagnostic test
/eventbridge-lifecycle-diagnostic\.spec\.ts/, // Diagnostic for EventBridge
// Feature gaps - tests for unimplemented features
/multi-line\.spec\.ts/, // Tests unimplemented multi-line UI feature
// Infrastructure requirements - need additional mock capabilities
/audio-devices\.spec\.ts/, // Requires mock media device integration
/multi-user\.spec\.ts/, // Requires multi-instance mock coordination
/network-conditions\.spec\.ts/, // Requires mockSipServer (unreliable in CI like other mock tests)
// CI-specific issues - pass locally but fail in CI
/accessibility\.spec\.ts/, // CI timing issues with axe-core (24 tests pass locally)
// Demo specs use fragile text/role selectors against playground pages and
// consistently fail in CI (164 tests × 2 retries × 60s timeout each = hours
// of wasted CI time). Coverage of the same demo surfaces is provided by the
// lightweight playground-demos-ci.spec.ts with data-testid selectors.
// These specs remain available for local development (pnpm test:e2e).
/agent-login-demo\.spec\.ts/,
/contacts-demo\.spec\.ts/,
/e911-demo\.spec\.ts/,
/multi-line-demo\.spec\.ts/,
/recording-management-demo\.spec\.ts/,
/ring-groups-demo\.spec\.ts/,
]
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests/e2e',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only - keep at 1 to bound total CI time on flaky tests */
retries: process.env.CI ? 1 : 0,
/* Run tests in parallel - limited in CI to prevent resource exhaustion */
workers: process.env.CI ? 2 : undefined,
/* Global test ignore patterns - debug/diagnostic tests and mock infrastructure issues */
testIgnore: GLOBAL_TEST_IGNORE,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
['html'],
['./tests/e2e/reporters/custom-reporter.ts'],
['json', { outputFile: 'test-results/results.json' }],
['junit', { outputFile: 'test-results/junit.xml' }],
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL used with APP_URL and other relative navigations. */
baseURL: 'http://localhost:5173',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
/* Capture screenshot on test failure */
screenshot: 'only-on-failure',
/* Record video on test failure */
video: 'retain-on-failure',
/* CI-aware timeouts - double timeouts in CI environment for reliability */
actionTimeout: process.env.CI ? 20000 : 10000,
navigationTimeout: process.env.CI ? 60000 : 30000,
},
/* Global test timeout - increased for CI */
timeout: process.env.CI ? 60000 : 30000,
/* Expect timeout for assertions */
expect: {
timeout: process.env.CI ? 15000 : 5000,
},
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
launchOptions: {
args: [
'--disable-dev-shm-usage',
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-gpu',
'--disable-software-rasterizer',
// Only use single-process in strict CI containers to avoid memory exhaustion
...(process.env.CI && process.env.CONTAINER ? ['--single-process', '--no-zygote'] : []),
// Memory management
'--js-flags=--max-old-space-size=2048',
'--disable-extensions',
'--disable-background-timer-throttling',
'--disable-backgrounding-occluded-windows',
'--disable-renderer-backgrounding',
// Media device mocking
'--use-fake-device-for-media-stream',
'--use-fake-ui-for-media-stream',
],
},
permissions: ['microphone', 'camera'],
},
// Tests with known infrastructure issues in CI
// mockSipServer fixture doesn't work reliably in CI environments
testIgnore: [
...GLOBAL_TEST_IGNORE,
/visual-regression\.spec\.ts/, // Uses test.describe.skip() internally
/error-scenarios\.spec\.ts/, // CI mock SIP infrastructure issues
/app-functionality\.spec\.ts/, // CI mock SIP infrastructure issues
/app-functionality-ci\.spec\.ts/, // CI app loading issues - Vue components don't render in time
/av-quality\.spec\.ts/, // CI mock SIP infrastructure issues
/basic-call-flow\.spec\.ts/, // CI mock SIP infrastructure issues
/call-hold\.spec\.ts/, // CI mock SIP infrastructure issues
/call-transfer\.spec\.ts/, // CI mock SIP infrastructure issues
/incoming-call\.spec\.ts/, // CI mock SIP infrastructure issues
/dtmf\.spec\.ts/, // CI mock SIP infrastructure issues
],
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
// Tests with known infrastructure issues in CI
// mockSipServer fixture doesn't work reliably in CI environments
testIgnore: [
...GLOBAL_TEST_IGNORE,
/visual-regression\.spec\.ts/,
/error-scenarios\.spec\.ts/, // CI mock SIP infrastructure issues
/app-functionality\.spec\.ts/, // CI mock SIP infrastructure issues
/app-functionality-ci\.spec\.ts/, // CI app loading issues - Vue components don't render in time
/av-quality\.spec\.ts/, // CI mock SIP infrastructure issues
/basic-call-flow\.spec\.ts/, // CI mock SIP infrastructure issues
/call-hold\.spec\.ts/, // CI mock SIP infrastructure issues
/call-transfer\.spec\.ts/, // CI mock SIP infrastructure issues
/incoming-call\.spec\.ts/, // CI mock SIP infrastructure issues
/dtmf\.spec\.ts/, // CI mock SIP infrastructure issues
],
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
// Tests with known infrastructure issues in CI
// mockSipServer fixture doesn't work reliably in CI environments
// WebKit also has JsSIP Proxy incompatibility (see WEBKIT_KNOWN_ISSUES.md)
testIgnore: [
...GLOBAL_TEST_IGNORE,
/visual-regression\.spec\.ts/,
/error-scenarios\.spec\.ts/, // CI mock SIP infrastructure issues
/app-functionality\.spec\.ts/, // CI mock SIP infrastructure issues
/app-functionality-ci\.spec\.ts/, // WebKit has app loading issues in CI
/accessibility-ci\.spec\.ts/, // WebKit has app loading issues in CI
/av-quality\.spec\.ts/, // CI mock SIP infrastructure issues
/basic-call-flow\.spec\.ts/, // CI mock SIP infrastructure issues
/call-hold\.spec\.ts/, // CI mock SIP infrastructure issues
/call-transfer\.spec\.ts/, // CI mock SIP infrastructure issues
/incoming-call\.spec\.ts/, // CI mock SIP infrastructure issues
/dtmf\.spec\.ts/, // CI mock SIP infrastructure issues
/performance\.spec\.ts/, // JsSIP Proxy incompatibility (see WEBKIT_KNOWN_ISSUES.md)
],
},
/* Test against mobile viewports. */
{
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
// Tests with known infrastructure issues in CI
// mockSipServer fixture doesn't work reliably in CI environments
testIgnore: [
...GLOBAL_TEST_IGNORE,
/visual-regression\.spec\.ts/,
/error-scenarios\.spec\.ts/, // CI mock SIP infrastructure issues
/app-functionality\.spec\.ts/, // CI mock SIP infrastructure issues
/app-functionality-ci\.spec\.ts/, // Mobile browsers have app loading issues in CI
/accessibility-ci\.spec\.ts/, // Mobile browsers have app loading issues in CI
/av-quality\.spec\.ts/, // CI mock SIP infrastructure issues
/basic-call-flow\.spec\.ts/, // CI mock SIP infrastructure issues
/call-hold\.spec\.ts/, // CI mock SIP infrastructure issues
/call-transfer\.spec\.ts/, // CI mock SIP infrastructure issues
/incoming-call\.spec\.ts/, // CI mock SIP infrastructure issues
/dtmf\.spec\.ts/, // CI mock SIP infrastructure issues
],
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'] },
// Tests with known infrastructure issues in CI
// mockSipServer fixture doesn't work reliably in CI environments
// WebKit also has JsSIP Proxy incompatibility (see WEBKIT_KNOWN_ISSUES.md)
testIgnore: [
...GLOBAL_TEST_IGNORE,
/visual-regression\.spec\.ts/,
/error-scenarios\.spec\.ts/, // CI mock SIP infrastructure issues
/app-functionality\.spec\.ts/, // CI mock SIP infrastructure issues
/app-functionality-ci\.spec\.ts/, // WebKit has app loading issues in CI
/accessibility-ci\.spec\.ts/, // WebKit has app loading issues in CI
/av-quality\.spec\.ts/, // CI mock SIP infrastructure issues
/basic-call-flow\.spec\.ts/, // CI mock SIP infrastructure issues
/call-hold\.spec\.ts/, // CI mock SIP infrastructure issues
/call-transfer\.spec\.ts/, // CI mock SIP infrastructure issues
/incoming-call\.spec\.ts/, // CI mock SIP infrastructure issues
/dtmf\.spec\.ts/, // CI mock SIP infrastructure issues
/performance\.spec\.ts/, // JsSIP Proxy incompatibility (see WEBKIT_KNOWN_ISSUES.md)
],
},
],
/* Run your local dev server before starting the tests */
webServer: [
{
command: 'pnpm run dev',
url: 'http://localhost:5173',
reuseExistingServer: !process.env.CI,
timeout: 120000, // 2 minutes for CI environments
stdout: process.env.CI ? 'pipe' : 'ignore',
stderr: process.env.CI ? 'pipe' : 'ignore',
},
{
// Port is configurable via CALL_CENTER_PORT so the suite can run when the
// default 5174 is occupied (e.g. by another dev app). Test files read
// CALL_CENTER_URL for the base URL accordingly.
command: `pnpm --dir examples/call-center dev --host 127.0.0.1 --port ${process.env.CALL_CENTER_PORT || '5174'}`,
url: `http://localhost:${process.env.CALL_CENTER_PORT || '5174'}`,
reuseExistingServer: !process.env.CI,
timeout: 120000,
stdout: process.env.CI ? 'pipe' : 'ignore',
stderr: process.env.CI ? 'pipe' : 'ignore',
},
],
})