Skip to content

Commit f52bb20

Browse files
authored
Revert "[rb] Add support for beta chrome" (SeleniumHQ#15837)
Revert "[rb] Add support for beta chrome (SeleniumHQ#15417)" This reverts commit 1b0ab9b.
1 parent 1b0ab9b commit f52bb20

File tree

7 files changed

+59
-178
lines changed

7 files changed

+59
-178
lines changed

MODULE.bazel

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,17 +370,13 @@ use_repo(
370370
pin_browsers_extension = use_extension("//common:repositories.bzl", "pin_browsers_extension")
371371
use_repo(
372372
pin_browsers_extension,
373-
"linux_beta_chrome",
374-
"linux_beta_chromedriver",
375373
"linux_beta_firefox",
376374
"linux_chrome",
377375
"linux_chromedriver",
378376
"linux_edge",
379377
"linux_edgedriver",
380378
"linux_firefox",
381379
"linux_geckodriver",
382-
"mac_beta_chrome",
383-
"mac_beta_chromedriver",
384380
"mac_beta_firefox",
385381
"mac_chrome",
386382
"mac_chromedriver",

common/browsers.bzl

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -83,25 +83,3 @@ firefox_beta_data = select({
8383
],
8484
"//conditions:default": [],
8585
}) + geckodriver_data
86-
87-
chromedriver_beta_data = select({
88-
"@selenium//common:use_pinned_linux_chrome": [
89-
"@linux_beta_chromedriver//:chromedriver",
90-
],
91-
"@selenium//common:use_pinned_macos_chrome": [
92-
"@mac_beta_chromedriver//:chromedriver",
93-
],
94-
"@selenium//common:use_local_chromedriver": ["@selenium//common:chromedriver"],
95-
"//conditions:default": [],
96-
})
97-
98-
chrome_beta_data = select({
99-
"@selenium//common:use_pinned_linux_chrome": [
100-
"@linux_beta_chrome//:files",
101-
"@linux_beta_chrome//:chrome-linux64/chrome",
102-
],
103-
"@selenium//common:use_pinned_macos_chrome": [
104-
"@mac_beta_chrome//:Chrome.app",
105-
],
106-
"//conditions:default": [],
107-
}) + chromedriver_beta_data

common/repositories.bzl

Lines changed: 2 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ js_library(
218218
)
219219
""",
220220
)
221+
221222
http_archive(
222223
name = "mac_chrome",
223224
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(
239240
)
240241
""",
241242
)
243+
242244
http_archive(
243245
name = "linux_chromedriver",
244246
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"])
268270
269271
exports_files(["chromedriver"])
270272
271-
js_library(
272-
name = "chromedriver-js",
273-
data = ["chromedriver"],
274-
)
275-
""",
276-
)
277-
278-
http_archive(
279-
name = "linux_beta_chrome",
280-
url = "https://storage.googleapis.com/chrome-for-testing-public/138.0.7204.4/linux64/chrome-linux64.zip",
281-
sha256 = "d6ead5a796a19ccdebd603fb626eb66ebaafa82a051f03d3898cffed16d1d513",
282-
build_file_content = """
283-
load("@aspect_rules_js//js:defs.bzl", "js_library")
284-
package(default_visibility = ["//visibility:public"])
285-
286-
filegroup(
287-
name = "files",
288-
srcs = glob(["**/*"]),
289-
)
290-
291-
exports_files(["chrome-linux64/chrome"])
292-
293-
js_library(
294-
name = "chrome-js",
295-
data = [":files"],
296-
)
297-
""",
298-
)
299-
http_archive(
300-
name = "mac_beta_chrome",
301-
url = "https://storage.googleapis.com/chrome-for-testing-public/138.0.7204.4/mac-x64/chrome-mac-x64.zip",
302-
sha256 = "07c32ddffb7ad10038cde6187891a0ba7eaf65869af38d1709b0384697ccdbfa",
303-
strip_prefix = "chrome-mac-x64",
304-
patch_cmds = [
305-
"mv 'Google Chrome for Testing.app' Chrome.app",
306-
"mv 'Chrome.app/Contents/MacOS/Google Chrome for Testing' Chrome.app/Contents/MacOS/Chrome",
307-
],
308-
build_file_content = """
309-
load("@aspect_rules_js//js:defs.bzl", "js_library")
310-
package(default_visibility = ["//visibility:public"])
311-
312-
exports_files(["Chrome.app"])
313-
314-
js_library(
315-
name = "chrome-js",
316-
data = glob(["Chrome.app/**/*"]),
317-
)
318-
""",
319-
)
320-
http_archive(
321-
name = "linux_beta_chromedriver",
322-
url = "https://storage.googleapis.com/chrome-for-testing-public/138.0.7204.4/linux64/chromedriver-linux64.zip",
323-
sha256 = "187813f44358a8bfa42bd043eced9481687998ff0f691a46108555574836ad38",
324-
strip_prefix = "chromedriver-linux64",
325-
build_file_content = """
326-
load("@aspect_rules_js//js:defs.bzl", "js_library")
327-
package(default_visibility = ["//visibility:public"])
328-
329-
exports_files(["chromedriver"])
330-
331-
js_library(
332-
name = "chromedriver-js",
333-
data = ["chromedriver"],
334-
)
335-
""",
336-
)
337-
338-
http_archive(
339-
name = "mac_beta_chromedriver",
340-
url = "https://storage.googleapis.com/chrome-for-testing-public/138.0.7204.4/mac-x64/chromedriver-mac-x64.zip",
341-
sha256 = "9823d0e33d930761a9967dce0403a53dc5b2d3376af46cd3e7f10bc28bfe401d",
342-
strip_prefix = "chromedriver-mac-x64",
343-
build_file_content = """
344-
load("@aspect_rules_js//js:defs.bzl", "js_library")
345-
package(default_visibility = ["//visibility:public"])
346-
347-
exports_files(["chromedriver"])
348-
349273
js_library(
350274
name = "chromedriver-js",
351275
data = ["chromedriver"],

rb/spec/integration/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package(default_visibility = ["//rb/spec/integration:__subpackages__"])
22

33
BROWSERS = [
44
"chrome",
5-
"chrome-beta",
65
"edge",
76
"firefox",
87
"ie",

rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
44
rb_integration_test(
55
name = file[:-8],
66
srcs = [file],
7-
# No need to run in other browsers.
8-
browsers = [
9-
"chrome",
10-
"chrome-beta",
11-
],
12-
data = ["//common/extensions"],
7+
browsers = ["chrome"], # No need to run in other browsers.
138
)
149
for file in glob(["*_spec.rb"])
1510
]

rb/spec/tests.bzl

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ load("@rules_ruby//ruby:defs.bzl", "rb_library", "rb_test")
22
load(
33
"//common:browsers.bzl",
44
"COMMON_TAGS",
5-
"chrome_beta_data",
65
"chrome_data",
76
"edge_data",
87
"firefox_beta_data",
@@ -33,30 +32,6 @@ BROWSERS = {
3332
"//conditions:default": {},
3433
}),
3534
},
36-
"chrome-beta": {
37-
"data": chrome_beta_data,
38-
"deps": ["//rb/lib/selenium/webdriver:chrome"],
39-
"tags": [],
40-
"target_compatible_with": [],
41-
"env": {
42-
"WD_REMOTE_BROWSER": "chrome",
43-
"WD_SPEC_DRIVER": "chrome",
44-
"WD_BROWSER_VERSION": "beta",
45-
} | select({
46-
"@selenium//common:use_pinned_linux_chrome": {
47-
"CHROME_BINARY": "$(location @linux_beta_chrome//:chrome-linux64/chrome)",
48-
"CHROMEDRIVER_BINARY": "$(location @linux_beta_chromedriver//:chromedriver)",
49-
},
50-
"@selenium//common:use_pinned_macos_chrome": {
51-
"CHROME_BINARY": "$(location @mac_beta_chrome//:Chrome.app)/Contents/MacOS/Chrome",
52-
"CHROMEDRIVER_BINARY": "$(location @mac_beta_chromedriver//:chromedriver)",
53-
},
54-
"//conditions:default": {},
55-
}) | select({
56-
"@selenium//common:use_headless_browser": {"HEADLESS": "true"},
57-
"//conditions:default": {},
58-
}),
59-
},
6035
"edge": {
6136
"data": edge_data,
6237
"deps": ["//rb/lib/selenium/webdriver:edge"],

scripts/pinned_browsers.py

Lines changed: 56 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python
22

3+
import argparse
34
import hashlib
45
import json
56
import os
@@ -25,7 +26,14 @@ def calculate_hash(url):
2526
return h.hexdigest()
2627

2728

28-
def get_chrome_info_for_channel(channel):
29+
def get_chrome_milestone():
30+
parser = argparse.ArgumentParser()
31+
parser.add_argument(
32+
"--chrome_channel", default="Stable", help="Set the Chrome channel"
33+
)
34+
args = parser.parse_args()
35+
channel = args.chrome_channel
36+
2937
r = http.request(
3038
"GET",
3139
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):
4755
)[-1]
4856

4957

50-
def chromedriver(selected_version, workspace_prefix=""):
58+
def chromedriver(selected_version):
5159
content = ""
5260

5361
drivers = selected_version["downloads"]["chromedriver"]
5462

55-
url = [d["url"] for d in drivers if d["platform"] == "linux64"][0]
56-
sha = calculate_hash(url)
63+
linux = [d["url"] for d in drivers if d["platform"] == "linux64"][0]
64+
sha = calculate_hash(linux)
5765

58-
content += f""" http_archive(
59-
name = "linux_{workspace_prefix}chromedriver",
60-
url = "{url}",
61-
sha256 = "{sha}",
66+
content = (
67+
content
68+
+ """ http_archive(
69+
name = "linux_chromedriver",
70+
url = "%s",
71+
sha256 = "%s",
6272
strip_prefix = "chromedriver-linux64",
6373
build_file_content = \"\"\"
6474
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -73,15 +83,18 @@ def chromedriver(selected_version, workspace_prefix=""):
7383
\"\"\",
7484
)
7585
"""
86+
% (linux, sha)
87+
)
7688

77-
url = [d["url"] for d in drivers if d["platform"] == "mac-x64"][0]
78-
sha = calculate_hash(url)
79-
80-
content += f"""
89+
mac = [d["url"] for d in drivers if d["platform"] == "mac-x64"][0]
90+
sha = calculate_hash(mac)
91+
content = (
92+
content
93+
+ """
8194
http_archive(
82-
name = "mac_{workspace_prefix}chromedriver",
83-
url = "{url}",
84-
sha256 = "{sha}",
95+
name = "mac_chromedriver",
96+
url = "%s",
97+
sha256 = "%s",
8598
strip_prefix = "chromedriver-mac-x64",
8699
build_file_content = \"\"\"
87100
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -96,22 +109,23 @@ def chromedriver(selected_version, workspace_prefix=""):
96109
\"\"\",
97110
)
98111
"""
112+
% (mac, sha)
113+
)
99114

100115
return content
101116

102117

103-
def chrome(selected_version, workspace_prefix=""):
104-
content = ""
118+
def chrome(selected_version):
105119
chrome_downloads = selected_version["downloads"]["chrome"]
106120

107-
url = [d["url"] for d in chrome_downloads if d["platform"] == "linux64"][0]
108-
sha = calculate_hash(url)
121+
linux = [d["url"] for d in chrome_downloads if d["platform"] == "linux64"][0]
122+
sha = calculate_hash(linux)
109123

110-
content += f"""
124+
content = """
111125
http_archive(
112-
name = "linux_{workspace_prefix}chrome",
113-
url = "{url}",
114-
sha256 = "{sha}",
126+
name = "linux_chrome",
127+
url = "%s",
128+
sha256 = "%s",
115129
build_file_content = \"\"\"
116130
load("@aspect_rules_js//js:defs.bzl", "js_library")
117131
package(default_visibility = ["//visibility:public"])
@@ -129,15 +143,19 @@ def chrome(selected_version, workspace_prefix=""):
129143
)
130144
\"\"\",
131145
)
132-
"""
133146
134-
url = [d["url"] for d in chrome_downloads if d["platform"] == "mac-x64"][0]
135-
sha = calculate_hash(url) # Calculate SHA for Mac chrome
147+
""" % (
148+
linux,
149+
sha,
150+
)
151+
152+
mac = [d["url"] for d in chrome_downloads if d["platform"] == "mac-x64"][0]
153+
sha = calculate_hash(mac)
136154

137-
content += f""" http_archive(
138-
name = "mac_{workspace_prefix}chrome",
139-
url = "{url}",
140-
sha256 = "{sha}",
155+
content += """ http_archive(
156+
name = "mac_chrome",
157+
url = "%s",
158+
sha256 = "%s",
141159
strip_prefix = "chrome-mac-x64",
142160
patch_cmds = [
143161
"mv 'Google Chrome for Testing.app' Chrome.app",
@@ -155,7 +173,11 @@ def chrome(selected_version, workspace_prefix=""):
155173
)
156174
\"\"\",
157175
)
158-
"""
176+
177+
""" % (
178+
mac,
179+
sha,
180+
)
159181

160182
return content
161183

@@ -500,17 +522,9 @@ def pin_browsers():
500522
content = content + geckodriver()
501523
content = content + edge()
502524
content = content + edgedriver()
503-
504-
# Stable Chrome
505-
stable_chrome_info = get_chrome_info_for_channel(channel="Stable")
506-
content = content + chrome(stable_chrome_info, workspace_prefix="")
507-
content = content + chromedriver(stable_chrome_info, workspace_prefix="")
508-
509-
# Beta Chrome
510-
beta_chrome_info = get_chrome_info_for_channel(channel="Beta")
511-
content = content + chrome(beta_chrome_info, workspace_prefix="beta_")
512-
content = content + chromedriver(beta_chrome_info, workspace_prefix="beta_")
513-
525+
chrome_milestone = get_chrome_milestone()
526+
content = content + chrome(chrome_milestone)
527+
content = content + chromedriver(chrome_milestone)
514528
content += """
515529
def _pin_browsers_extension_impl(_ctx):
516530
pin_browsers()

0 commit comments

Comments
 (0)