-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
51 lines (50 loc) · 1.11 KB
/
Copy pathplaywright.config.ts
File metadata and controls
51 lines (50 loc) · 1.11 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
import { defineConfig, devices } from "@playwright/test";
/**
* Playwright E2E 测试配置
*
* 测试策略:
* - webServer: 自动启动 vite dev (port 3333)
* - baseURL: http://localhost:3333
* - chromium 优先 (CI), 本地可加 firefox/webkit
*
* 运行: npx playwright test
* UI 模式: npx playwright test --ui
* 报告: npx playwright show-report
*/
export default defineConfig({
testDir: "./e2e",
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: 1,
reporter: process.env.CI ? "github" : "html",
timeout: 30_000,
expect: {
timeout: 10_000,
toHaveScreenshot: {
maxDiffPixelRatio: 0.01,
threshold: 0.2,
animations: "disabled",
caret: "hide",
},
},
use: {
baseURL: "http://localhost:3335",
trace: "on-first-retry",
screenshot: "only-on-failure",
locale: "zh-CN",
viewport: { width: 1440, height: 900 },
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
webServer: {
command: "pnpm dev",
url: "http://localhost:3335",
reuseExistingServer: !process.env.CI,
timeout: 60_000,
},
});