-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
60 lines (58 loc) · 2.29 KB
/
Copy pathplaywright.config.ts
File metadata and controls
60 lines (58 loc) · 2.29 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
import { defineConfig, devices } from "@playwright/test";
import * as dotenv from "dotenv";
import * as path from "path";
// Load environment variables from .env.local
dotenv.config({ path: path.resolve(__dirname, ".env.local") });
export default defineConfig({
testDir: "./tests/e2e",
fullyParallel: true,
forbidOnly: !!process.env.CI,
// These tests drive a live testnet: an RPC hiccup or a slow block is not a
// product defect. One local retry separates a real regression from noise
// without hiding a test that fails deterministically.
retries: process.env.CI ? 2 : 1,
reporter: process.env.CI ? [["github"], ["html"]] : [["list"], ["html"]],
// A blockchain write can take a minute; the 30s default kills healthy tests.
timeout: 90_000,
expect: { timeout: 15_000 },
use: {
baseURL: "http://localhost:3000",
// `on-first-retry` leaves the final failing run untraced when retries are
// exhausted, which is exactly the run worth inspecting.
trace: "retain-on-failure",
screenshot: "only-on-failure",
video: "retain-on-failure",
actionTimeout: 15_000,
navigationTimeout: 30_000,
},
// One worker per core turns the dev server into the bottleneck: every worker
// requests a different uncompiled route at once and they all wait. Four keeps
// the suite parallel without the compile storm.
workers: process.env.CI ? 1 : 4,
projects: [
{
name: "warmup",
testMatch: /warmup\.setup\.ts/,
use: { ...devices["Desktop Chrome"] },
},
{
name: "chromium",
testIgnore: /warmup\.setup\.ts/,
use: { ...devices["Desktop Chrome"] },
dependencies: ["warmup"],
},
],
// `next dev`, not a production build: the dev private-key connector the whole
// suite signs with refuses to run outside development ("This method is only
// available in development mode", lib/wallet.ts), so a production server can
// never authenticate a test. The compile-on-demand cost that comes with dev
// is paid up front by the warmup project instead.
webServer: {
command: "npm run dev",
url: "http://localhost:3000",
reuseExistingServer: !process.env.CI,
// A cold Next dev compile of the first route routinely outruns the 60s
// default and reports as a server that never came up.
timeout: 180_000,
},
});