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

const externalBaseUrl = process.env.BASE_URL;

export default defineConfig({
  testDir: "./tests",
  timeout: 30_000,
  fullyParallel: false,
  reporter: "line",
  use: {
    baseURL: externalBaseUrl ?? "http://127.0.0.1:3100",
    browserName: "chromium",
    headless: true,
    launchOptions: {
      executablePath: "/usr/bin/chromium"
    }
  },
  webServer: externalBaseUrl
    ? undefined
    : {
        command: "npm run start -- --hostname 127.0.0.1 --port 3100",
        port: 3100,
        reuseExistingServer: true,
        timeout: 30_000
      }
});
