Skip to content

Conversation

@Beace
Copy link
Contributor

@Beace Beace commented Feb 7, 2025

在内部也遇到了,感觉直接加就行,可以试试看看 @fengmk2

close #742

Summary by CodeRabbit

  • New Features

    • Introduced enhanced support for the chromium-headless-shell binary with updated download options across multiple operating systems, including popular Linux distributions, macOS (with arm64 support), and Windows. This improvement ensures smoother integration and broader compatibility for users running different platforms.
    • Added a new directory for 'chromium-headless-shell' in the application, improving the organization of available binaries.
  • Bug Fixes

    • Updated test assertions to reflect the addition of the 'chromium-headless-shell' binary, ensuring accurate test coverage and validation of expected results.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 7, 2025

Walkthrough

A new binary entry for 'chromium-headless-shell' has been added into the DOWNLOAD_PATHS constant in the PlaywrightBinary class. This entry provides platform-specific download URLs for various operating systems and architectures, including Ubuntu (20.04, 22.04, 24.04), Debian (11 and 12), and multiple macOS versions (with arm64 support). Additionally, logic has been introduced in the fetch method to handle the 'chromium-headless-shell' browser, enhancing its functionality.

Changes

File Path Change Summary
app/.../PlaywrightBinary.ts Added new 'chromium-headless-shell' entry to DOWNLOAD_PATHS with URLs for Ubuntu, Debian, macOS, and Windows platforms. New logic in fetch method to handle the 'chromium-headless-shell' browser.
test/.../PlaywrightBinary.test.ts Updated assertions in fetch() tests to reflect the addition of 'chromium-headless-shell', including changes to expected lengths and directory names.

Sequence Diagram(s)

sequenceDiagram
    participant U as User/System
    participant PB as PlaywrightBinary
    participant DP as DOWNLOAD_PATHS
    U->>PB: Request download for 'chromium-headless-shell'
    PB->>DP: Look up download URL based on platform
    DP-->>PB: Return URL
    PB->>U: Initiate download using the retrieved URL
Loading

Assessment against linked issues

