-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
60 lines (51 loc) · 1.35 KB
/
playwright.config.ts
File metadata and controls
60 lines (51 loc) · 1.35 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
import os from "node:os";
import { defineConfig, devices } from "@playwright/test";
const countOfCpus = os.cpus().length;
const workers = countOfCpus
? // utilize all logical processors up to a max of 4 to limit RAM usage
Math.min(countOfCpus, 4)
: undefined;
const isInCi = process.env.CI === "true";
export default defineConfig({
testDir: "./e2e-tests",
fullyParallel: true,
// fail a Playwright run in CI if some test.only is in the source code
forbidOnly: isInCi,
retries: isInCi ? 1 : 0,
workers,
reporter: isInCi ? [["html"], ["github"]] : "html",
use: {
baseURL: `http://localhost:5173`,
// ensure consistent timezone and locale
timezoneId: "America/Los_Angeles",
locale: "en-US",
// always capture trace and video (seems to not have significant performance impact)
trace: "on",
video: "on",
},
projects: [
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
// opt into "New Headless" chromium (https://playwright.dev/docs/browsers#chromium-new-headless-mode, https://developer.chrome.com/docs/chromium/headless)
channel: "chromium",
},
},
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},
{
name: "webkit",
use: { ...devices["Desktop Safari"] },
},
],
webServer: [
{
command: "npm run start",
url: "http://localhost:5173",
reuseExistingServer: !isInCi,
},
],
});