mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-03 02:30:29 +08:00
Match test browser platform to the host
This commit is contained in:
@@ -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,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user