Skip to content

Commit 18164af

Browse files
committed
[java] Remote selenium-remote tag from test targets
If it's there, then `bazel query "attr(tags, 'remote', tests(//java/...))` would also return non-remote targets. This happens because Bazel queries for partial match in attribute ("selenium-remote" contains "remote").
1 parent c2944a1 commit 18164af

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.github/workflows/ci-java.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ jobs:
7474
bazel query "attr(tags, ${{ matrix.browser }}, tests(//java/...)) except attr(tags, 'rc|remote', tests(//java/...))" |
7575
xargs bazel test --flaky_test_attempts 3
7676
77-
server-tests:
78-
name: Server Tests
77+
remote-tests:
78+
name: Remote Tests
7979
needs: small-tests
8080
uses: ./.github/workflows/bazel.yml
8181
strategy:
@@ -91,10 +91,10 @@ jobs:
9191
- browser: firefox
9292
browser-version: latest-devedition
9393
with:
94-
name: Server Tests (${{ matrix.browser }}, ${{ matrix.browser-version }})
94+
name: Remote Tests (${{ matrix.browser }}, ${{ matrix.browser-version }})
9595
browser: ${{ matrix.browser }}
9696
browser-version: ${{ matrix.browser-version }}
97-
cache-key: java-${{ matrix.browser }}-server-tests
97+
cache-key: java-${{ matrix.browser }}-remote-tests
9898
run: >
9999
bazel query "attr(tags, ${{ matrix.browser }}, tests(//java/...)) intersect attr(tags, 'remote', tests(//java/...))" |
100100
xargs bazel test --flaky_test_attempts 3

java/private/selenium_test.bzl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ def selenium_test(name, test_class, size = "medium", browsers = BROWSERS.keys(),
6868
jvm_flags = kwargs["jvm_flags"] if "jvm_flags" in kwargs else []
6969
tags = kwargs["tags"] if "tags" in kwargs else []
7070

71+
remote = False
72+
if "selenium-remote" in tags:
73+
tags.remove("selenium-remote")
74+
remote = True
75+
7176
stripped_args = dict(**kwargs)
7277
stripped_args.pop("data", None)
7378
stripped_args.pop("jvm_flags", None)
@@ -98,7 +103,7 @@ def selenium_test(name, test_class, size = "medium", browsers = BROWSERS.keys(),
98103
)
99104
all_tests.append(":%s" % test)
100105

101-
if "selenium-remote" in tags:
106+
if remote:
102107
java_junit5_test(
103108
name = "%s-remote" % test,
104109
test_class = test_class,
@@ -108,7 +113,7 @@ def selenium_test(name, test_class, size = "medium", browsers = BROWSERS.keys(),
108113
"-Dselenium.browser.remote.path=$(location @selenium//java/src/org/openqa/selenium/grid:selenium_server_deploy.jar)",
109114
],
110115
# No need to lint remote tests as the code for non-remote is the same and they get linted
111-
tags = BROWSERS[browser]["tags"] + tags + ["remote", "no-lint"],
116+
tags = BROWSERS[browser]["tags"] + tags + ["remote1", "no-lint"],
112117
data = BROWSERS[browser]["data"] + data + [
113118
"@selenium//java/src/org/openqa/selenium/grid:selenium_server_deploy.jar",
114119
],

0 commit comments

Comments
 (0)