/**
 * Workflow-verification Playwright config.
 * SESSION: bb91f9ca-7521-4897-a5d4-33a7a8deaaec
 *
 * Used by v-workflow-verifier to run the targeted golden-path spec against the
 * session-unique server (port 8812) without running the full globalSetup
 * (which would reset the shared SQLite DB and has CSRF issues with APP_URL mismatch).
 *
 * NOT intended for the normal dev/CI Playwright run — use playwright.config.ts.
 *
 * Previous session (87a06cd1): port 8003, roi-per-click-form-87a06cd1.spec.ts
 * This session (bb91f9ca):    port 8812, wedge-gating-ui-bb91f9ca.spec.ts
 */
import { defineConfig, devices } from '@playwright/test';

const WF_PORT = process.env.WF_PORT ?? '8812';
const baseURL = `http://localhost:${WF_PORT}`;

export default defineConfig({
  testDir: './tests/e2e',
  testMatch: '**/workflows/wedge-gating-ui-bb91f9ca.spec.ts',
  outputDir: './tests/e2e/results',
  // No globalSetup — self-contained spec handles auth via stored auth-state.json.
  // Avoids the known 419 CSRF issue when APP_URL=https://rankwiz.test vs 127.0.0.1.
  fullyParallel: false,
  retries: 0,
  workers: 1,
  reporter: 'list',
  expect: { timeout: 20_000 },
  use: {
    baseURL,
    trace: 'off',
  },
  projects: [
    {
      name: 'chromium-desktop',
      use: { ...devices['Desktop Chrome'], deviceScaleFactor: 1 },
    },
  ],
  webServer: {
    // Server is already running on WF_PORT — just verify it's up, don't start a new one.
    command: `echo "reusing server at ${baseURL}"`,
    url: baseURL,
    reuseExistingServer: true,
    timeout: 5_000,
  },
});
