Skip to article
Documentation

playwright.config.ts

Linked repository file from this build.

import { defineConfig } from "@playwright/test";
import { testSecret } from "./e2e/test-secret";

const port = Number(process.env.QC_E2E_PORT ?? 3001);

export default defineConfig({
  testDir: "./e2e",
  outputDir: "test-results/e2e",
  testIgnore: /(?:perf-(budgets|instrumentation)|font-preloads)\.spec\.ts/,
  workers: 1,
  projects: [
    { name: "chromium", use: { browserName: "chromium" } },
    { name: "firefox-hydration", testMatch: "hydration.spec.ts", use: { browserName: "firefox" } },
  ],
  use: {
    baseURL: `http://localhost:${port}`,
    trace: "retain-on-failure",
    storageState: {
      cookies: [
        {
          name: "qc-test-secret",
          value: testSecret,
          domain: "localhost",
          path: "/",
          expires: -1,
          httpOnly: false,
          secure: false,
          sameSite: "Lax",
        },
      ],
      origins: [],
    },
  },
  webServer: {
    command: `QC_E2E_SECRET=${testSecret} bun run build && DOCUMENT_STORAGE=local QC_E2E_SECRET=${testSecret} bun run start --port ${port}`,
    url: `http://localhost:${port}`,
    reuseExistingServer: false,
  },
});