From 4e6137db5ba826cab91581efad00c1366d7fc2d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Tue, 29 Sep 2026 17:24:48 +0200 Subject: [PATCH] Match test browser platform to the host --- playwright.config.ts | 9 ++++++++- tests/e2e/navigation.spec.ts | 6 +----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/playwright.config.ts b/playwright.config.ts index 0f825a3c5..8c54beabd 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -15,6 +15,12 @@ function getFreePort(): Promise { }); } +const desktopSafari = devices["Desktop Safari"]; +const userAgent = + process.platform === "darwin" + ? desktopSafari.userAgent + : desktopSafari.userAgent.replace(/\([^)]*\)/, "(X11; Linux x86_64)"); + const testHttpApiPort = await getFreePort(); process.env.VITE_TEST_HTTP_API_PORT = String(testHttpApiPort); @@ -42,7 +48,8 @@ const config: PlaywrightTestConfig = { { name: "webkit", use: { - ...devices["Desktop Safari"], + ...desktopSafari, + userAgent, }, }, ], diff --git a/tests/e2e/navigation.spec.ts b/tests/e2e/navigation.spec.ts index c7c02f34a..51e9ca30d 100644 --- a/tests/e2e/navigation.spec.ts +++ b/tests/e2e/navigation.spec.ts @@ -99,11 +99,7 @@ test("history position survives a reload", async ({ page }) => { test("shortcuts stay within the app's history", async ({ page }) => { await launch(page); - const mac = await page.evaluate( - () => - navigator.platform.includes("Mac") || - navigator.userAgent.includes("OS X"), - ); + const mac = process.platform === "darwin"; const backShortcut = mac ? "Meta+BracketLeft" : "Alt+ArrowLeft"; const forwardShortcut = mac ? "Meta+BracketRight" : "Alt+ArrowRight"; await openRepo(page);