Skip to content

Commit

Permalink
[java] Fixing distributed CDP test to send proper headers that pass r…
Browse files Browse the repository at this point in the history
…equirements introduced in commit 26cae68
  • Loading branch information
barancev committed Jul 17, 2020
1 parent e1f5d29 commit a489918
Showing 1 changed file with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import org.openqa.selenium.support.ui.FluentWait;
import org.openqa.selenium.testing.drivers.Browser;

import java.io.UncheckedIOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
Expand Down Expand Up @@ -108,7 +107,8 @@ public void ensureBasicFunctionality() throws MalformedURLException, Interrupted

HttpClient client = HttpClient.Factory.createDefault().createClient(new URL("http://localhost:" + routerPort));
new FluentWait<>(client).withTimeout(ofSeconds(10)).until(c -> {
HttpResponse res = c.execute(new HttpRequest(GET, "/status"));
HttpResponse res = c.execute(new HttpRequest(GET, "/status")
.addHeader("Content-Type", "application/json; charset=utf-8"));
if (!res.isSuccessful()) {
return false;
}
Expand Down Expand Up @@ -151,17 +151,7 @@ private String[] mergeArgs(String[] baseFlags, String... allTheArgs) {
}

private void waitUntilUp(int port) {
try {
HttpClient.Factory clientFactory = HttpClient.Factory.createDefault();
HttpClient client = clientFactory.createClient(new URL("http://localhost:" + port));

new FluentWait<>(client)
.ignoring(UncheckedIOException.class)
.withTimeout(ofSeconds(15))
.until(http -> http.execute(new HttpRequest(GET, "/status")).isSuccessful());
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
PortProber.waitForPortUp(port, 15, SECONDS);
}

private String getBrowserShortName() {
Expand Down

0 comments on commit a489918

Please sign in to comment.