From 49778af905a821c39644c13c2250cebee602acd3 Mon Sep 17 00:00:00 2001 From: kyy Date: Thu, 7 May 2026 10:56:25 +0900 Subject: [PATCH] =?UTF-8?q?orgfront=20playwrite=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- orgfront/playwright.config.ts | 24 ++++++++++++++-------- orgfront/tests/orgfront-auto-login.spec.ts | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/orgfront/playwright.config.ts b/orgfront/playwright.config.ts index 5b8ce182..fb65a23e 100644 --- a/orgfront/playwright.config.ts +++ b/orgfront/playwright.config.ts @@ -3,6 +3,11 @@ import { defineConfig, devices } from "@playwright/test"; const configuredWorkers = process.env.PLAYWRIGHT_WORKERS ? Number.parseInt(process.env.PLAYWRIGHT_WORKERS, 10) : undefined; +const port = Number.parseInt(process.env.PORT ?? "4175", 10); +const defaultBaseUrl = `http://127.0.0.1:${port}`; +const baseURL = process.env.BASE_URL ?? defaultBaseUrl; +const reuseExistingServer = !process.env.CI && !process.env.PORT; +const testOidcAuthority = "http://localhost:5000/oidc"; /** * Read environment variables from file. @@ -35,7 +40,7 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: "http://localhost:5175", + baseURL, /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "on-first-retry", @@ -60,11 +65,14 @@ export default defineConfig({ ], /* Run your local dev server before starting the tests */ - webServer: { - command: process.env.CI - ? "npm run build && npm run preview -- --host 0.0.0.0 --port 5175" - : "npm run dev -- --host 0.0.0.0 --port 5175", - url: "http://localhost:5175", - reuseExistingServer: !process.env.CI, - }, + webServer: process.env.BASE_URL + ? undefined + : { + command: process.env.CI + ? `VITE_OIDC_AUTHORITY=${testOidcAuthority} npm run build && VITE_OIDC_AUTHORITY=${testOidcAuthority} npm run preview -- --host 127.0.0.1 --port ${port}` + : `VITE_OIDC_AUTHORITY=${testOidcAuthority} npm run dev -- --host 127.0.0.1 --port ${port}`, + url: defaultBaseUrl, + reuseExistingServer, + timeout: 120 * 1000, + }, }); diff --git a/orgfront/tests/orgfront-auto-login.spec.ts b/orgfront/tests/orgfront-auto-login.spec.ts index 3fda2cb6..e15b4eb5 100644 --- a/orgfront/tests/orgfront-auto-login.spec.ts +++ b/orgfront/tests/orgfront-auto-login.spec.ts @@ -56,7 +56,7 @@ test("orgfront login auto parameter starts OIDC authorization", async ({ const parsed = new URL(oidc.authorizationURL()); expect(parsed.searchParams.get("client_id")).toBe("orgfront"); expect(parsed.searchParams.get("redirect_uri")).toBe( - "http://localhost:5175/auth/callback", + "http://127.0.0.1:4175/auth/callback", ); expect(parsed.searchParams.get("response_type")).toBe("code"); expect(parsed.searchParams.get("scope") ?? "").toContain("openid");