import { defineConfig, devices } from '@playwright/test'; /** * Playwright 配置文件 * 使用指定的 Chrome 浏览器路径 */ export default defineConfig({ testDir: './tests', fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 1 : undefined, reporter: 'html', use: { baseURL: 'http://localhost:5173', trace: 'on-first-retry', screenshot: 'only-on-failure', video: 'retain-on-failure', }, projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'], // 使用指定的 Chrome 浏览器路径 channel: 'chrome', launchOptions: { executablePath: 'D:\\Software\\chrome-win64\\chrome.exe', }, }, }, ], webServer: { command: 'npm run dev', url: 'http://localhost:5173', reuseExistingServer: !process.env.CI, timeout: 120000, }, });