playwright.config.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import type { PlaywrightTestConfig } from '@playwright/test';
  2. // eslint-disable-next-line import/no-extraneous-dependencies
  3. import { devices } from '@playwright/test';
  4. /**
  5. * See https://playwright.dev/docs/test-configuration.
  6. */
  7. const config: PlaywrightTestConfig = {
  8. testDir: './tests/integration',
  9. /* Maximum time one test can run for. */
  10. timeout: 30 * 1000,
  11. expect: {
  12. /**
  13. * Maximum time expect() should wait for the condition to be met.
  14. * For example in `await expect(locator).toHaveText();`
  15. */
  16. timeout: 5000,
  17. },
  18. /* Fail the build on CI if you accidentally left test.only in the source code. */
  19. forbidOnly: !!process.env.CI,
  20. /* Retry on CI only */
  21. retries: process.env.CI ? 2 : 0,
  22. /* Opt out of parallel tests on CI. */
  23. workers: process.env.CI ? 1 : undefined,
  24. /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  25. reporter: 'html',
  26. /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  27. use: {
  28. /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
  29. actionTimeout: 0,
  30. /* Base URL to use in actions like `await page.goto('/')`. */
  31. baseURL: process.env.PLAYWRIGHT_TEST_BASE_URL || 'http://localhost:3000',
  32. /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
  33. trace: 'on-first-retry',
  34. },
  35. /* Configure projects for major browsers */
  36. projects: [
  37. {
  38. name: 'chromium',
  39. use: {
  40. ...devices['Desktop Chrome'],
  41. },
  42. },
  43. {
  44. name: 'firefox',
  45. use: {
  46. ...devices['Desktop Firefox'],
  47. },
  48. },
  49. {
  50. name: 'webkit',
  51. use: {
  52. ...devices['Desktop Safari'],
  53. },
  54. },
  55. /* Test against mobile viewports. */
  56. {
  57. name: 'Mobile Chrome',
  58. use: {
  59. ...devices['Pixel 5'],
  60. },
  61. },
  62. {
  63. name: 'Mobile Safari',
  64. use: {
  65. ...devices['iPhone 12'],
  66. },
  67. },
  68. ],
  69. };
  70. export default config;