Skip to content

Commit ffb0c7a

Browse files
committed
[java] Restoring ability to run remote browser tests in dev mode
1 parent ca79c16 commit ffb0c7a

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

java/client/test/org/openqa/selenium/build/InProject.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ public static Path findProjectRoot() {
6767
}
6868
}
6969

70-
// Find the rakefile first
7170
dir = Paths.get(".").toAbsolutePath();
7271
Path pwd = dir;
7372
while (dir != null && !dir.equals(dir.getParent())) {

java/client/test/org/openqa/selenium/testing/drivers/OutOfProcessSeleniumServer.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
package org.openqa.selenium.testing.drivers;
1919

2020
import org.openqa.selenium.Platform;
21+
import org.openqa.selenium.build.BazelBuild;
22+
import org.openqa.selenium.build.DevMode;
23+
import org.openqa.selenium.build.InProject;
2124
import org.openqa.selenium.net.NetworkUtils;
2225
import org.openqa.selenium.net.PortProber;
2326
import org.openqa.selenium.net.UrlChecker;
@@ -26,6 +29,7 @@
2629
import java.io.File;
2730
import java.net.MalformedURLException;
2831
import java.net.URL;
32+
import java.nio.file.Path;
2933
import java.util.logging.Logger;
3034
import java.util.stream.Stream;
3135

@@ -77,7 +81,7 @@ public OutOfProcessSeleniumServer start(String mode, String... extraFlags) {
7781
try {
7882
URL url = new URL(baseUrl + "/status");
7983
log.info("Waiting for server status on URL " + url);
80-
new UrlChecker().waitUntilAvailable(5, SECONDS, url);
84+
new UrlChecker().waitUntilAvailable(10, SECONDS, url);
8185
log.info("Server is ready");
8286
} catch (UrlChecker.TimeoutException e) {
8387
log.severe("Server failed to start: " + e.getMessage());
@@ -113,6 +117,19 @@ public void stop() {
113117
}
114118

115119
private String buildServerAndClasspath() {
120+
if (DevMode.isInDevMode()) {
121+
Path serverJar = InProject.locate(
122+
"bazel-bin/java/server/src/org/openqa/selenium/grid/selenium_server_deploy.jar");
123+
if (serverJar == null) {
124+
new BazelBuild().build("grid");
125+
serverJar = InProject.locate(
126+
"bazel-bin/java/server/src/org/openqa/selenium/grid/selenium_server_deploy.jar");
127+
}
128+
if (serverJar != null) {
129+
return serverJar.toAbsolutePath().toString();
130+
}
131+
}
132+
116133
if (System.getProperty("selenium.browser.remote.path") != null) {
117134
return System.getProperty("selenium.browser.remote.path");
118135
}

0 commit comments

Comments
 (0)