Skip to content

v1.59.0.0 feat(browse): device / geo / locale / timezone emulation#2064

Open
Saimoguloju wants to merge 3 commits into
garrytan:mainfrom
Saimoguloju:feat/browse-emulation
Open

v1.59.0.0 feat(browse): device / geo / locale / timezone emulation#2064
Saimoguloju wants to merge 3 commits into
garrytan:mainfrom
Saimoguloju:feat/browse-emulation

Conversation

@Saimoguloju

Copy link
Copy Markdown

Design

  • Extracts a shared buildContextOptions() so the three headless
    newContext() sites stop duplicating the viewport/scale/UA block — the new
    overrides are added in one place and can't drift.
  • buildEmulationExtras() (locale/timezone/geo, no viewport dependency) also
    spreads into the two headed launchPersistentContext sites, so those carry
    into headed mode and across the headless→headed handoff.
  • Device viewport sizing is headless-only (headed keeps the real window),
    documented in the command help.
  • All overrides persist across navigations, context rebuilds, and new tabs —
    same pattern as useragent/viewport.

Testing

  • bun test browse/test/emulation-command.test.ts — 10/10 pass (state +
    option builders, no real Chromium, runs on Windows).
  • bun run gen:skill-docs regenerated; usage-consistency validation passes.
  • Build-checked browser-manager.ts / write-commands.ts.

Saimoguloju and others added 3 commits June 20, 2026 22:55
Four new WRITE commands for context emulation:
  device <name|list|reset>   Playwright device presets (UA + viewport +
                             scale + mobile/touch)
  geo <lat,lng> | clear      geolocation override (auto-grants permission)
  locale <bcp47> | clear     Accept-Language + Intl locale
  timezone <iana-tz> | clear  Date/Intl timezone

Extracts a shared buildContextOptions() so the three headless newContext
sites stop duplicating the viewport/scale/UA block, and folds the new
overrides in there. buildEmulationExtras() (locale/timezone/geo, no
viewport dependency) also spreads into the two headed
launchPersistentContext sites, so geo/locale/timezone carry into headed
and across the headless->headed handoff. Device viewport sizing is
headless-only; in headed the real window wins, but the UA still applies.
10 unit tests, no real browser required.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Jun 20, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions github-actions Bot changed the title feat(browse): device / geo / locale / timezone emulation v1.59.0.0 feat(browse): device / geo / locale / timezone emulation Jun 20, 2026
@Saimoguloju

Copy link
Copy Markdown
Author

trunk merge below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant