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, }, })