/**
 * Playwright configuration for running E2E tests against the LIVE dev server.
 *
 * Unlike the default playwright.config.ts (which spins up a dedicated test
 * server with isolated test data), this config targets the already-running
 * dev server at localhost:3100 and exercises real dev-DB data.
 *
 * Usage:
 *   pnpm --filter @capakraken/web exec playwright test --config playwright.dev.config.ts
 *
 * Prerequisites:
 *   - Dev server running: pnpm run dev  (or docker compose up)
 *   - Dev DB seeded with planarchy.dev seed users
 */
import { defineConfig, devices } from "@playwright/test";
import * as path from "path";

export const STORAGE_STATE = {
  admin: path.join(__dirname, "e2e/dev-system/.auth/admin.json"),
  manager: path.join(__dirname, "e2e/dev-system/.auth/manager.json"),
  viewer: path.join(__dirname, "e2e/dev-system/.auth/viewer.json"),
};

export default defineConfig({
  testDir: "./e2e/dev-system",
  globalSetup: "./e2e/dev-system/global-setup.ts",
  fullyParallel: false,
  forbidOnly: !!process.env["CI"],
  retries: 0,
  workers: 1,
  reporter: "list",
  use: {
    baseURL: "http://localhost:3100",
    trace: "on-first-retry",
    screenshot: "only-on-failure",
  },
  projects: [
    {
      name: "chromium",
      use: { ...devices["Desktop Chrome"] },
    },
  ],
  // No webServer block — the dev server must already be running
});
