Skip to content

Commit 8e2b3e1

Browse files
committed
[bazel] Get large grid tests passing in bazel
1 parent 4c2ab02 commit 8e2b3e1

File tree

2 files changed

+36
-10
lines changed

2 files changed

+36
-10
lines changed

java/test/org/openqa/selenium/grid/router/BUILD.bazel

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ load("//java/src/org/openqa/selenium/devtools:versions.bzl", "CDP_DEPS")
55
LARGE_TESTS = [
66
"DistributedCdpTest.java",
77
"NewSessionCreationTest.java",
8-
"RemoteWebDriverBiDiTest.java",
98
"RemoteWebDriverDownloadTest.java",
109
"StressTest.java",
1110
]
1211

12+
FIREFOX_ONLY_LARGE_TESTS = [
13+
"RemoteWebDriverBiDiTest.java",
14+
]
15+
1316
java_library(
1417
name = "support",
1518
testonly = True,
@@ -57,27 +60,45 @@ java_selenium_test_suite(
5760
"//java/src/org/openqa/selenium/json",
5861
"//java/src/org/openqa/selenium/remote",
5962
"//java/src/org/openqa/selenium/support",
60-
"//java/test/org/openqa/selenium/environment",
61-
"//java/test/org/openqa/selenium/remote/tracing:tracing-support",
62-
"//java/test/org/openqa/selenium/testing:annotations",
63-
"//java/test/org/openqa/selenium/testing:test-base",
6463
"//java/src/org/openqa/selenium/grid",
6564
"//java/src/org/openqa/selenium/grid/config",
6665
"//java/src/org/openqa/selenium/grid/distributor",
66+
"//java/test/org/openqa/selenium/environment",
6767
"//java/test/org/openqa/selenium/grid/testing",
68+
"//java/test/org/openqa/selenium/remote/tracing:tracing-support",
69+
"//java/test/org/openqa/selenium/testing:annotations",
70+
"//java/test/org/openqa/selenium/testing:test-base",
6871
artifact("com.google.guava:guava"),
6972
artifact("org.junit.jupiter:junit-jupiter-api"),
7073
artifact("org.junit.jupiter:junit-jupiter-params"),
7174
artifact("org.assertj:assertj-core"),
7275
] + CDP_DEPS + JUNIT5_DEPS,
7376
)
7477

78+
java_selenium_test_suite(
79+
name = "firefox-only-large-tests",
80+
size = "large",
81+
srcs = FIREFOX_ONLY_LARGE_TESTS,
82+
browsers = ["firefox"],
83+
deps = [
84+
":support",
85+
"//java/src/org/openqa/selenium/firefox",
86+
"//java/src/org/openqa/selenium/grid/config",
87+
"//java/src/org/openqa/selenium/remote",
88+
"//java/test/org/openqa/selenium/environment",
89+
"//java/test/org/openqa/selenium/testing:annotations",
90+
"//java/test/org/openqa/selenium/testing:test-base",
91+
artifact("org.junit.jupiter:junit-jupiter-api"),
92+
artifact("org.assertj:assertj-core"),
93+
] + CDP_DEPS + JUNIT5_DEPS,
94+
)
95+
7596
java_test_suite(
7697
name = "medium-tests",
7798
size = "medium",
7899
srcs = glob(
79100
["*Test.java"],
80-
exclude = LARGE_TESTS,
101+
exclude = LARGE_TESTS + FIREFOX_ONLY_LARGE_TESTS,
81102
),
82103
tags = [
83104
"requires-network",

java/test/org/openqa/selenium/grid/router/RemoteWebDriverBiDiTest.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ void ensureBiDiSessionCreation() {
6363
+ "driver-implementation = "
6464
+ browser.displayName())));
6565

66-
FirefoxOptions options = new FirefoxOptions();
66+
FirefoxOptions options = createFirefoxOptions();
6767
// Enable BiDi
6868
options.setCapability("webSocketUrl", true);
69+
options.merge(Browser.FIREFOX.getCapabilities());
6970

7071
WebDriver driver = new RemoteWebDriver(deployment.getServer().getUrl(), options);
7172
driver = new Augmenter().augment(driver);
@@ -93,7 +94,7 @@ void canListenToLogs() throws ExecutionException, InterruptedException, TimeoutE
9394
+ "driver-implementation = "
9495
+ browser.displayName())));
9596

96-
FirefoxOptions options = new FirefoxOptions();
97+
FirefoxOptions options = createFirefoxOptions();
9798
// Enable BiDi
9899
options.setCapability("webSocketUrl", true);
99100

@@ -124,7 +125,7 @@ void canListenToLogs() throws ExecutionException, InterruptedException, TimeoutE
124125
}
125126

126127
@Test
127-
void canNavigateToUrl() throws ExecutionException, InterruptedException, TimeoutException {
128+
void canNavigateToUrl() {
128129
Browser browser = Browser.FIREFOX;
129130

130131
Deployment deployment =
@@ -137,7 +138,7 @@ void canNavigateToUrl() throws ExecutionException, InterruptedException, Timeout
137138
+ "driver-implementation = "
138139
+ browser.displayName())));
139140

140-
FirefoxOptions options = new FirefoxOptions();
141+
FirefoxOptions options = createFirefoxOptions();
141142
// Enable BiDi
142143
options.setCapability("webSocketUrl", true);
143144

@@ -156,4 +157,8 @@ void canNavigateToUrl() throws ExecutionException, InterruptedException, Timeout
156157
assertThat(info.getNavigationId()).isNull();
157158
assertThat(info.getUrl()).contains("/bidi/logEntryAdded.html");
158159
}
160+
161+
private FirefoxOptions createFirefoxOptions() {
162+
return (FirefoxOptions) Browser.FIREFOX.getCapabilities();
163+
}
159164
}

0 commit comments

Comments
 (0)