Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
68 lines (62 loc) · 1.73 KB
/
Copy pathplaywright.config.ts
File metadata and controls
68 lines (62 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { defineConfig, devices } from "@playwright/test";
import fs from "fs";
import path from "path";
// Load environment variables from .env.local
const envPath = path.resolve(__dirname, ".env.local");
if (fs.existsSync(envPath)) {
const envContent = fs.readFileSync(envPath, "utf-8");
for (const line of envContent.split("\n")) {
const [key, ...valueParts] = line.split("=");
if (key && !key.startsWith("#")) {
process.env[key.trim()] = valueParts.join("=").trim();
}
}
}
const port = process.env.TEST_PORT || "3100";
const baseURL = `http://localhost:${port}`;
const authFile = path.resolve(__dirname, "playwright/.auth/user.json");
export default defineConfig({
testDir: "./e2e",
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? Number(process.env.PW_WORKERS || "1") : undefined,
reporter: "html",
use: {
baseURL,
trace: "on-first-retry",
screenshot: "only-on-failure",
video: {
mode: "on",
size: { width: 1920, height: 1080 },
},
},
projects: [
// Setup project for authentication
{
name: "setup",
testMatch: /.*\.setup\.ts/,
timeout: 120000,
},
// Main test project that depends on setup
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
storageState: authFile,
viewport: { width: 1920, height: 1080 },
},
dependencies: ["setup"],
},
],
// Build and start the production server before running tests
webServer: {
command: `npm run build && npm start -- --port ${port}`,
url: baseURL,
reuseExistingServer: !process.env.CI,
timeout: 180000,
env: {
NEXT_PUBLIC_PRIVY_TEST_MODE: "true",
},
},
});