Skip to content

feat: add webp screenshot format from upstream Playwright MCP - #124

Closed
JustasMonkev wants to merge 3 commits into
mainfrom
claude/kind-mendel-60pvm1
Closed

JustasMonkev wants to merge 3 commits into
mainfrom
claude/kind-mendel-60pvm1

Conversation

@JustasMonkev

@JustasMonkev JustasMonkev commented Jul 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes #123 by mirroring microsoft/playwright#41152 / commit f3114b3, now shipped in Playwright 1.62.0.

Upstream added WebP screenshot support and made screenshot type optional so it can be inferred from the filename extension.

Changes

  • Upgrade playwright and playwright-core from 1.61.1 to stable 1.62.0.
  • Add webp to browser_take_screenshot.
  • Infer png, jpeg, or webp from the filename when type is omitted.
  • Return the matching image content type and keep format-specific quality handling.
  • Update README and focused screenshot tests.

Why it matters

The downstream tool schema rejected WebP even though stable Playwright supports it. Clients also could not rely on the upstream filename-inference behavior.

Validation

  • npm test -- tests/tools-screenshot.test.ts — 9 passed.
  • npm run lint.
  • npm run build.
  • npm test — 37 files, 501 tests passed.
  • Real local Chrome screenshot produced valid RIFF/WEBP bytes with Playwright 1.62.0.
  • npm pack --dry-run --json.

Summary by CodeRabbit

  • New Features
    • Added WebP support to the screenshot tool.
    • Screenshot responses now return the correct image content type for PNG, JPEG, and WebP files.
    • JPEG quality settings are applied only to JPEG screenshots.
  • Documentation
    • Updated screenshot tool docs to include WebP, including how the output format is inferred from the filename when type isn’t provided.
  • Tests
    • Expanded coverage for WebP handling, filename-based format inference, and validation of unsupported type values.

Blocked by upstream ARIA regression

Do not merge this dependency bump yet. A real-browser comparison found that Playwright 1.61.1 preserves the accessible name for the nested-span/aria-hidden-SVG case, while stable 1.62.0 emits an unnamed button.

Upstream fixed the regression in microsoft/playwright#41988 / commit 59120d0, after 1.62.0 was published.

Next action: wait for a stable Playwright release containing that fix, update the pin, rerun the focused runtime comparison and full validation, then mark this PR ready.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e2828def-ece9-456d-80b8-1a753c650065

📥 Commits

Reviewing files that changed from the base of the PR and between 8703615 and ebd9a9f.

📒 Files selected for processing (3)
  • SKILL.md
  • src/tools/screenshot.ts
  • tests/tools-screenshot.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/tools-screenshot.test.ts

📝 Walkthrough

Walkthrough

The screenshot tool now supports WebP output, infers omitted formats from filename extensions, applies quality only to JPEG, returns format-specific content types, updates documentation and Playwright versions, and adds validation coverage.

Changes

WebP screenshot support

Layer / File(s) Summary
Screenshot contract and execution
src/tools/screenshot.ts, package.json, README.md, SKILL.md
The tool accepts WebP, infers formats from filenames, forwards the resolved format to Playwright, applies quality only to JPEG, returns the matching image content type, updates documentation, and bumps Playwright versions.
Screenshot format validation
tests/tools-screenshot.test.ts
Tests cover WebP forwarding, filename-based inference, format-specific quality handling, and rejection of invalid types.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Suggested reviewers: claude

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main change: adding WebP screenshot support from upstream Playwright MCP.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/kind-mendel-60pvm1

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 51c90a7 and 5815519.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • README.md
  • package.json
  • src/tools/screenshot.ts
  • tests/tools-screenshot.test.ts

Comment thread package.json Outdated
Comment on lines +52 to +53
"playwright": "1.62.0-alpha-2026-07-10",
"playwright-core": "1.62.0-alpha-2026-07-10",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread package-lock.json Resolved
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
@JustasMonkev
JustasMonkev force-pushed the claude/kind-mendel-60pvm1 branch from 5815519 to 8703615 Compare July 27, 2026 17:31

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
README.md (1)

258-258: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Pin the Playwright version in the storage-state command.

README.md documents npx playwright codegen, but the package dependencies use Playwright 1.62.0. Pin the CLI command to that version to avoid resolving a different release.

Proposed fix
-npx playwright codegen --save-storage=auth.json https://example.com/login
+npx playwright@1.62.0 codegen --save-storage=auth.json https://example.com/login
🤖 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 `@README.md` at line 258, Update the documented Playwright storage-state
command to invoke version 1.62.0 explicitly, while preserving its existing
codegen arguments and URL.

Source: Learnings

🤖 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.

Outside diff comments:
In `@README.md`:
- Line 258: Update the documented Playwright storage-state command to invoke
version 1.62.0 explicitly, while preserving its existing codegen arguments and
URL.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 024a3762-8d1d-4f05-bca2-1ac3d4b3b625

📥 Commits

Reviewing files that changed from the base of the PR and between 5815519 and 8703615.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • README.md
  • package.json
  • src/tools/screenshot.ts
  • tests/tools-screenshot.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • package.json
  • tests/tools-screenshot.test.ts
  • src/tools/screenshot.ts

@JustasMonkev
JustasMonkev marked this pull request as draft July 27, 2026 17:33

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 870361541f

ℹ️ 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".

Comment thread README.md Resolved
@JustasMonkev
JustasMonkev marked this pull request as ready for review July 27, 2026 17:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 870361541f

ℹ️ 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".

Comment thread package.json Resolved
@JustasMonkev
JustasMonkev marked this pull request as draft July 27, 2026 17:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b7e5351556

ℹ️ 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".

Comment thread src/tools/screenshot.ts Resolved
@JustasMonkev
JustasMonkev marked this pull request as ready for review July 27, 2026 18:07
@JustasMonkev
JustasMonkev marked this pull request as draft July 27, 2026 18:09
@JustasMonkev
JustasMonkev marked this pull request as ready for review July 27, 2026 18:10
@JustasMonkev
JustasMonkev marked this pull request as draft July 27, 2026 18:11
@JustasMonkev
JustasMonkev marked this pull request as ready for review July 30, 2026 05:53
@JustasMonkev
JustasMonkev deleted the claude/kind-mendel-60pvm1 branch July 31, 2026 03:19
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.

Sync browser_take_screenshot with upstream Playwright MCP: add webp output format (blocked on Playwright bump)

2 participants