feat: wire timezone/locale params to Chromium binary flags

launch() and launch_context() now inject --timezone and --lang binary
flags when timezone/locale params are set. Previously only the Playwright
context layer was configured, leaving a detectable mismatch that CreepJS
flagged as a bot signal.

Closes: WM5
This commit is contained in:
CloakHQ
2026-03-02 02:59:18 +01:00
parent 2f1f592b3a
commit c65939af14
2 changed files with 78 additions and 0 deletions
+32
View File
@@ -6,6 +6,7 @@ import {
getBinaryDir,
getDownloadUrl,
} from "../src/config.js";
import { _buildArgsForTest } from "../src/playwright.js";
describe("config", () => {
it("CHROMIUM_VERSION matches expected format", () => {
@@ -65,3 +66,34 @@ describe("config", () => {
expect(url).toContain("cloakbrowser.dev");
});
});
describe("buildArgs timezone/locale", () => {
it("injects --timezone when timezone is set", () => {
const args = _buildArgsForTest({ timezone: "America/New_York" });
expect(args).toContain("--timezone=America/New_York");
});
it("injects --lang when locale is set", () => {
const args = _buildArgsForTest({ locale: "en-US" });
expect(args).toContain("--lang=en-US");
});
it("injects both when both are set", () => {
const args = _buildArgsForTest({ timezone: "Europe/Berlin", locale: "de-DE" });
expect(args).toContain("--timezone=Europe/Berlin");
expect(args).toContain("--lang=de-DE");
});
it("injects timezone/locale even when stealthArgs=false", () => {
const args = _buildArgsForTest({ stealthArgs: false, timezone: "America/New_York", locale: "en-US" });
expect(args).toContain("--timezone=America/New_York");
expect(args).toContain("--lang=en-US");
expect(args.some(a => a.startsWith("--fingerprint="))).toBe(false);
});
it("does not inject flags when not set", () => {
const args = _buildArgsForTest({});
expect(args.some(a => a.startsWith("--timezone="))).toBe(false);
expect(args.some(a => a.startsWith("--lang="))).toBe(false);
});
});