-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
59 lines (57 loc) · 1.76 KB
/
playwright.config.ts
File metadata and controls
59 lines (57 loc) · 1.76 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
import { defineConfig, devices } from "@playwright/test";
const isCI = !!process.env.CI;
// Keep default suite fast/stable; run multi-browser matrix on demand.
const runFullMatrix = process.env.PW_FULL_MATRIX === "1";
const port = process.env.PW_PORT ?? "3011";
// BASE_URL lets you run smoke tests against a live deployment without a local server.
// Example: BASE_URL=https://paulprae-com-git-feat-interview-booking-cta-praeducers-projects.vercel.app npx playwright test
// Example: BASE_URL=https://paulprae.com npx playwright test
const baseURL = process.env.BASE_URL ?? `http://localhost:${port}`;
export default defineConfig({
testDir: "./e2e",
fullyParallel: true,
forbidOnly: isCI,
retries: isCI ? 2 : 0,
workers: isCI ? 1 : undefined,
reporter: "html",
use: {
baseURL,
trace: "on-first-retry",
},
projects: runFullMatrix
? [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},
{
name: "webkit",
use: { ...devices["Desktop Safari"] },
},
{
name: "mobile-chrome",
use: { ...devices["Pixel 5"] },
},
]
: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
// Skip local webServer when BASE_URL points to a live deployment.
webServer: process.env.BASE_URL
? undefined
: {
// Use production server for E2E stability.
// Turbopack dev-mode startup has shown intermittent panics in CI/local.
command: `npm run build && npm run start -- --port ${port}`,
url: baseURL,
reuseExistingServer: !isCI,
timeout: 240_000,
},
});