Files
digital-psychology/apps/user-h5/playwright.config.ts
T
jackyu66gitandCursor 69fa1b85d6 fix(ECR-001): 对齐 Playwright e2e 与 /psy/ base 及现 UI
E2E 改走 /psy 路径并更新过时文案断言,恢复 L3 冒烟;补充 Phase F QA 报告。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 18:34:11 +08:00

36 lines
1.1 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test'
/**
* L3 smoke: Vite preview + network-mocked API (no Go required).
* Run: npm run test:e2e -w @yuxingu/user-h5
*/
export default defineConfig({
testDir: './e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
use: {
// SPA Vite base is /psy/; absolute paths must include the prefix
// (Playwright treats `/foo` as origin-absolute, ignoring base path).
baseURL: 'http://127.0.0.1:4173',
trace: 'on-first-retry',
},
projects: [
{
name: 'chromium',
use: {
...devices['Pixel 7'],
// Optional: PW_CHANNEL=chrome 改用系统 Chrome
...(process.env.PW_CHANNEL ? { channel: process.env.PW_CHANNEL } : {}),
},
},
],
webServer: {
// Always rebuild so new routes/pages are in dist (reuseExistingServer can hide stale builds).
command: 'npm run build && npm run preview -- --host 127.0.0.1 --port 4173',
url: 'http://127.0.0.1:4173',
reuseExistingServer: false,
timeout: 120_000,
},
})