diff --git a/playwright.config.ts b/playwright.config.ts index d5a90e6a..c4148faa 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,16 +1,31 @@ import { defineConfig } from "@playwright/test"; +const baseURL = process.env.BASE_URL ?? "http://localhost:8080"; +const startLocalServer = !process.env.BASE_URL; + export default defineConfig({ testDir: "tests/e2e", timeout: 30000, use: { - baseURL: "http://localhost:8080", + baseURL, headless: true, + httpCredentials: + process.env.BASIC_AUTH_USER && process.env.BASIC_AUTH_PASS + ? { + username: process.env.BASIC_AUTH_USER, + password: process.env.BASIC_AUTH_PASS, + } + : undefined, }, - webServer: { - command: "pnpm dev", - url: "http://localhost:8080", - reuseExistingServer: true, - timeout: 30000, - }, + reporter: [["html", { open: "never" }], ["list"]], + ...(startLocalServer + ? { + webServer: { + command: "pnpm dev", + url: "http://localhost:8080", + reuseExistingServer: true, + timeout: 30000, + }, + } + : {}), });