import { defineConfig, devices } from "@playwright/test"; /** * Playwright E2E 测试配置。 * * 前置条件: * - 后端运行在 http://localhost:8000 * - 前端运行在 http://localhost:3000 * * 启动方式: * # 终端1:启动后端 * cd backend && python -m uvicorn app.main:app --reload --port 8000 * # 终端2:启动前端 * cd frontend && pnpm dev * # 终端3:跑 E2E 测试 * cd frontend && npx playwright test */ export default defineConfig({ testDir: "./e2e", fullyParallel: false, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: 1, reporter: "html", timeout: 30_000, expect: { timeout: 10_000 }, use: { baseURL: "http://localhost:3000", trace: "on-first-retry", screenshot: "only-on-failure", }, projects: [ { name: "chromium", use: { ...devices["Desktop Chrome"] }, }, ], });