Skip to content

Commit baef94b

Browse files
committed
[build] update bazel test targets and remove ruby tests from skipped files
1 parent 78c3a21 commit baef94b

File tree

10 files changed

+158
-87
lines changed

10 files changed

+158
-87
lines changed

.skipped-tests

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,4 @@
2222
-//javascript/selenium-webdriver:test-builder-test.js-chrome
2323
-//javascript/selenium-webdriver:test-chrome-devtools-test.js-chrome
2424
-//javascript/selenium-webdriver:test-firefox-options-test.js-firefox
25-
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome
26-
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome-bidi
27-
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome-remote
28-
-//rb/spec/integration/selenium/webdriver/edge:service-edge
29-
-//rb/spec/integration/selenium/webdriver/edge:service-edge-bidi
30-
-//rb/spec/integration/selenium/webdriver/edge:service-edge-remote
31-
-//rb/spec/integration/selenium/webdriver/firefox:driver-firefox-beta-bidi
32-
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox
33-
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta
34-
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta-bidi
35-
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta-remote
36-
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-bidi
37-
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-remote
38-
-//rb/spec/integration/selenium/webdriver/remote:driver-chrome-remote
39-
-//rb/spec/integration/selenium/webdriver/remote:driver-edge-remote
40-
-//rb/spec/integration/selenium/webdriver/remote:driver-firefox-beta-remote
41-
-//rb/spec/integration/selenium/webdriver/remote:driver-firefox-remote
42-
-//rb/spec/integration/selenium/webdriver/remote:element-chrome-remote
43-
-//rb/spec/integration/selenium/webdriver/remote:element-edge-remote
44-
-//rb/spec/integration/selenium/webdriver/remote:element-firefox-beta-remote
45-
-//rb/spec/integration/selenium/webdriver/remote:element-firefox-remote
46-
-//rb/spec/integration/selenium/webdriver:element-chrome
47-
-//rb/spec/integration/selenium/webdriver:element-chrome-bidi
48-
-//rb/spec/integration/selenium/webdriver:element-chrome-remote
49-
-//rb/spec/integration/selenium/webdriver:action_builder-firefox-beta-remote
5025
-//rb:lint

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,31 @@ rb_library(
4242
"driver_spec.rb",
4343
"devtools_spec.rb",
4444
"element_spec.rb",
45+
"network_spec.rb",
4546
],
4647
)
4748
]
4849

50+
rb_integration_test(
51+
name = "network",
52+
srcs = ["network_spec.rb"],
53+
tags = [
54+
"exclusive-if-local",
55+
"bidi-only",
56+
],
57+
deps = [
58+
"//rb/lib/selenium/devtools",
59+
"//rb/lib/selenium/webdriver:bidi",
60+
],
61+
)
62+
4963
rb_integration_test(
5064
name = "bidi",
5165
srcs = ["bidi_spec.rb"],
52-
tags = ["exclusive-if-local"],
66+
tags = [
67+
"exclusive-if-local",
68+
"bidi-only",
69+
],
5370
deps = [
5471
"//rb/lib/selenium/devtools",
5572
"//rb/lib/selenium/webdriver:bidi",

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
44
rb_integration_test(
55
name = file[:-8],
66
srcs = [file],
7-
tags = ["exclusive-if-local"],
7+
tags = [
8+
"exclusive-if-local",
9+
"bidi-only",
10+
],
811
deps = [
912
"//rb/lib/selenium/devtools",
1013
"//rb/lib/selenium/webdriver:bidi",

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,20 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
44
rb_integration_test(
55
name = file[:-8],
66
srcs = [file],
7-
browsers = ["chrome"], # No need to run in other browsers.
7+
browsers = ["chrome"],
8+
)
9+
for file in glob(
10+
["*_spec.rb"],
11+
exclude = ["service_spec.rb"],
812
)
9-
for file in glob(["*_spec.rb"])
1013
]
14+
15+
rb_integration_test(
16+
name = "service",
17+
srcs = ["service_spec.rb"],
18+
browsers = ["chrome"],
19+
tags = [
20+
"no-grid",
21+
"skip-rbe", # RBE needs internet
22+
],
23+
)

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,20 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
44
rb_integration_test(
55
name = file[:-8],
66
srcs = [file],
7-
browsers = ["edge"], # No need to run in other browsers.
7+
browsers = ["edge"],
8+
)
9+
for file in glob(
10+
["*_spec.rb"],
11+
exclude = ["service_spec.rb"],
812
)
9-
for file in glob(["*_spec.rb"])
1013
]
14+
15+
rb_integration_test(
16+
name = "service",
17+
srcs = ["service_spec.rb"],
18+
browsers = ["edge"],
19+
tags = [
20+
"no-grid",
21+
"skip-rbe", # RBE needs internet
22+
],
23+
)

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,21 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
1111
],
1212
data = ["//common/extensions"],
1313
)
14-
for file in glob(["*_spec.rb"])
14+
for file in glob(
15+
["*_spec.rb"],
16+
exclude = ["service_spec.rb"],
17+
)
1518
]
19+
20+
rb_integration_test(
21+
name = "service",
22+
srcs = ["service_spec.rb"],
23+
browsers = [
24+
"firefox",
25+
"firefox-beta",
26+
],
27+
tags = [
28+
"no-grid",
29+
"skip-rbe", # RBE needs internet
30+
],
31+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
load("//rb/spec:tests.bzl", "rb_integration_test")
2+
3+
rb_integration_test(
4+
name = "service",
5+
srcs = ["service_spec.rb"],
6+
browsers = ["ie"],
7+
tags = ["no-grid"],
8+
)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
44
rb_integration_test(
55
name = file[:-8],
66
srcs = [file],
7+
tags = ["grid-only"],
78
)
89
for file in glob(["*_spec.rb"])
910
]

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,18 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
1010
"safari-preview",
1111
],
1212
)
13-
for file in glob(["*_spec.rb"])
13+
for file in glob(
14+
["*_spec.rb"],
15+
exclude = ["service_spec.rb"],
16+
)
1417
]
18+
19+
rb_integration_test(
20+
name = "service",
21+
srcs = ["service_spec.rb"],
22+
browsers = [
23+
"safari",
24+
"safari-preview",
25+
],
26+
tags = ["no-grid"],
27+
)

