forked from chakra-ui/zag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
playwright.config.ts
65 lines (58 loc) · 1.58 KB
/
playwright.config.ts
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
import type { PlaywrightTestConfig, ReporterDescription } from "@playwright/test"
export function getWebServer() {
const framework = process.env.FRAMEWORK || "react"
const frameworks = {
react: {
cwd: "./examples/next-ts",
command: "PORT=3000 pnpm dev",
url: "http://localhost:3000",
reuseExistingServer: !process.env.CI,
},
vue: {
cwd: "./examples/vue-ts",
command: "pnpm vite --port 3001",
url: "http://localhost:3001",
reuseExistingServer: !process.env.CI,
},
solid: {
cwd: "./examples/solid-ts",
command: "pnpm vite --port 3002",
url: "http://localhost:3002",
reuseExistingServer: !process.env.CI,
},
}
return frameworks[framework]
}
const webServer = getWebServer()
const config: PlaywrightTestConfig = {
testDir: "./e2e",
outputDir: "./e2e/results",
testMatch: "*.e2e.ts",
fullyParallel: !process.env.CI,
timeout: 30_000,
expect: { timeout: 10_000 },
forbidOnly: !!process.env.CI,
workers: process.env.CI ? 1 : undefined,
reporter: [
process.env.CI ? ["github", ["junit", { outputFile: "e2e/junit.xml" }]] : ["list"],
["html", { outputFolder: "e2e/report", open: "never" }],
].filter(Boolean) as ReporterDescription[],
retries: process.env.CI ? 2 : 0,
webServer,
use: {
baseURL: webServer.url,
trace: "retain-on-failure",
screenshot: "only-on-failure",
video: "retain-on-failure",
locale: "en-US",
timezoneId: "GMT",
},
}
export default config
declare global {
namespace NodeJS {
interface ProcessEnv {
FRAMEWORK: string
}
}
}