-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
51 lines (46 loc) · 1.32 KB
/
playwright.config.ts
File metadata and controls
51 lines (46 loc) · 1.32 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
import fs from "node:fs";
import { defineConfig, devices } from "@playwright/test";
const SYSTEM_CHROME_CANDIDATES = [
process.env.PLAYWRIGHT_CHROME_PATH,
"/opt/google/chrome/chrome",
"/usr/bin/google-chrome",
"/usr/bin/google-chrome-stable",
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
].filter((value): value is string => Boolean(value && value.trim()));
function resolveUseSystemChrome(): boolean {
const explicit = process.env.PLAYWRIGHT_USE_SYSTEM_CHROME?.trim().toLowerCase();
if (explicit === "true") {
return true;
}
if (explicit === "false") {
return false;
}
return SYSTEM_CHROME_CANDIDATES.some((candidate) => fs.existsSync(candidate));
}
const useSystemChrome = resolveUseSystemChrome();
export default defineConfig({
testDir: "./e2e",
fullyParallel: false,
timeout: 30_000,
expect: {
timeout: 5_000,
},
reporter: [["list"]],
use: {
headless: true,
screenshot: "only-on-failure",
video: "off",
trace: "retain-on-failure",
},
projects: [
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
...(useSystemChrome ? { channel: "chrome" as const } : {}),
},
},
],
});