rb/spec/tests.bzl

Lines changed: 66 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ BROWSERS = {
1414
"deps": ["//rb/lib/selenium/webdriver:chrome"],
1515
"tags": [],
1616
"target_compatible_with": [],
17+
"bidi_supported": True,
18+
"devtools_supported": True,
1719
"env": {
1820
"WD_REMOTE_BROWSER": "chrome",
1921
"WD_SPEC_DRIVER": "chrome",
@@ -37,6 +39,8 @@ BROWSERS = {
3739
"deps": ["//rb/lib/selenium/webdriver:edge"],
3840
"tags": [],
3941
"target_compatible_with": [],
42+
"bidi_supported": True,
43+
"devtools_supported": True,
4044
"env": {
4145
"WD_REMOTE_BROWSER": "edge",
4246
"WD_SPEC_DRIVER": "edge",
@@ -60,6 +64,7 @@ BROWSERS = {
6064
"deps": ["//rb/lib/selenium/webdriver:firefox"],
6165
"tags": [],
6266
"target_compatible_with": [],
67+
"bidi_supported": True,
6368
"env": {
6469
"WD_REMOTE_BROWSER": "firefox",
6570
"WD_SPEC_DRIVER": "firefox",
@@ -83,6 +88,7 @@ BROWSERS = {
8388
"deps": ["//rb/lib/selenium/webdriver:firefox"],
8489
"tags": [],
8590
"target_compatible_with": [],
91+
"bidi_supported": True,
8692
"env": {
8793
"WD_REMOTE_BROWSER": "firefox",
8894
"WD_SPEC_DRIVER": "firefox",
@@ -149,63 +155,69 @@ def rb_integration_test(name, srcs, deps = [], data = [], browsers = BROWSERS.ke
149155
visibility = ["//rb:__subpackages__"],
150156
)
151157

158+
VARIANTS = [
159+
{"suffix": "", "remote": False, "bidi": False},
160+
{"suffix": "-remote", "remote": True, "bidi": False},
161+
{"suffix": "-bidi", "remote": False, "bidi": True},
162+
{"suffix": "-bidi-remote", "remote": True, "bidi": True},
163+
]
164+
152165
for browser in browsers:
153-
# Generate a test target for local browser execution.
154-
rb_test(
155-
name = "{}-{}".format(name, browser),
156-
size = "large",
157-
srcs = srcs,
158-
args = ["rb/spec/"],
159-
data = BROWSERS[browser]["data"] + data + ["//common/src/web"],
160-
env = BROWSERS[browser]["env"],
161-
main = "@bundle//bin:rspec",
162-
tags = COMMON_TAGS + BROWSERS[browser]["tags"] + tags + [browser],
163-
deps = ["//rb/spec/integration/selenium/webdriver:spec_helper"] + BROWSERS[browser]["deps"] + deps,
164-
visibility = ["//rb:__subpackages__"],
165-
target_compatible_with = BROWSERS[browser]["target_compatible_with"],
166-
)
166+
config = BROWSERS[browser]
167+
for variant in VARIANTS:
168+
bidi_not_supported = variant["bidi"] and not config.get("bidi_supported", False)
169+
devtools_not_supported = "needs-devtools" in tags and not config.get("devtools_supported", False)
170+
excluded_by_bidi = "bidi-only" in tags and not variant["bidi"]
171+
excluded_by_grid = "remote-only" in tags and not variant["remote"]
172+
excluded_by_local = "no-grid" in tags and variant["remote"]
167173

168-
# Generate a test target for remote browser execution (Grid).
169-
rb_test(
170-
name = "{}-{}-remote".format(name, browser),
171-
size = "large",
172-
srcs = srcs,
173-
args = ["rb/spec/"],
174-
data = BROWSERS[browser]["data"] + data + [
175-
"//common/src/web",
176-
"//java/src/org/openqa/selenium/grid:selenium_server_deploy.jar",
177-
"//rb/spec:java-location",
178-
"@bazel_tools//tools/jdk:current_java_runtime",
179-
],
180-
env = BROWSERS[browser]["env"] | {
181-
"WD_BAZEL_JAVA_LOCATION": "$(rootpath //rb/spec:java-location)",
182-
"WD_SPEC_DRIVER": "remote",
183-
},
184-
main = "@bundle//bin:rspec",
185-
tags = COMMON_TAGS + BROWSERS[browser]["tags"] + tags + ["{}-remote".format(browser)],
186-
deps = ["//rb/spec/integration/selenium/webdriver:spec_helper"] + BROWSERS[browser]["deps"] + deps,
187-
visibility = ["//rb:__subpackages__"],
188-
target_compatible_with = BROWSERS[browser]["target_compatible_with"],
189-
)
174+
if bidi_not_supported or devtools_not_supported or excluded_by_bidi or excluded_by_grid or excluded_by_local:
175+
continue
176+
177+
target_name = "{}-{}{}".format(name, browser, variant["suffix"])
178+
179+
env = config["env"]
180+
if variant["remote"]:
181+
env = env | {
182+
"WD_SPEC_DRIVER": "remote",
183+
"WD_BAZEL_JAVA_LOCATION": "$(rootpath //rb/spec:java-location)",
184+
}
185+
if variant["bidi"]:
186+
env = env | {
187+
"WEBDRIVER_BIDI": "true"
188+
}
189+
190+
test_data = config["data"] + data + ["//common/src/web"]
191+
if variant["remote"]:
192+
test_data += [
193+
"//java/src/org/openqa/selenium/grid:selenium_server_deploy.jar",
194+
"//rb/spec:java-location",
195+
"@bazel_tools//tools/jdk:current_java_runtime",
196+
]
197+
198+
test_deps = [
199+
"//rb/spec/integration/selenium/webdriver:spec_helper"
200+
] + config["deps"] + deps
201+
if variant["bidi"]:
202+
test_deps.append("//rb/lib/selenium/webdriver:bidi")
203+
204+
test_tags = COMMON_TAGS + config["tags"] + tags + [browser]
205+
if variant["bidi"]:
206+
test_tags.append("bidi")
190207

191-
# Generate a test target for bidi browser execution.
192-
rb_test(
193-
name = "{}-{}-bidi".format(name, browser),
194-
size = "large",
195-
srcs = srcs,
196-
args = ["rb/spec/"],
197-
data = BROWSERS[browser]["data"] + data + ["//common/src/web"],
198-
env = BROWSERS[browser]["env"] | {"WEBDRIVER_BIDI": "true"},
199-
main = "@bundle//bin:rspec",
200-
tags = COMMON_TAGS + BROWSERS[browser]["tags"] + tags + ["{}-bidi".format(browser)],
201-
deps = depset(
202-
["//rb/spec/integration/selenium/webdriver:spec_helper", "//rb/lib/selenium/webdriver:bidi"] +
203-
BROWSERS[browser]["deps"] +
204-
deps,
205-
),
206-
visibility = ["//rb:__subpackages__"],
207-
target_compatible_with = BROWSERS[browser]["target_compatible_with"],
208-
)
208+
rb_test(
209+
name = target_name,
210+
size = "large",
211+
srcs = srcs,
212+
args = ["rb/spec/integration"],
213+
data = test_data,
214+
env = env,
215+
main = "@bundle//bin:rspec",
216+
tags = test_tags,
217+
deps = depset(test_deps),
218+
visibility = ["//rb:__subpackages__"],
219+
target_compatible_with = config["target_compatible_with"],
220+
)
209221

210222
def rb_unit_test(name, srcs, deps, data = []):
211223
rb_test(

0 commit comments

Comments
 (0)