-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
77 lines (70 loc) · 2.45 KB
/
playwright.config.ts
File metadata and controls
77 lines (70 loc) · 2.45 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { defineConfig, devices } from "@playwright/test";
import path from "path";
const ROOT = process.cwd();
export const STORAGE_STATE_LESSONS_ADMIN = path.join(ROOT, "tests", ".auth-lessons-admin.json");
export const STORAGE_STATE_GRACE = path.join(ROOT, "tests", ".auth-grace.json");
const baseURL = process.env.BASE_URL || "http://localhost:3501";
export default defineConfig({
testDir: "./tests",
testMatch: /.*\.spec\.ts/,
fullyParallel: false,
forbidOnly: !!process.env.CI,
// One retry covers the occasional Next.js dev-server compilation hiccup
// when many parallel workers warm up routes simultaneously.
retries: 1,
// 18+ concurrent Next.js dev compilations overwhelm the dev server. Match
// CI's worker count locally — at 4 workers the dev server intermittently
// returns "Loading..." stall on /login auto-login and "element detached from
// DOM" mid-fill races on portal/admin form tests.
workers: 2,
reporter: "list",
timeout: 90 * 1000,
expect: { timeout: 10 * 1000 },
globalSetup: "./tests/global-setup.ts",
use: {
baseURL,
storageState: STORAGE_STATE_LESSONS_ADMIN,
trace: "on-first-retry",
screenshot: "only-on-failure",
video: "retain-on-failure",
actionTimeout: 15 * 1000,
navigationTimeout: 30 * 1000,
},
// Bring up the full stack: main Api (auth), LessonsApi (data), LessonsApp (UI).
// All marked reuseExistingServer so a developer running the API/UI manually doesn't conflict.
webServer: [
{
command: "npm --prefix ../Api run dev",
url: "http://localhost:8084/health",
reuseExistingServer: true,
timeout: 90 * 1000,
stdout: "pipe",
stderr: "pipe",
},
{
command: "npm --prefix ../LessonsApi run dev",
url: "http://localhost:8090/health",
reuseExistingServer: true,
timeout: 90 * 1000,
stdout: "pipe",
stderr: "pipe",
},
{
command: "npm run dev",
// Hit /login because the app's `/` currently returns 500 from a pre-existing
// SSR bug; /login is a stable health probe for the dev server itself.
url: "http://localhost:3501/login",
reuseExistingServer: true,
timeout: 180 * 1000,
},
],
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"], headless: true },
// fullyParallel: false keeps tests within a file serial; multiple files
// run in parallel via the workers setting above.
fullyParallel: false,
},
],
});