Skip to content

[rb] Add support for beta chrome #15874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: trunk
Choose a base branch
from

Conversation

aguspe
Copy link
Contributor

@aguspe aguspe commented Jun 7, 2025

User description

🔗 Related Issues

This PR introduces the changes that were originally supposed to be introduced in #15417 and reverted in #15837

💥 What does this PR do?

This PR adds beta Chrome support for the Ruby pipeline

🔧 Implementation Notes

The changes implemented introduced the download of the beta Chrome in pinned browsers and added it to the integration tests

💡 Additional Considerations

We started seeing memory heap issues, but that is due to Bazel and not this PR


PR Type

Enhancement


Description

  • Add beta Chrome support to Ruby pipeline

    • Download and pin beta Chrome and Chromedriver
    • Integrate beta Chrome into Bazel build and test configs
  • Update integration tests to run with beta Chrome

  • Refactor and generalize Chrome pinning logic in scripts

  • Update browser and driver versions for Edge and Firefox


Changes walkthrough 📝

Relevant files
Enhancement
4 files
browsers.bzl
Add beta Chrome and Chromedriver data targets                       
+22/-0   
repositories.bzl
Add beta Chrome/Chromedriver repos, update browser versions
+91/-15 
tests.bzl
Add chrome-beta browser config for Ruby tests                       
+25/-0   
pinned_browsers.py
Refactor and add beta Chrome/Chromedriver pinning logic   
+42/-56 
Configuration changes
1 files
MODULE.bazel
Register beta Chrome/Chromedriver in Bazel module               
+4/-0     
Tests
2 files
BUILD.bazel
Add chrome-beta to integration test browsers list               
+1/-0     
BUILD.bazel
Run Chrome integration tests with chrome-beta                       
+6/-1     

Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @selenium-ci selenium-ci added C-rb Ruby Bindings B-build Includes scripting, bazel and CI integrations labels Jun 7, 2025
    Copy link
    Contributor

    qodo-merge-pro bot commented Jun 7, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Code Duplication

    The chrome() and chromedriver() functions contain duplicated code blocks with similar structure for handling Linux and Mac platforms. This could be refactored to use a common helper function to reduce duplication and improve maintainability.

    def chrome(selected_version, workspace_prefix=""):
        content = ""
        chrome_downloads = selected_version["downloads"]["chrome"]
    
        url = [d["url"] for d in chrome_downloads if d["platform"] == "linux64"][0]
        sha = calculate_hash(url)
    
        content += f"""
        http_archive(
            name = "linux_{workspace_prefix}chrome",
            url = "{url}",
            sha256 = "{sha}",
            build_file_content = \"\"\"
    load("@aspect_rules_js//js:defs.bzl", "js_library")
    package(default_visibility = ["//visibility:public"])
    
    filegroup(
        name = "files",
        srcs = glob(["**/*"]),
    )
    
    exports_files(["chrome-linux64/chrome"])
    
    js_library(
        name = "chrome-js",
        data = [":files"],
    )
    \"\"\",
        )
    """
    
        url = [d["url"] for d in chrome_downloads if d["platform"] == "mac-x64"][0]
        sha = calculate_hash(url)  # Calculate SHA for Mac chrome
    
        content += f"""    http_archive(
            name = "mac_{workspace_prefix}chrome",
            url = "{url}",
            sha256 = "{sha}",
            strip_prefix = "chrome-mac-x64",
            patch_cmds = [
                "mv 'Google Chrome for Testing.app' Chrome.app",
                "mv 'Chrome.app/Contents/MacOS/Google Chrome for Testing' Chrome.app/Contents/MacOS/Chrome",
            ],
            build_file_content = \"\"\"
    load("@aspect_rules_js//js:defs.bzl", "js_library")
    package(default_visibility = ["//visibility:public"])
    
    exports_files(["Chrome.app"])
    
    js_library(
        name = "chrome-js",
        data = glob(["Chrome.app/**/*"]),
    )
    \"\"\",
        )
    """
    
        return content
    Data Dependency

    The data dependency on "//common/extensions" was added for Chrome tests but it's not clear if this is required for both Chrome stable and beta. This dependency wasn't present in the original file and might need validation.

        data = ["//common/extensions"],
    )

    Copy link
    Contributor

    qodo-merge-pro bot commented Jun 7, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Define missing http variable

    The http variable is used but not defined in the scope. This will cause a
    NameError when the function is called. You need to initialize the http variable
    at the top of the file with the urllib3 library.

    scripts/pinned_browsers.py [28-32]

     def get_chrome_info_for_channel(channel):
    +    import urllib3
    +    http = urllib3.PoolManager()
         r = http.request(
             "GET",
             f"https://chromiumdash.appspot.com/fetch_releases?channel={channel}&num=1&platform=Mac,Linux",
         )
    • Apply / Chat
    Suggestion importance[1-10]: 3

    __

    Why: While the http variable is used in the new function, the existing calculate_hash function also uses http without modification, suggesting it's likely defined elsewhere in the file outside the visible diff. The local import solution may be unnecessary if a global http variable already exists.

    Low
    • Update

    @aguspe aguspe changed the title Rb add support for beta chrome [rb] Add support for beta chrome Jun 7, 2025
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    B-build Includes scripting, bazel and CI integrations C-rb Ruby Bindings Review effort 3/5
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants