-
Notifications
You must be signed in to change notification settings - Fork 875
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
106 lines (89 loc) · 2.73 KB
/
playwright.config.ts
File metadata and controls
106 lines (89 loc) · 2.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
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
/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { defineConfig, devices } from '@playwright/test';
/**
* Playwright configuration for Mifos X Web App E2E tests.
*
* Optimized for:
* - Self-signed SSL certificate handling (local Fineract backend)
* - CI/CD efficiency (artifacts only on failure)
* - Debugging support (traces, videos, screenshots)
*
* @see https://playwright.dev/docs/test-configuration
*/
export default defineConfig({
// Test directory
testDir: './playwright/tests',
// Exclude Angular component tests
testIgnore: 'src/**',
// Fail the build if test.only is left in source (CI safety)
forbidOnly: !!process.env.CI,
// Retry failed tests in CI
retries: process.env.CI ? 2 : 0,
// Limit parallel workers in CI
workers: process.env.CI ? 1 : undefined,
// Reporter configuration
reporter: [
[
'html',
{ outputFolder: 'playwright-report', open: 'never' }],
['list']
],
// Global test settings
use: {
// Base URL for the Angular app
baseURL: 'http://localhost:4200',
// Handle self-signed certificates from Fineract backend
ignoreHTTPSErrors: true,
// Collect trace on failure for debugging
trace: 'retain-on-failure',
// Record video on failure only (storage efficient)
video: 'retain-on-failure',
// Screenshot on failure only
screenshot: 'only-on-failure',
// Default navigation timeout (increased for CI and financial app)
navigationTimeout: 120000,
// Default action timeout
actionTimeout: 30000,
// Configure backend URL for tests
extraHTTPHeaders: {
Accept: 'application/json'
}
},
// Global test timeout (per test)
timeout: process.env.CI ? 180000 : 120000,
// Configure projects for different browsers
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
// Launch options for handling SSL in headed mode
launchOptions: {
args: ['--ignore-certificate-errors']
}
}
}
],
// Web server configuration
// In CI: builds production bundle (without base-href), then serves it with http-server
// Locally: reuses existing ng serve if running
webServer: {
command: process.env.CI
? 'npm run build && npx http-server ./dist/web-app/browser -p 4200 --silent'
: 'npm run start',
url: 'http://localhost:4200',
reuseExistingServer: !process.env.CI,
timeout: 180000,
// Add retry logic for server startup
...(process.env.CI && {
stdout: 'pipe',
stderr: 'pipe'
})
}
});