-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathplaywright.config.js
More file actions
110 lines (101 loc) · 3.14 KB
/
playwright.config.js
File metadata and controls
110 lines (101 loc) · 3.14 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
/**
* Playwright E2E configuration for Proclaim.
*
* Configuration is resolved with a two-layer approach:
* 1. build.dist.properties — default values (committed, safe to share)
* 2. build.properties — local overrides for credentials/paths (gitignored)
*
* To get started: copy build.dist.properties → build.properties and fill in
* per-site credentials (builder.j5dev.username, etc.) and site URLs.
*/
const fs = require('fs');
const path = require('path');
const { defineConfig, devices } = require('@playwright/test');
/** Parse a Java-style .properties file into a plain object. */
function parseProperties(filePath) {
const props = {};
if (!fs.existsSync(filePath)) {
return props;
}
const lines = fs.readFileSync(filePath, 'utf8').split('\n');
for (const line of lines) {
const trimmed = line.trim();
if (!trimmed || trimmed.startsWith('#')) {
continue;
}
const eq = trimmed.indexOf('=');
if (eq === -1) {
continue;
}
const key = trimmed.slice(0, eq).trim();
const value = trimmed.slice(eq + 1).trim();
props[key] = value;
}
return props;
}
/**
* Load properties with dist-file defaults overridden by local build.properties.
* Keys present in build.properties always take precedence.
*/
function loadProps() {
const dist = parseProperties(path.join(__dirname, 'build.dist.properties'));
const local = parseProperties(path.join(__dirname, 'build.properties'));
return { ...dist, ...local };
}
const props = loadProps();
const j5Url = props['builder.j5dev.url'] || 'https://j5-dev.local:8890';
const j6Url = props['builder.j6dev.url'] || 'https://j6-dev.local:8890';
module.exports = defineConfig({
testDir: './tests/e2e',
outputDir: 'test-results/',
fullyParallel: false,
workers: 1,
retries: 0,
timeout: 30000,
globalSetup: require.resolve('./tests/e2e/global-setup.js'),
reporter: [
['list'],
['html', { outputFolder: 'build/reports/e2e', open: 'never' }],
],
use: {
ignoreHTTPSErrors: true,
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
projects: [
{
name: 'admin-j5',
testMatch: '**/admin/**/*.spec.js',
use: {
...devices['Desktop Chrome'],
baseURL: j5Url,
storageState: 'tests/e2e/.auth/admin-j5.json',
},
},
{
name: 'site-j5',
testMatch: '**/site/**/*.spec.js',
use: {
...devices['Desktop Chrome'],
baseURL: j5Url,
},
},
{
name: 'admin-j6',
testMatch: '**/admin/**/*.spec.js',
use: {
...devices['Desktop Chrome'],
baseURL: j6Url,
storageState: 'tests/e2e/.auth/admin-j6.json',
},
},
{
name: 'site-j6',
testMatch: '**/site/**/*.spec.js',
use: {
...devices['Desktop Chrome'],
baseURL: j6Url,
},
},
],
});