-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
90 lines (82 loc) · 2.88 KB
/
playwright.config.ts
File metadata and controls
90 lines (82 loc) · 2.88 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
import { defineConfig, devices } from '@playwright/test';
import * as fs from 'fs';
import * as path from 'path';
import { loadConfig } from './utils/config';
import { logInfo, logWarn } from './utils/logger';
const projectRoot = path.resolve(__dirname, '..');
const caPathFromEnv = process.env.OPENPROJECT_CA_CERT_PATH || process.env.NODE_EXTRA_CA_CERTS;
const defaultCaPath = path.resolve(projectRoot, 'opnc-root-ca.crt');
if (!process.env.NODE_EXTRA_CA_CERTS) {
const candidate = caPathFromEnv ?? defaultCaPath;
if (fs.existsSync(candidate)) {
process.env.NODE_EXTRA_CA_CERTS = candidate;
logInfo('[Playwright Config] Using CA certificate:', candidate);
} else if (caPathFromEnv) {
logWarn('[Playwright Config] CA certificate not found at', candidate, '- TLS verification may fail.');
}
}
const config = loadConfig();
const baseURL = process.env.OPENPROJECT_URL || `https://${config.openproject.host}`;
const workersFromEnv = process.env.E2E_WORKERS
? parseInt(process.env.E2E_WORKERS, 10)
: 1;
function runTimestamp(): string {
const d = new Date();
const Y = d.getFullYear();
const M = String(d.getMonth() + 1).padStart(2, '0');
const D = String(d.getDate()).padStart(2, '0');
const h = String(d.getHours()).padStart(2, '0');
const m = String(d.getMinutes()).padStart(2, '0');
const s = String(d.getSeconds()).padStart(2, '0');
return `${Y}-${M}-${D}_${h}-${m}-${s}`;
}
// Report and run artifacts in timestamped folder outside test-results (Playwright disallows HTML report inside test-results)
const runDir = `playwright-report/run-${runTimestamp()}`;
export default defineConfig({
testDir: './tests',
forbidOnly: !!process.env.CI,
workers: Number.isNaN(workersFromEnv) ? 1 : workersFromEnv,
retries: 0,
globalSetup: require.resolve('./global-setup'),
reporter: [
['list'],
['html', { outputFolder: `${runDir}/report`, open: 'never' }],
['json', { outputFile: `${runDir}/results.json` }],
['junit', { outputFile: `${runDir}/junit.xml` }],
],
use: {
baseURL: baseURL,
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
ignoreHTTPSErrors: true,
viewport: { width: 1280, height: 800 },
headless: true,
actionTimeout: 30000,
navigationTimeout: 30000,
},
projects: [
{
name: 'keycloak-tests',
use: { ...devices['Desktop Chrome'] },
fullyParallel: false,
workers: 1,
testMatch: '**/kc-integration.spec.ts',
},
{
name: 'nextcloud-tests',
use: { ...devices['Desktop Chrome'] },
fullyParallel: false,
workers: 1,
testMatch: '**/nc-integration.spec.ts',
},
{
name: 'op-integration-tests',
use: { ...devices['Desktop Chrome'] },
fullyParallel: false,
workers: 1,
testMatch: '**/*.spec.ts',
testIgnore: ['**/kc-integration.spec.ts', '**/nc-integration.spec.ts'],
},
],
});