playwright.config.ts 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. // import path from 'path';
  8. // dotenv.config({ path: path.resolve(__dirname, '.env') });
  9. /**
  10. * See https://playwright.dev/docs/test-configuration.
  11. */
  12. export default defineConfig({
  13. testDir: "./excalidraw-app/tests/regression",
  14. snapshotPathTemplate:
  15. "{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{ext}",
  16. /* Run tests in files in parallel */
  17. fullyParallel: true,
  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 : 1,
  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. actionTimeout: 0,
  29. /* Base URL to use in actions like `await page.goto('/')`. */
  30. baseURL: "http://localhost:3000",
  31. /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
  32. trace: "on-first-retry",
  33. headless: true,
  34. },
  35. timeout: 1200000,
  36. /* Configure projects for major browsers */
  37. projects: [
  38. {
  39. name: "chromium",
  40. use: {
  41. ...devices["Desktop Chrome"],
  42. launchOptions: {
  43. args: ["--disable-font-subpixel-positioning", "--disable-gpu"],
  44. },
  45. },
  46. },
  47. // {
  48. // name: "firefox",
  49. // use: { ...devices["Desktop Firefox"] },
  50. // },
  51. // {
  52. // name: "webkit",
  53. // use: { ...devices["Desktop Safari"] },
  54. // },
  55. /* Test against mobile viewports. */
  56. // {
  57. // name: 'Mobile Chrome',
  58. // use: { ...devices['Pixel 5'] },
  59. // },
  60. // {
  61. // name: 'Mobile Safari',
  62. // use: { ...devices['iPhone 12'] },
  63. // },
  64. /* Test against branded browsers. */
  65. // {
  66. // name: 'Microsoft Edge',
  67. // use: { ...devices['Desktop Edge'], channel: 'msedge' },
  68. // },
  69. // {
  70. // name: 'Google Chrome',
  71. // use: { ...devices['Desktop Chrome'], channel: 'chrome' },
  72. // },
  73. ],
  74. /* Run your local dev server before starting the tests */
  75. webServer: {
  76. command: "yarn start --no-open",
  77. url: "http://localhost:3000",
  78. reuseExistingServer: !process.env.CI,
  79. },
  80. });