Match test browser platform to the host

This commit is contained in:
Rūdolfs Ošiņš
2026-09-29 17:24:48 +02:00
parent 4d45516970
commit 4e6137db5b
2 changed files with 9 additions and 6 deletions
+8 -1
View File
@@ -15,6 +15,12 @@ function getFreePort(): Promise<number> {
});
}
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,
},
},
],
+1 -5
View File
@@ -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);