-
Notifications
You must be signed in to change notification settings - Fork 0
/
playwright.config.ts
41 lines (37 loc) · 1.16 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
import process from "node:process";
import { defineConfig, devices } from "@playwright/test";
import { config } from "dotenv";
import { z } from "zod";
const dotenv = config();
const envSchema = z.object({
// biome-ignore lint/style/useNamingConvention: env variables have different convention
NODE_ENV: z.enum(["development", "production"]).default("development"),
// biome-ignore lint/style/useNamingConvention: env variables have different convention
CI: z.coerce.boolean().default(false),
});
const env = envSchema.parse(dotenv.error ? process.env : dotenv.parsed);
export default defineConfig({
testDir: "./e2e",
fullyParallel: true,
forbidOnly: env.CI,
retries: env.CI ? 2 : 0,
workers: env.CI ? 1 : undefined,
reporter: "html",
use: {
// biome-ignore lint/style/useNamingConvention: 3-rd party type
baseURL:
env.NODE_ENV === "production"
? "https://subs-savvy.pages.dev"
: "http://localhost:5173",
trace: "retain-on-failure",
...devices["Desktop Chrome"],
},
webServer:
env.NODE_ENV === "production"
? undefined
: {
command: "npm run start:dev",
url: "http://localhost:5173",
reuseExistingServer: !env.CI,
},
});