-
Notifications
You must be signed in to change notification settings - Fork 104
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
55 lines (51 loc) · 1.44 KB
/
playwright.config.ts
File metadata and controls
55 lines (51 loc) · 1.44 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
import { defineConfig, devices } from "@playwright/test";
import path from "path";
const isCI = !!process.env.CI;
const template: "vite" | "starter" = process.env.TEMPLATE; // Set to 'vite' or 'starter' to run only one
const webServers = {
vite: {
name: "vite-template",
command: "npm run build && npm run preview -- --port 4173",
cwd: path.resolve(__dirname, "../templates/vite"),
url: "http://localhost:4173",
reuseExistingServer: !isCI,
},
starter: {
name: "starter-template",
command: "npm run build && npm run preview -- --port 4174",
cwd: path.resolve(__dirname, "../templates/starter"),
url: "http://localhost:4174",
reuseExistingServer: !isCI,
},
};
const projects = {
vite: {
name: "vite",
testMatch: "vite.spec.ts",
use: {
...devices["Desktop Chrome"],
baseURL: "http://localhost:4173",
},
},
starter: {
name: "starter",
testMatch: "starter.spec.ts",
use: {
...devices["Desktop Chrome"],
baseURL: "http://localhost:4174",
},
},
};
export default defineConfig({
testDir: "./e2e",
fullyParallel: true,
forbidOnly: isCI,
retries: isCI ? 2 : 0,
workers: isCI ? 1 : undefined,
reporter: isCI ? [["github"], ["html", { open: "never" }]] : "html",
use: {
trace: "on-first-retry",
},
projects: projects[template] ? [projects[template]] : Object.values(projects),
webServer: webServers[template] ?? Object.values(webServers),
});