From 441f1c37cbaa673217468ea79af41edcd70fe8d4 Mon Sep 17 00:00:00 2001 From: Dustin Brett Date: Sun, 1 Dec 2024 19:18:03 -0800 Subject: [PATCH] Allow easy testing of prod --- playwright.config.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/playwright.config.ts b/playwright.config.ts index d8440385..bfdfd59e 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,12 +1,13 @@ import { type PlaywrightTestConfig, devices } from "@playwright/test"; +const overrideUrl = ""; const { CI, PORT = 3000 } = process.env; const { "Desktop Chrome": chrome, "Desktop Firefox": firefox, "Desktop Safari": safari, } = devices; -const baseURL = `http://localhost:${PORT}`; +const baseURL = overrideUrl || `http://localhost:${PORT}`; const config: PlaywrightTestConfig = { fullyParallel: true, projects: [ @@ -23,8 +24,9 @@ const config: PlaywrightTestConfig = { video: "retain-on-failure", }, webServer: { - command: CI ? "yarn serve" : "yarn dev", - url: baseURL, + command: overrideUrl ? "" : CI ? "yarn serve" : "yarn dev", + reuseExistingServer: Boolean(overrideUrl), + url: overrideUrl || baseURL, }, workers: CI ? 1 : undefined, };