playwright.config.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import type { PlaywrightTestConfig } from "@playwright/test";
  2. import { devices } from "@playwright/test";
  3. /**
  4. * Read environment variables from file.
  5. * https://github.com/motdotla/dotenv
  6. */
  7. // require('dotenv').config();
  8. /**
  9. * See https://playwright.dev/docs/test-configuration.
  10. */
  11. const config: PlaywrightTestConfig = {
  12. testDir: "./tests",
  13. /* Maximum time one test can run for. */
  14. timeout: 10 * 60 * 1000, // 10 minutes
  15. expect: {
  16. /**
  17. * Maximum time expect() should wait for the condition to be met.
  18. * For example in `await expect(locator).toHaveText();`
  19. */
  20. timeout: 5000,
  21. },
  22. /* Fail the build on CI if you accidentally left test.only in the source code. */
  23. forbidOnly: !!process.env.CI,
  24. /* Retry on CI only */
  25. retries: process.env.CI ? 2 : 0,
  26. /* Opt out of parallel tests on CI. */
  27. workers: process.env.CI ? 1 : undefined,
  28. /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  29. reporter: "html",
  30. /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  31. use: {
  32. headless: true,
  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. /* Configure projects for major browsers */
  41. projects: [
  42. {
  43. name: "chromium",
  44. use: {
  45. ...devices["Desktop Chrome"],
  46. },
  47. },
  48. {
  49. name: "firefox",
  50. use: {
  51. ...devices["Desktop Firefox"],
  52. },
  53. },
  54. {
  55. name: "safari",
  56. use: {
  57. ...devices["Desktop Safari"],
  58. },
  59. },
  60. ],
  61. /* Folder for test artifacts such as screenshots, videos, traces, etc. */
  62. // outputDir: 'test-results/',
  63. /* Run your local dev server before starting the tests */
  64. webServer: {
  65. command: "cd tests/server && npx webpack && npx http-server -p 8085 dist",
  66. port: 8085,
  67. timeout: 10 * 60 * 1000, // 10 minutes
  68. },
  69. };
  70. export default config;