playwright.config.ts 939 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { defineConfig, devices } from '@playwright/test';
  2. /**
  3. * Playwright 配置文件
  4. * 使用指定的 Chrome 浏览器路径
  5. */
  6. export default defineConfig({
  7. testDir: './tests',
  8. fullyParallel: true,
  9. forbidOnly: !!process.env.CI,
  10. retries: process.env.CI ? 2 : 0,
  11. workers: process.env.CI ? 1 : undefined,
  12. reporter: 'html',
  13. use: {
  14. baseURL: 'http://localhost:5173',
  15. trace: 'on-first-retry',
  16. screenshot: 'only-on-failure',
  17. video: 'retain-on-failure',
  18. },
  19. projects: [
  20. {
  21. name: 'chromium',
  22. use: {
  23. ...devices['Desktop Chrome'],
  24. // 使用指定的 Chrome 浏览器路径
  25. channel: 'chrome',
  26. launchOptions: {
  27. executablePath: 'D:\\Software\\chrome-win64\\chrome.exe',
  28. },
  29. },
  30. },
  31. ],
  32. webServer: {
  33. command: 'npm run dev',
  34. url: 'http://localhost:5173',
  35. reuseExistingServer: !process.env.CI,
  36. timeout: 120000,
  37. },
  38. });