playwright.config.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import type { PlaywrightTestConfig } 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. const config: PlaywrightTestConfig = {
  11. testDir: "./e2e",
  12. /* Maximum time one test can run for. */
  13. timeout: 30 * 1000,
  14. expect: {
  15. /**
  16. * Maximum time expect() should wait for the condition to be met.
  17. * For example in `await expect(locator).toHaveText();`
  18. */
  19. timeout: 5000,
  20. },
  21. /* Run tests in files in parallel */
  22. fullyParallel: true,
  23. /* Fail the build on CI if you accidentally left test.only in the source code. */
  24. forbidOnly: !!process.env.CI,
  25. /* Retry on CI only */
  26. retries: process.env.CI ? 2 : 0,
  27. /* Opt out of parallel tests on CI. */
  28. workers: process.env.CI ? 1 : undefined,
  29. /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  30. reporter: "html",
  31. /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  32. use: {
  33. /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
  34. actionTimeout: 0,
  35. /* Base URL to use in actions like `await page.goto('/')`. */
  36. // baseURL: 'http://localhost:3000',
  37. /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
  38. trace: "on-first-retry",
  39. },
  40. /* Folder for test artifacts such as screenshots, videos, traces, etc. */
  41. // outputDir: 'test-results/',
  42. /* Run your local dev server before starting the tests */
  43. // webServer: {
  44. // command: 'npm run start',
  45. // port: 3000,
  46. // },
  47. };
  48. export default config;