playwright.config.js 863 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // @ts-check
  2. import { defineConfig, devices } from '@playwright/test';
  3. import config from './env.config';
  4. /**
  5. * @see https://playwright.nodejs.cn/docs/test-configuration // 中文
  6. */
  7. export default defineConfig({
  8. testDir: './files', // 测试文件目录
  9. testMatch: config.testMatch, // 测试文件匹配模式
  10. fullyParallel: true,
  11. forbidOnly: !!process.env.CI,
  12. retries: process.env.CI ? 2 : 0, // 重试次数
  13. workers: process.env.CI ? 1 : undefined,
  14. reporter: 'html',
  15. use: {
  16. baseURL: process.env.BASE_URL,
  17. trace: 'on-first-retry',
  18. },
  19. projects: [
  20. {
  21. name: 'chromium',
  22. use: { ...devices['Desktop Chrome'] },
  23. },
  24. // {
  25. // name: 'firefox',
  26. // use: { ...devices['Desktop Firefox'] },
  27. // },
  28. // {
  29. // name: 'webkit',
  30. // use: { ...devices['Desktop Safari'] },
  31. // },
  32. ],
  33. });