import { defineConfig } from "@playwright/test";
import dotenv from "dotenv";

dotenv.config({
  path: "./.env.development.imex",
  prefix: "TEST_"
});

export default defineConfig({
  testDir: "./tests/e2e",
  testMatch: "*.e2e.js",
  timeout: 60 * 1000,
  reporter: [["list"], ["html"]],
  use: {
    baseURL: "https://localhost:3000",
    browser: "chromium",
    ignoreHTTPSErrors: true
  },
  webServer: {
    command: "npm run start:imex",
    ignoreHTTPSErrors: true,
    url: "https://localhost:3000/health", // Health check endpoint will tell us when the server is ready
    // eslint-disable-next-line no-undef
    reuseExistingServer: !process.env.CI // Reuse server locally, not in CI
  }
});