Objective Addressed Explanation
Ensure chromium-headless-shell binary is available for various platforms (#742)

Possibly related PRs

Poem

I'm a little rabbit on the run,
Hopping through code in the morning sun,
New binary paths now join the dance,
Crafting downloads with a bunny prance,
Cheers to code that leaps and has fun!

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Beace Beace requested a review from fengmk2 February 7, 2025 08:22
@fengmk2
Copy link
Member

fengmk2 commented Feb 7, 2025

https://playwright.azureedge.net/builds/chromium/1155/chromium-headless-shell-linux.zip 确实可以,我手动修改一下代码

@fengmk2 fengmk2 self-assigned this Feb 7, 2025
@fengmk2 fengmk2 added the enhancement New feature or request label Feb 7, 2025
@fengmk2 fengmk2 merged commit 3a3aa81 into cnpm:master Feb 7, 2025
15 of 17 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
app/common/adapter/binary/PlaywrightBinary.ts (1)

269-284: Enhance error handling and documentation for chromium-headless-shell fallback.

The fallback logic for creating chromium-headless-shell from chromium data could be improved:

  1. Add error logging if chromium is not found
  2. Document why chromium properties are compatible with headless-shell

Consider this improvement:

 // if chromium-headless-shell not exists on browsers, copy chromium to chromium-headless-shell
+// Note: chromium-headless-shell uses the same build revision and version as chromium
+// as it's derived from the same Chromium codebase
 if (!browsers.find(browser => browser.name === 'chromium-headless-shell')) {
   const chromium = browsers.find(browser => browser.name === 'chromium');
-  // {
-  //   "name": "chromium",
-  //   "revision": "1155",
-  //   "installByDefault": true,
-  //   "browserVersion": "133.0.6943.16"
-  // }
   if (chromium) {
     browsers.push({
       ...chromium,
       name: 'chromium-headless-shell',
     });
+  } else {
+    this.logger.warn('[PlaywrightBinary.fetch:warn] Cannot create chromium-headless-shell entry: chromium browser not found');
   }
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2621602 and ecfb07a.

📒 Files selected for processing (2)
  • app/common/adapter/binary/PlaywrightBinary.ts (2 hunks)
  • test/common/adapter/binary/PlaywrightBinary.test.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: test-postgresql-fs-nfs (22, ubuntu-latest)
  • GitHub Check: test-mysql57-fs-nfs (18, ubuntu-latest)
  • GitHub Check: test-mysql57-fs-nfs (18.20.0, ubuntu-latest)
🔇 Additional comments (1)
test/common/adapter/binary/PlaywrightBinary.test.ts (1)

54-54: LGTM! Test coverage looks good.

The test changes appropriately verify the addition of chromium-headless-shell:

  • Updated array length check
  • Added assertion for the new browser entry
  • Included in the list of names for detailed testing

Also applies to: 62-62, 67-67

Comment on lines +189 to +217
'chromium-headless-shell': {
'<unknown>': undefined,
'ubuntu18.04-x64': undefined,
'ubuntu20.04-x64': 'builds/chromium/%s/chromium-headless-shell-linux.zip',
'ubuntu22.04-x64': 'builds/chromium/%s/chromium-headless-shell-linux.zip',
'ubuntu24.04-x64': 'builds/chromium/%s/chromium-headless-shell-linux.zip',
'ubuntu18.04-arm64': undefined,
'ubuntu20.04-arm64': 'builds/chromium/%s/chromium-headless-shell-linux-arm64.zip',
'ubuntu22.04-arm64': 'builds/chromium/%s/chromium-headless-shell-linux-arm64.zip',
'ubuntu24.04-arm64': 'builds/chromium/%s/chromium-headless-shell-linux-arm64.zip',
'debian11-x64': 'builds/chromium/%s/chromium-headless-shell-linux.zip',
'debian11-arm64': 'builds/chromium/%s/chromium-headless-shell-linux-arm64.zip',
'debian12-x64': 'builds/chromium/%s/chromium-headless-shell-linux.zip',
'debian12-arm64': 'builds/chromium/%s/chromium-headless-shell-linux-arm64.zip',
'mac10.13': undefined,
'mac10.14': undefined,
'mac10.15': undefined,
'mac11': 'builds/chromium/%s/chromium-headless-shell-mac.zip',
'mac11-arm64': 'builds/chromium/%s/chromium-headless-shell-mac-arm64.zip',
'mac12': 'builds/chromium/%s/chromium-headless-shell-mac.zip',
'mac12-arm64': 'builds/chromium/%s/chromium-headless-shell-mac-arm64.zip',
'mac13': 'builds/chromium/%s/chromium-headless-shell-mac.zip',
'mac13-arm64': 'builds/chromium/%s/chromium-headless-shell-mac-arm64.zip',
'mac14': 'builds/chromium/%s/chromium-headless-shell-mac.zip',
'mac14-arm64': 'builds/chromium/%s/chromium-headless-shell-mac-arm64.zip',
'mac15': 'builds/chromium/%s/chromium-headless-shell-mac.zip',
'mac15-arm64': 'builds/chromium/%s/chromium-headless-shell-mac-arm64.zip',
'win64': 'builds/chromium/%s/chromium-headless-shell-win64.zip',
},
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Consider standardizing platform support across browser types.

The chromium-headless-shell entry introduces support for platforms not present in other browser configurations:

  • Ubuntu 24.04 (lines 194, 198)
  • macOS 15 (lines 214-215)

This inconsistency might lead to maintenance challenges.

Would you like me to generate a script to verify if these platforms are supported in the upstream Playwright repository?


🏁 Script executed:

#!/bin/bash
# Description: Check if Ubuntu 24.04 and macOS 15 are supported in upstream Playwright

# Clone the Playwright repository
git clone --depth 1 https://github.com/microsoft/playwright.git
cd playwright

# Check for Ubuntu 24.04 and macOS 15 support in the codebase
echo "Checking for Ubuntu 24.04 support:"
rg -i "ubuntu.*24.04|ubuntu.*24\.04"

echo "Checking for macOS 15 support:"
rg -i "mac.*15|macos.*15"

Length of output: 106961


Inconsistency Detected: mac15 Support Appears Unsupported in Upstream

  • The upstream Playwright repository clearly registers support for Ubuntu 24.04 (with consistent entries in registry files and documentation).
  • However, the shell script search did not reveal any references for "mac15" support—in contrast to multiple mentions of macOS 10.15 (including deprecation notices) and support for mac11–mac14. This suggests that while other browser binaries follow a similar pattern, the addition of mac15 (and mac15-arm64) in the chromium-headless-shell entry is unique.
  • This discrepancy could introduce maintenance challenges. It’s advisable to verify whether mac15 support is intentionally added or if it should be standardized with the upstream configurations.

fengmk2 pushed a commit that referenced this pull request Feb 7, 2025
[skip ci]

## [3.72.0](v3.71.3...v3.72.0) (2025-02-07)

### Features

* **mirror:** add chromium-headless-shell ([#748](#748)) ([3a3aa81](3a3aa81)), closes [#742](#742)
@fengmk2
Copy link
Member

fengmk2 commented Feb 7, 2025

下载地址是 https://cdn.npmmirror.com/binaries/playwright/builds/chromium/1155/chromium-headless-shell-mac-arm64.zip ,我需要再修一下

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

playwright二进制产物,在chromium/1148 缺少 chromium-headless-shell 相关文件

2 participants