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