新增 E2E 测试配置与用例并更新测试补充文档

This commit is contained in:
2026-03-03 13:56:07 +08:00
parent 482307f2f4
commit fe3016d710
10 changed files with 149 additions and 2 deletions
+31
View File
@@ -0,0 +1,31 @@
import { defineConfig } from "@playwright/test";
const port = process.env.PLAYWRIGHT_PORT ?? "3721";
const baseURL = process.env.PLAYWRIGHT_BASE_URL ?? `http://127.0.0.1:${port}`;
export default defineConfig({
testDir: "./e2e",
timeout: 30_000,
expect: {
timeout: 5_000,
},
fullyParallel: true,
retries: process.env.CI ? 2 : 0,
reporter: process.env.CI
? [["github"], ["html", { open: "never" }]]
: [["list"], ["html", { open: "never" }]],
use: {
baseURL,
trace: "on-first-retry",
screenshot: "only-on-failure",
video: "retain-on-failure",
viewport: { width: 390, height: 844 },
locale: "zh-CN",
},
webServer: {
command: "npm run dev",
url: baseURL,
reuseExistingServer: !process.env.CI,
timeout: 120_000,
},
});