playwright.config.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { defineConfig, devices } from "@playwright/test"
  2. /**
  3. * Read environment variables from file.
  4. * https://github.com/motdotla/dotenv
  5. */
  6. // import dotenv from 'dotenv';
  7. // dotenv.config({ path: path.resolve(__dirname, '.env') });
  8. /**
  9. * See https://playwright.dev/docs/test-configuration.
  10. */
  11. export default defineConfig({
  12. testDir: "./tests/e2e",
  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: "html",
  23. /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  24. use: {
  25. /* Base URL to use in actions like `await page.goto('/')`. */
  26. baseURL: "http://localhost:8080",
  27. /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
  28. trace: "on-first-retry",
  29. },
  30. /* Configure projects for major browsers */
  31. projects: [
  32. {
  33. name: "chromium",
  34. use: { ...devices["Desktop Chrome"] },
  35. },
  36. {
  37. name: "firefox",
  38. use: { ...devices["Desktop Firefox"] },
  39. },
  40. {
  41. name: "webkit",
  42. use: { ...devices["Desktop Safari"] },
  43. },
  44. /* Test against mobile viewports. */
  45. // {
  46. // name: 'Mobile Chrome',
  47. // use: { ...devices['Pixel 5'] },
  48. // },
  49. // {
  50. // name: 'Mobile Safari',
  51. // use: { ...devices['iPhone 12'] },
  52. // },
  53. /* Test against branded browsers. */
  54. // {
  55. // name: 'Microsoft Edge',
  56. // use: { ...devices['Desktop Edge'], channel: 'msedge' },
  57. // },
  58. // {
  59. // name: 'Google Chrome',
  60. // use: { ...devices['Desktop Chrome'], channel: 'chrome' },
  61. // },
  62. ],
  63. /* Run your local dev server before starting the tests */
  64. webServer: {
  65. command: "npm run dev",
  66. url: "http://localhost:8080",
  67. reuseExistingServer: !process.env.CI,
  68. },
  69. })