feat: add webp screenshot format from upstream Playwright MCP#124
feat: add webp screenshot format from upstream Playwright MCP#124JustasMonkev wants to merge 1 commit into
Conversation
Mirror microsoft/playwright#41152 (commit f3114b3): browser_take_screenshot now accepts type 'webp' alongside png/jpeg. Requires playwright 1.62, so the pin moves to 1.62.0-alpha-2026-07-10 until a stable release lands. Closes #123 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VNuK5H15LdnhueURhz1rEq
📝 WalkthroughWalkthroughChangesWebP screenshot support
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package.json`:
- Around line 52-53: Align the `@playwright/test` dependency with playwright and
playwright-core by updating its version to 1.62.0-alpha-2026-07-10 in
package.json, ensuring all Playwright packages resolve to the same version.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6b6e2e38-2ebd-4fb5-850d-0c4adadd5ea2
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
README.mdpackage.jsonsrc/tools/screenshot.tstests/tools-screenshot.test.ts
| "playwright": "1.62.0-alpha-2026-07-10", | ||
| "playwright-core": "1.62.0-alpha-2026-07-10", |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
@playwright/test version mismatch with playwright/playwright-core.
playwright and playwright-core are bumped to 1.62.0-alpha-2026-07-10, but @playwright/test (Line 61) remains at 1.61.0. This creates a duplicate playwright-core installation in node_modules (1.61.0 via @playwright/test transitive, 1.62.0-alpha direct), which can lead to API mismatches and subtle runtime issues if both are imported in the same process.
🔧 Proposed fix
- "`@playwright/test`": "1.61.0",
+ "`@playwright/test`": "1.62.0-alpha-2026-07-10",Also applies to: 61-61
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@package.json` around lines 52 - 53, Align the `@playwright/test` dependency
with playwright and playwright-core by updating its version to
1.62.0-alpha-2026-07-10 in package.json, ensuring all Playwright packages
resolve to the same version.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 581551918c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "node_modules/@playwright/test/node_modules/playwright": { | ||
| "version": "1.61.0", |
There was a problem hiding this comment.
Align the Playwright CLI version used by installs
This new nested 1.61.0 copy exists because @playwright/test remains at 1.61.0 while the runtime playwright/playwright-core packages were bumped to 1.62 alpha. I checked the CI workflow, and its browser install step still runs npx playwright install --with-deps chromium; after npm ci npm links the top-level playwright bin from @playwright/test, so that step uses this 1.61 CLI/browser revision while the application imports the 1.62 runtime. In environments that skip postinstall downloads or rely on the explicit install step, launches can hit Playwright's executable-version mismatch; bump @playwright/test to the same version or invoke the root playwright-core CLI.
Useful? React with 👍 / 👎.
Summary
Resolves #123 by mirroring upstream microsoft/playwright#41152 / commit
f3114b3(merged 2026-07-10):browser_take_screenshotnow acceptstype: 'webp'alongsidepng/jpeg.Changes in
src/tools/screenshot.ts:'webp'to thetypeenum and update the default-filename description to{png|jpeg|webp}.quality: 90only forjpeg;png/webpuse browser defaults (upstream:quality: fileType === 'jpeg' ? 90 : undefined).contentTypeasimage/${fileType}so webp returnsimage/webp.Plus README parameter docs and three new schema/handler tests.
Version bump — maintainer note
WebP is a new Playwright core capability, so the pin moves from
1.61.0to1.62.0-alpha-2026-07-10(the first build containing #41152; latest stable1.61.1still types screenshots as"png"|"jpeg"and throws on webp at runtime). If you'd rather not ship a nightly pin, hold this PR until1.62.0stable and I/you can swap the pin — the rest of the diff is unchanged. Notenpm lsshows a cosmeticinvalidflag on@axe-core/playwright'splaywright-core >= 1.0.0peer range because semver prereleases don't satisfy plain ranges; install and tests are unaffected, and it disappears at 1.62.0 stable.Why it matters
The tool surface had diverged from upstream Playwright MCP: clients could not request WebP screenshots even though upstream
browser_take_screenshotnow supports them.Validation
npm run build,npm run lint(eslint + typecheck) — clean on the alpha.npm test— 355 passed / 9 skipped (3 new webp tests).page.screenshot({ type: 'webp' })produced a valid WebP (RIFF/WEBP magic bytes, 19 KB).npm run test:mcpfails identically onmain(harness declares tests for non-exposedbrowser_network_request/browser_drop— pre-existing, tracked by Sync browser MCP tools with upstream Playwright: network response body/headers, evaluate expressions, browser_drop #116), so it's unrelated to this diff.🤖 Generated with Claude Code
https://claude.ai/code/session_01VNuK5H15LdnhueURhz1rEq
Generated by Claude Code
Summary by CodeRabbit
New Features
Documentation