-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathplaywright.config.js
More file actions
72 lines (62 loc) · 1.8 KB
/
Copy pathplaywright.config.js
File metadata and controls
72 lines (62 loc) · 1.8 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
const {defineConfig, devices} = require('@playwright/test');
const {execSync} = require('child_process');
// Use different port for tests to avoid conflicts with dev server
const TEST_PORT = 8001;
// Detect available browsers
function getAvailableBrowsers() {
const browsers = [];
// Chromium is always available
browsers.push({
name: 'chromium',
use: {...devices['Desktop Chrome']},
});
// Firefox is always available
browsers.push({
name: 'firefox',
use: {...devices['Desktop Firefox']},
});
// Check if webkit dependencies are available
try {
execSync('which wpe-webkit-2.44-driver 2>/dev/null || ldconfig -p | grep -q libwpe', {stdio: 'ignore'});
browsers.push({
name: 'webkit',
use: {...devices['Desktop Safari']},
});
} catch {
// Webkit dependencies not available, skip
console.log('Webkit dependencies not found, skipping Safari tests');
}
return browsers;
}
module.exports = defineConfig({
globalSetup: './tests/e2e/global-setup.js',
testDir: './tests/e2e',
timeout: 30 * 1000,
expect: {
timeout: 10000
},
fullyParallel: false,
workers: 1,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 1,
reporter: 'html',
use: {
// Nastav cez env: PLAYWRIGHT_BASE_URL=https://limas npm run test:e2e
baseURL: process.env.PLAYWRIGHT_BASE_URL || `http://localhost:${TEST_PORT}`,
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
ignoreHTTPSErrors: true,
},
projects: getAvailableBrowsers(),
webServer: process.env.PLAYWRIGHT_BASE_URL ? undefined : {
command: `symfony server:start --port=${TEST_PORT} --no-tls --daemon=false 2>/dev/null`,
port: TEST_PORT,
reuseExistingServer: false, // Always start fresh test server
timeout: 120 * 1000,
env: {
...process.env,
APP_ENV: process.env.APP_ENV || 'test',
},
},
});