-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.js
More file actions
59 lines (57 loc) · 1.73 KB
/
Copy pathplaywright.config.js
File metadata and controls
59 lines (57 loc) · 1.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
import { defineConfig } from '@playwright/test';
const host = '127.0.0.1';
const target = process.env.LINUXPATH_E2E_TARGET || 'source';
const servers = {
source: { port: 4177, directory: '.', serviceWorkers: 'block' },
dist: { port: 4178, directory: 'dist', serviceWorkers: 'block' },
offline: { port: 4179, directory: 'dist', serviceWorkers: 'allow' },
};
if (!servers[target]) {
throw new Error(`Unknown LINUXPATH_E2E_TARGET=${target}`);
}
const selected = servers[target];
const baseURL = `http://${host}:${selected.port}/`;
const node = `"${process.execPath}"`;
const managedServer = process.env.LINUXPATH_E2E_MANAGED_SERVER === '1';
export default defineConfig({
testDir: './tests/e2e',
fullyParallel: false,
forbidOnly: true,
retries: 0,
workers: 1,
timeout: 30_000,
expect: { timeout: 5_000 },
maxFailures: 0,
outputDir: `test-results/artifacts-${target}`,
reporter: [
['list'],
['json', { outputFile: `test-results/playwright-${target}.json` }],
],
...(managedServer ? {} : {
webServer: {
command: `${node} scripts/e2e-static-server.mjs ${selected.port} ${selected.directory}`,
url: baseURL,
reuseExistingServer: false,
timeout: 30_000,
stdout: 'ignore',
stderr: 'pipe',
},
}),
use: {
baseURL,
headless: true,
locale: 'fr-FR',
timezoneId: 'Europe/Paris',
viewport: { width: 1440, height: 1000 },
launchOptions: { args: ['--no-sandbox'] },
serviceWorkers: selected.serviceWorkers,
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
projects: [
target === 'offline'
? { name: target, testMatch: /offline\.spec\.js/ }
: { name: target, testIgnore: /offline\.spec\.js/ },
],
});