playwright.config.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { defineConfig, devices } from "@playwright/test";
  2. import dotenv from "dotenv";
  3. import path from "path";
  4. import { fileURLToPath } from "url";
  5. const __filename = fileURLToPath(import.meta.url);
  6. const __dirname = path.dirname(__filename);
  7. export const TESTS_ROOT_PATH = __dirname;
  8. export const STATE_DIR_PATH = `${ TESTS_ROOT_PATH }/.state/`;
  9. export const ADMIN_AUTH_STATE_PATH = `${ STATE_DIR_PATH }/admin-auth.json`;
  10. dotenv.config({ path: path.resolve(__dirname, "../../../../../.env") });
  11. export default defineConfig({
  12. testDir: "./tests",
  13. timeout: 120 * 1000,
  14. expect: { timeout: 20 * 1000 },
  15. outputDir: "./test-results",
  16. fullyParallel: false,
  17. workers: 1,
  18. forbidOnly: !!process.env.CI,
  19. retries: 0,
  20. reportSlowTests: null,
  21. reporter: [
  22. ["list"],
  23. [
  24. "html",
  25. {
  26. outputFolder: "./playwright-report",
  27. },
  28. ],
  29. ],
  30. use: {
  31. baseURL: `${process.env.APP_URL}/`.replace(/\/+$/, "/"),
  32. screenshot: { mode: "only-on-failure", fullPage: true },
  33. video: "retain-on-failure",
  34. trace: "retain-on-failure",
  35. },
  36. projects: [
  37. {
  38. name: "chromium",
  39. use: { ...devices["Desktop Chrome"] },
  40. },
  41. ],
  42. });