playwright.config.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import { defineConfig, devices } from '@playwright/test';
  2. /**
  3. * Read environment variables from file.
  4. * https://github.com/motdotla/dotenv
  5. */
  6. // require('dotenv').config();
  7. /**
  8. * See https://playwright.dev/docs/test-configuration.
  9. */
  10. export default defineConfig({
  11. testDir: './playwright',
  12. outputDir: './playwright/output',
  13. /* Run tests in files in parallel */
  14. fullyParallel: true,
  15. /* Fail the build on CI if you accidentally left test.only in the source code. */
  16. forbidOnly: !!process.env.CI,
  17. /* Retry on CI only */
  18. retries: process.env.CI ? 2 : 0,
  19. /* Opt out of parallel tests on CI. */
  20. workers: process.env.CI ? 1 : undefined,
  21. /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  22. reporter: process.env.CI ? 'github' : 'list',
  23. webServer: {
  24. command: 'yarn server',
  25. url: 'http://localhost:3000',
  26. reuseExistingServer: !process.env.CI,
  27. stdout: 'ignore',
  28. stderr: 'pipe',
  29. },
  30. /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  31. use: {
  32. /* Base URL to use in actions like `await page.goto('/')`. */
  33. baseURL: 'http://localhost:3000',
  34. /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
  35. trace: 'on-first-retry',
  36. },
  37. /* Configure projects for major browsers */
  38. projects: [
  39. {
  40. name: 'chromium',
  41. use: { ...devices['Desktop Chrome'] },
  42. },
  43. {
  44. name: 'firefox',
  45. use: { ...devices['Desktop Firefox'] },
  46. },
  47. {
  48. name: 'webkit',
  49. use: { ...devices['Desktop Safari'] },
  50. },
  51. /* Test against mobile viewports. */
  52. // {
  53. // name: 'Mobile Chrome',
  54. // use: { ...devices['Pixel 5'] },
  55. // },
  56. // {
  57. // name: 'Mobile Safari',
  58. // use: { ...devices['iPhone 12'] },
  59. // },
  60. /* Test against branded browsers. */
  61. // {
  62. // name: 'Microsoft Edge',
  63. // use: { ...devices['Desktop Edge'], channel: 'msedge' },
  64. // },
  65. // {
  66. // name: 'Google Chrome',
  67. // use: { ...devices['Desktop Chrome'], channel: 'chrome' },
  68. // },
  69. ],
  70. /* Run your local dev server before starting the tests */
  71. // webServer: {
  72. // command: 'npm run start',
  73. // url: 'http://127.0.0.1:3000',
  74. // reuseExistingServer: !process.env.CI,
  75. // },
  76. });