playwright.config.ts 1.9 KB

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