v1.59.0.0 feat(browse): device / geo / locale / timezone emulation#2064
Open
Saimoguloju wants to merge 3 commits into
Open
v1.59.0.0 feat(browse): device / geo / locale / timezone emulation#2064Saimoguloju wants to merge 3 commits into
Saimoguloju wants to merge 3 commits into
Conversation
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>
|
Merging to
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 |
Author
|
trunk merge below. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Design
buildContextOptions()so the three headlessnewContext()sites stop duplicating the viewport/scale/UA block — the newoverrides are added in one place and can't drift.
buildEmulationExtras()(locale/timezone/geo, no viewport dependency) alsospreads into the two headed
launchPersistentContextsites, so those carryinto headed mode and across the headless→headed handoff.
documented in the command help.
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-docsregenerated; usage-consistency validation passes.browser-manager.ts/write-commands.ts.