-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
50 lines (46 loc) · 1.73 KB
/
playwright.config.ts
File metadata and controls
50 lines (46 loc) · 1.73 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
import { defineConfig, devices } from "@playwright/test";
import { config } from "dotenv";
// Load environment variables from .env.local for E2E tests
config({ path: ".env.local" });
// Set environment variable to indicate Playwright test execution
process.env.IS_PLAYWRIGHT = "true";
export default defineConfig({
testDir: "./e2e",
fullyParallel: false, // Changed to false to prevent auto-reload race conditions
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: 1, // Force sequential execution to prevent concurrent auto-reload
reporter: "list",
// Global setup/teardown: runs ONCE for entire test suite (starts/stops Stripe webhook)
// require.resolve() converts relative path to absolute path for Playwright to load dynamically
globalSetup: require.resolve("./e2e/setup/stripe.setup.ts"),
globalTeardown: require.resolve("./e2e/setup/stripe.teardown.ts"),
use: {
baseURL: process.env.PORT ? `http://localhost:${process.env.PORT}` : "http://localhost:4000",
trace: "on-first-retry",
screenshot: "only-on-failure",
headless: !!process.env.CI,
},
projects: [
// Project setup: runs auth.setup.ts to create auth state files before tests
{
name: "setup",
testMatch: ["e2e/setup/auth.setup.ts"],
},
// Browser tests depend on setup
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
headless: true,
},
dependencies: ["setup"],
},
],
webServer: {
command: process.env.CI ? "IS_PLAYWRIGHT=true npm run dev:ci" : "IS_PLAYWRIGHT=true npm run dev",
url: process.env.PORT ? `http://localhost:${process.env.PORT}` : "http://localhost:4000",
reuseExistingServer: !process.env.CI,
timeout: 120000,
},
});