Ctrl K
ComunidadGuías…

playwright.config.ts

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
import { defineConfig, devices } from "@playwright/test";
import { getSlackSigningFixture } from "./tests/support/slack-signing-fixture";

const rootDir = process.cwd();
const port = Number(process.env.PLAYWRIGHT_PORT || 3000);
const baseURL = `http://localhost:${port}`;
const slackSigningFixture = getSlackSigningFixture();
process.env.SLACK_SIGNING_SECRET = slackSigningFixture;
const testServerEnv =
  `PLAYWRIGHT=1 PLAYWRIGHT_AUTH_BYPASS_SECRET=playwright-auth-bypass ` +
  `MOGPLEX_DEPLOYMENT_ID=playwright-${port} ` +
  // Exercise the deployed Neon stack without legacy credentials masking
  // accidental Supabase initialization. Empty values override .env.local.
  `MOGPLEX_DATA_BACKEND=neon NEXT_PUBLIC_MOGPLEX_DATA_BACKEND=neon ` +
  `NEXT_PUBLIC_SUPABASE_URL= NEXT_PUBLIC_SUPABASE_ANON_KEY= ` +
  `SUPABASE_URL= SUPABASE_SERVICE_ROLE_KEY= SUPABASE_SECRET_KEY= ` +
  `BETTER_AUTH_SECRET=playwright-better-auth-secret-at-least-32-chars ` +
  `BETTER_AUTH_URL=${baseURL} NEXT_PUBLIC_APP_URL=${baseURL} ` +
  `SLACK_SIGNING_SECRET=${slackSigningFixture} ` +
  // Self-hosting setup runs only while no GitHub App is configured. Clear the
  // App so .env.local cannot hide the setup page, as CI already runs.
  `MOGPLEX_SETUP_ENABLED=1 GITHUB_APP_ID= GITHUB_APP_PRIVATE_KEY= GITHUB_APP_NAME= ` +
  // Production builds load .env.local, including real Sentry DSNs. Explicitly
  // clear both ingestion paths so fixture-only localhost failures cannot be
  // reported as production incidents.
  `SENTRY_DSN= NEXT_PUBLIC_SENTRY_DSN=`;

export default defineConfig({
  testDir: "./tests/e2e",
  timeout: 45_000,
  expect: {
    timeout: 10_000,
  },
  fullyParallel: false,
  // flows-api tests share in-memory state; force serial execution
  workers: 1,
  retries: process.env.CI ? 2 : 0,
  use: {
    baseURL,
    trace: "on-first-retry",
    screenshot: "only-on-failure",
    video: "retain-on-failure",
  },
  webServer: {
    // BETTER_AUTH_URL pins better-auth's baseURL to the server under test:
    // without it a real NEXT_PUBLIC_APP_URL in .env.local makes better-auth
    // mint Secure cookies for the public https origin, which the browser
    // drops on http://localhost and every session-dependent flow fails.
    command: `${testServerEnv} pnpm --dir ${rootDir} build && ${testServerEnv} pnpm --dir ${rootDir} exec next start --port ${port}`,
    cwd: rootDir,
    url: `${baseURL}/login`,
    reuseExistingServer: false,
    timeout: 240_000,
  },
  projects: [
    {
      name: "chromium",
      use: {
        ...devices["Desktop Chrome"],
      },
    },
  ],
});