diff --git a/MODULE.bazel b/MODULE.bazel index 219317fd13acb..cd743a57bccdc 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -370,8 +370,6 @@ use_repo( pin_browsers_extension = use_extension("//common:repositories.bzl", "pin_browsers_extension") use_repo( pin_browsers_extension, - "linux_beta_chrome", - "linux_beta_chromedriver", "linux_beta_firefox", "linux_chrome", "linux_chromedriver", @@ -379,8 +377,6 @@ use_repo( "linux_edgedriver", "linux_firefox", "linux_geckodriver", - "mac_beta_chrome", - "mac_beta_chromedriver", "mac_beta_firefox", "mac_chrome", "mac_chromedriver", diff --git a/common/browsers.bzl b/common/browsers.bzl index 0617a80c934d4..7be9d79fbf267 100644 --- a/common/browsers.bzl +++ b/common/browsers.bzl @@ -83,25 +83,3 @@ firefox_beta_data = select({ ], "//conditions:default": [], }) + geckodriver_data - -chromedriver_beta_data = select({ - "@selenium//common:use_pinned_linux_chrome": [ - "@linux_beta_chromedriver//:chromedriver", - ], - "@selenium//common:use_pinned_macos_chrome": [ - "@mac_beta_chromedriver//:chromedriver", - ], - "@selenium//common:use_local_chromedriver": ["@selenium//common:chromedriver"], - "//conditions:default": [], -}) - -chrome_beta_data = select({ - "@selenium//common:use_pinned_linux_chrome": [ - "@linux_beta_chrome//:files", - "@linux_beta_chrome//:chrome-linux64/chrome", - ], - "@selenium//common:use_pinned_macos_chrome": [ - "@mac_beta_chrome//:Chrome.app", - ], - "//conditions:default": [], -}) + chromedriver_beta_data diff --git a/common/repositories.bzl b/common/repositories.bzl index 1892dba90cfb7..026fe74936ace 100644 --- a/common/repositories.bzl +++ b/common/repositories.bzl @@ -218,6 +218,7 @@ js_library( ) """, ) + http_archive( name = "mac_chrome", url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.55/mac-x64/chrome-mac-x64.zip", @@ -239,6 +240,7 @@ js_library( ) """, ) + http_archive( name = "linux_chromedriver", url = "https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.55/linux64/chromedriver-linux64.zip", @@ -268,84 +270,6 @@ package(default_visibility = ["//visibility:public"]) exports_files(["chromedriver"]) -js_library( - name = "chromedriver-js", - data = ["chromedriver"], -) -""", - ) - - http_archive( - name = "linux_beta_chrome", - url = "https://storage.googleapis.com/chrome-for-testing-public/138.0.7204.4/linux64/chrome-linux64.zip", - sha256 = "d6ead5a796a19ccdebd603fb626eb66ebaafa82a051f03d3898cffed16d1d513", - 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"], -) -""", - ) - http_archive( - name = "mac_beta_chrome", - url = "https://storage.googleapis.com/chrome-for-testing-public/138.0.7204.4/mac-x64/chrome-mac-x64.zip", - sha256 = "07c32ddffb7ad10038cde6187891a0ba7eaf65869af38d1709b0384697ccdbfa", - 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/**/*"]), -) -""", - ) - http_archive( - name = "linux_beta_chromedriver", - url = "https://storage.googleapis.com/chrome-for-testing-public/138.0.7204.4/linux64/chromedriver-linux64.zip", - sha256 = "187813f44358a8bfa42bd043eced9481687998ff0f691a46108555574836ad38", - strip_prefix = "chromedriver-linux64", - build_file_content = """ -load("@aspect_rules_js//js:defs.bzl", "js_library") -package(default_visibility = ["//visibility:public"]) - -exports_files(["chromedriver"]) - -js_library( - name = "chromedriver-js", - data = ["chromedriver"], -) -""", - ) - - http_archive( - name = "mac_beta_chromedriver", - url = "https://storage.googleapis.com/chrome-for-testing-public/138.0.7204.4/mac-x64/chromedriver-mac-x64.zip", - sha256 = "9823d0e33d930761a9967dce0403a53dc5b2d3376af46cd3e7f10bc28bfe401d", - strip_prefix = "chromedriver-mac-x64", - build_file_content = """ -load("@aspect_rules_js//js:defs.bzl", "js_library") -package(default_visibility = ["//visibility:public"]) - -exports_files(["chromedriver"]) - js_library( name = "chromedriver-js", data = ["chromedriver"], diff --git a/rb/spec/integration/BUILD.bazel b/rb/spec/integration/BUILD.bazel index c13fa56313f5c..80c827aecc236 100644 --- a/rb/spec/integration/BUILD.bazel +++ b/rb/spec/integration/BUILD.bazel @@ -2,7 +2,6 @@ package(default_visibility = ["//rb/spec/integration:__subpackages__"]) BROWSERS = [ "chrome", - "chrome-beta", "edge", "firefox", "ie", diff --git a/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel b/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel index a86ffd7d547ad..bd2441d4b2e56 100644 --- a/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel +++ b/rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel @@ -4,12 +4,7 @@ load("//rb/spec:tests.bzl", "rb_integration_test") rb_integration_test( name = file[:-8], srcs = [file], - # No need to run in other browsers. - browsers = [ - "chrome", - "chrome-beta", - ], - data = ["//common/extensions"], + browsers = ["chrome"], # No need to run in other browsers. ) for file in glob(["*_spec.rb"]) ] diff --git a/rb/spec/tests.bzl b/rb/spec/tests.bzl index 85b7cb9b1d3ea..7004d184b2494 100644 --- a/rb/spec/tests.bzl +++ b/rb/spec/tests.bzl @@ -2,7 +2,6 @@ load("@rules_ruby//ruby:defs.bzl", "rb_library", "rb_test") load( "//common:browsers.bzl", "COMMON_TAGS", - "chrome_beta_data", "chrome_data", "edge_data", "firefox_beta_data", @@ -33,30 +32,6 @@ BROWSERS = { "//conditions:default": {}, }), }, - "chrome-beta": { - "data": chrome_beta_data, - "deps": ["//rb/lib/selenium/webdriver:chrome"], - "tags": [], - "target_compatible_with": [], - "env": { - "WD_REMOTE_BROWSER": "chrome", - "WD_SPEC_DRIVER": "chrome", - "WD_BROWSER_VERSION": "beta", - } | select({ - "@selenium//common:use_pinned_linux_chrome": { - "CHROME_BINARY": "$(location @linux_beta_chrome//:chrome-linux64/chrome)", - "CHROMEDRIVER_BINARY": "$(location @linux_beta_chromedriver//:chromedriver)", - }, - "@selenium//common:use_pinned_macos_chrome": { - "CHROME_BINARY": "$(location @mac_beta_chrome//:Chrome.app)/Contents/MacOS/Chrome", - "CHROMEDRIVER_BINARY": "$(location @mac_beta_chromedriver//:chromedriver)", - }, - "//conditions:default": {}, - }) | select({ - "@selenium//common:use_headless_browser": {"HEADLESS": "true"}, - "//conditions:default": {}, - }), - }, "edge": { "data": edge_data, "deps": ["//rb/lib/selenium/webdriver:edge"], diff --git a/scripts/pinned_browsers.py b/scripts/pinned_browsers.py index 05082779a0568..c4e4771f9453a 100755 --- a/scripts/pinned_browsers.py +++ b/scripts/pinned_browsers.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import argparse import hashlib import json import os @@ -25,7 +26,14 @@ def calculate_hash(url): return h.hexdigest() -def get_chrome_info_for_channel(channel): +def get_chrome_milestone(): + parser = argparse.ArgumentParser() + parser.add_argument( + "--chrome_channel", default="Stable", help="Set the Chrome channel" + ) + args = parser.parse_args() + channel = args.chrome_channel + r = http.request( "GET", f"https://chromiumdash.appspot.com/fetch_releases?channel={channel}&num=1&platform=Mac,Linux", @@ -47,18 +55,20 @@ def get_chrome_info_for_channel(channel): )[-1] -def chromedriver(selected_version, workspace_prefix=""): +def chromedriver(selected_version): content = "" drivers = selected_version["downloads"]["chromedriver"] - url = [d["url"] for d in drivers if d["platform"] == "linux64"][0] - sha = calculate_hash(url) + linux = [d["url"] for d in drivers if d["platform"] == "linux64"][0] + sha = calculate_hash(linux) - content += f""" http_archive( - name = "linux_{workspace_prefix}chromedriver", - url = "{url}", - sha256 = "{sha}", + content = ( + content + + """ http_archive( + name = "linux_chromedriver", + url = "%s", + sha256 = "%s", strip_prefix = "chromedriver-linux64", build_file_content = \"\"\" load("@aspect_rules_js//js:defs.bzl", "js_library") @@ -73,15 +83,18 @@ def chromedriver(selected_version, workspace_prefix=""): \"\"\", ) """ + % (linux, sha) + ) - url = [d["url"] for d in drivers if d["platform"] == "mac-x64"][0] - sha = calculate_hash(url) - - content += f""" + mac = [d["url"] for d in drivers if d["platform"] == "mac-x64"][0] + sha = calculate_hash(mac) + content = ( + content + + """ http_archive( - name = "mac_{workspace_prefix}chromedriver", - url = "{url}", - sha256 = "{sha}", + name = "mac_chromedriver", + url = "%s", + sha256 = "%s", strip_prefix = "chromedriver-mac-x64", build_file_content = \"\"\" load("@aspect_rules_js//js:defs.bzl", "js_library") @@ -96,22 +109,23 @@ def chromedriver(selected_version, workspace_prefix=""): \"\"\", ) """ + % (mac, sha) + ) return content -def chrome(selected_version, workspace_prefix=""): - content = "" +def chrome(selected_version): chrome_downloads = selected_version["downloads"]["chrome"] - url = [d["url"] for d in chrome_downloads if d["platform"] == "linux64"][0] - sha = calculate_hash(url) + linux = [d["url"] for d in chrome_downloads if d["platform"] == "linux64"][0] + sha = calculate_hash(linux) - content += f""" + content = """ http_archive( - name = "linux_{workspace_prefix}chrome", - url = "{url}", - sha256 = "{sha}", + name = "linux_chrome", + url = "%s", + sha256 = "%s", build_file_content = \"\"\" load("@aspect_rules_js//js:defs.bzl", "js_library") package(default_visibility = ["//visibility:public"]) @@ -129,15 +143,19 @@ def chrome(selected_version, workspace_prefix=""): ) \"\"\", ) -""" - url = [d["url"] for d in chrome_downloads if d["platform"] == "mac-x64"][0] - sha = calculate_hash(url) # Calculate SHA for Mac chrome +""" % ( + linux, + sha, + ) + + mac = [d["url"] for d in chrome_downloads if d["platform"] == "mac-x64"][0] + sha = calculate_hash(mac) - content += f""" http_archive( - name = "mac_{workspace_prefix}chrome", - url = "{url}", - sha256 = "{sha}", + content += """ http_archive( + name = "mac_chrome", + url = "%s", + sha256 = "%s", strip_prefix = "chrome-mac-x64", patch_cmds = [ "mv 'Google Chrome for Testing.app' Chrome.app", @@ -155,7 +173,11 @@ def chrome(selected_version, workspace_prefix=""): ) \"\"\", ) -""" + +""" % ( + mac, + sha, + ) return content @@ -500,17 +522,9 @@ def pin_browsers(): content = content + geckodriver() content = content + edge() content = content + edgedriver() - - # Stable Chrome - stable_chrome_info = get_chrome_info_for_channel(channel="Stable") - content = content + chrome(stable_chrome_info, workspace_prefix="") - content = content + chromedriver(stable_chrome_info, workspace_prefix="") - - # Beta Chrome - beta_chrome_info = get_chrome_info_for_channel(channel="Beta") - content = content + chrome(beta_chrome_info, workspace_prefix="beta_") - content = content + chromedriver(beta_chrome_info, workspace_prefix="beta_") - + chrome_milestone = get_chrome_milestone() + content = content + chrome(chrome_milestone) + content = content + chromedriver(chrome_milestone) content += """ def _pin_browsers_extension_impl(_ctx): pin_browsers()