Skip to content

Commit 5ff5d7f

Browse files
committed
Fix formatting
1 parent def4e92 commit 5ff5d7f

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

rb/spec/tests.bzl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ BROWSERS = {
128128
"data": [],
129129
"deps": ["//rb/lib/selenium/webdriver:ie"],
130130
"tags": [
131-
"skip-remote",
131+
"skip-remote", # RBE is Linux-only.
132132
],
133133
"target_compatible_with": ["@platforms//os:windows"],
134134
"env": {
@@ -140,8 +140,8 @@ BROWSERS = {
140140
"data": [],
141141
"deps": ["//rb/lib/selenium/webdriver:safari"],
142142
"tags": [
143-
"exclusive-if-local",
144-
"skip-remote",
143+
"exclusive-if-local", # Safari cannot run in parallel.
144+
"skip-remote", # RBE is Linux-only.
145145
],
146146
"target_compatible_with": ["@platforms//os:macos"],
147147
"env": {
@@ -153,8 +153,8 @@ BROWSERS = {
153153
"data": [],
154154
"deps": ["//rb/lib/selenium/webdriver:safari"],
155155
"tags": [
156-
"exclusive-if-local",
157-
"skip-remote",
156+
"exclusive-if-local", # Safari cannot run in parallel.
157+
"skip-remote", # RBE is Linux-only.
158158
],
159159
"target_compatible_with": ["@platforms//os:macos"],
160160
"env": {
@@ -165,12 +165,15 @@ BROWSERS = {
165165
}
166166

167167
def rb_integration_test(name, srcs, deps = [], data = [], browsers = BROWSERS.keys(), tags = []):
168+
# Generate a library target that is used by //rb/spec:spec to expose all tests to //rb:lint.
168169
rb_library(
169170
name = name,
170171
srcs = srcs,
171172
visibility = ["//rb:__subpackages__"],
172173
)
174+
173175
for browser in browsers:
176+
# Generate a test target for local browser execution.
174177
rb_test(
175178
name = "{}-{}".format(name, browser),
176179
size = "large",
@@ -184,6 +187,8 @@ def rb_integration_test(name, srcs, deps = [], data = [], browsers = BROWSERS.ke
184187
visibility = ["//rb:__subpackages__"],
185188
target_compatible_with = BROWSERS[browser]["target_compatible_with"],
186189
)
190+
191+
# Generate a test target for remote browser execution (Grid).
187192
rb_test(
188193
name = "{}-{}-remote".format(name, browser),
189194
size = "large",
@@ -205,6 +210,8 @@ def rb_integration_test(name, srcs, deps = [], data = [], browsers = BROWSERS.ke
205210
visibility = ["//rb:__subpackages__"],
206211
target_compatible_with = BROWSERS[browser]["target_compatible_with"],
207212
)
213+
214+
# Generate a test target for bidi browser execution.
208215
rb_test(
209216
name = "{}-{}-bidi".format(name, browser),
210217
size = "large",
@@ -231,7 +238,7 @@ def rb_unit_test(name, srcs, deps, data = []):
231238
args = ["rb/spec/"],
232239
main = "@bundle//bin:rspec",
233240
data = data,
234-
tags = ["no-sandbox"],
241+
tags = ["no-sandbox"], # TODO: Do we need this?
235242
deps = ["//rb/spec/unit/selenium/webdriver:spec_helper"] + deps,
236243
visibility = ["//rb:__subpackages__"],
237244
)

scripts/pinned_browsers.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
import urllib3
1111
from packaging.version import parse
1212

13+
# Find the current stable versions of each browser we
14+
# support and the sha256 of these. That's useful for
15+
# updating `//common:repositories.bzl`
16+
1317
http = urllib3.PoolManager()
1418

1519

@@ -32,19 +36,23 @@ def get_chrome_milestone(channel=None):
3236
"GET", f"https://chromiumdash.appspot.com/fetch_releases?channel={channel}&num=1&platform=Mac,Linux"
3337
)
3438
all_versions = json.loads(r.data)
39+
# use the same milestone for all chrome releases, so pick the lowest
3540
milestone = min([version["milestone"] for version in all_versions if version["milestone"]])
3641
r = http.request(
3742
"GET", "https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json"
3843
)
3944
versions = json.loads(r.data)["versions"]
45+
4046
return sorted(
4147
filter(lambda v: v["version"].split(".")[0] == str(milestone), versions), key=lambda v: parse(v["version"])
4248
)[-1]
4349

4450

4551
def chromedriver(selected_version, workspace_prefix=""):
4652
content = ""
53+
4754
drivers = selected_version["downloads"]["chromedriver"]
55+
4856
linux = [d["url"] for d in drivers if d["platform"] == "linux64"][0]
4957
sha = calculate_hash(linux)
5058
content = content + """ http_archive(
@@ -91,8 +99,10 @@ def chromedriver(selected_version, workspace_prefix=""):
9199

92100
def chrome(selected_version, workspace_prefix=""):
93101
chrome_downloads = selected_version["downloads"]["chrome"]
102+
94103
linux = [d["url"] for d in chrome_downloads if d["platform"] == "linux64"][0]
95104
sha = calculate_hash(linux)
105+
96106
content = """
97107
http_archive(
98108
name = "linux_%schrome",
@@ -163,11 +173,13 @@ def edge():
163173
content = ""
164174
r = http.request("GET", "https://edgeupdates.microsoft.com/api/products")
165175
all_data = case_insensitive_json_loads(r.data)
176+
166177
linux = None
167178
linux_hash = None
168179
mac = None
169180
mac_hash = None
170181
version = None
182+
171183
for data in all_data:
172184
if not "Stable" == data.get("product"):
173185
continue
@@ -183,6 +195,7 @@ def edge():
183195
if "deb" == artifact["artifactname"]:
184196
linux = artifact["location"]
185197
linux_hash = artifact["hash"]
198+
186199
if mac and mac_hash:
187200
content += """
188201
pkg_archive(
@@ -238,7 +251,9 @@ def edgedriver():
238251
major_version = stable_version.split('.')[0]
239252
r = http.request("GET", f"https://msedgedriver.azureedge.net/LATEST_RELEASE_{major_version}_LINUX")
240253
linux_version = r.data.decode("utf-16").strip()
254+
241255
content = ""
256+
242257
linux = "https://msedgedriver.azureedge.net/%s/edgedriver_linux64.zip" % linux_version
243258
sha = calculate_hash(linux)
244259
content = content + """
@@ -286,6 +301,7 @@ def edgedriver():
286301

287302
def geckodriver():
288303
content = ""
304+
289305
r = http.request("GET", "https://api.github.com/repos/mozilla/geckodriver/releases/latest")
290306
for a in json.loads(r.data)["assets"]:
291307
if a["name"].endswith("-linux64.tar.gz"):
@@ -334,10 +350,12 @@ def geckodriver():
334350

335351
def firefox():
336352
firefox_versions = json.loads(firefox_version_data())
353+
337354
latest_firefox = firefox_versions["LATEST_FIREFOX_VERSION"]
338355
sha_linux = calculate_hash(firefox_linux(latest_firefox))
339356
sha_mac = calculate_hash(firefox_mac(latest_firefox))
340357
content = print_firefox(latest_firefox, "", sha_linux, sha_mac)
358+
341359
beta_firefox = firefox_versions["LATEST_FIREFOX_RELEASED_DEVEL_VERSION"]
342360
if latest_firefox != beta_firefox:
343361
sha_linux = calculate_hash(firefox_linux(beta_firefox))

0 commit comments

Comments
 (0)