Skip to content

Commit 6fd3b9b

Browse files
committed
[cdp] Make sure that CDP commands work over the Grid
1 parent a4822a3 commit 6fd3b9b

File tree

7 files changed

+34
-10
lines changed

7 files changed

+34
-10
lines changed

java/client/test/org/openqa/selenium/devtools/BUILD.bazel

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ java_selenium_test_suite(
1010
"firefox",
1111
"edge",
1212
],
13+
tags = [
14+
"selenium-remote",
15+
],
1316
deps = [
1417
":test-lib",
1518
"//java/client/src/org/openqa/selenium/devtools",

java/client/test/org/openqa/selenium/devtools/CdpFacadeTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
import org.openqa.selenium.remote.http.HttpResponse;
2929
import org.openqa.selenium.remote.http.Route;
3030
import org.openqa.selenium.support.devtools.NetworkInterceptor;
31+
import org.openqa.selenium.testing.Ignore;
32+
import org.openqa.selenium.testing.NotYetImplemented;
33+
import org.openqa.selenium.testing.drivers.Browser;
3134

3235
import static org.assertj.core.api.Assertions.assertThat;
3336
import static org.assertj.core.api.Assumptions.assumeThat;
@@ -50,6 +53,7 @@ public static void stopServer() {
5053
}
5154

5255
@Test
56+
@NotYetImplemented(value = Browser.FIREFOX, reason = "Network interception not yet supported")
5357
public void networkInterceptorAndAuthHandlersDoNotFight() {
5458
assumeThat(driver).isInstanceOf(HasAuthentication.class);
5559

@@ -81,6 +85,7 @@ public void networkInterceptorAndAuthHandlersDoNotFight() {
8185
}
8286

8387
@Test
88+
@NotYetImplemented(value = Browser.FIREFOX, reason = "Network interception not yet supported")
8489
public void canAuthenticate() {
8590
assumeThat(driver).isInstanceOf(HasAuthentication.class);
8691

java/client/test/org/openqa/selenium/devtools/ChangeUserAgentTest.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,23 @@
1717

1818
package org.openqa.selenium.devtools;
1919

20-
import static org.assertj.core.api.Assertions.assertThat;
21-
2220
import org.junit.Test;
2321
import org.openqa.selenium.By;
2422
import org.openqa.selenium.JavascriptExecutor;
2523
import org.openqa.selenium.devtools.idealized.Network;
24+
import org.openqa.selenium.testing.NotYetImplemented;
25+
import org.openqa.selenium.testing.drivers.Browser;
2626

2727
import java.util.Map;
28-
import java.util.concurrent.ExecutionException;
29-
import java.util.concurrent.TimeoutException;
3028
import java.util.stream.Collectors;
3129

30+
import static org.assertj.core.api.Assertions.assertThat;
31+
3232
public class ChangeUserAgentTest extends DevToolsTestBase {
3333

3434
@Test
35-
public void canChangeUserAgent() throws InterruptedException, ExecutionException, TimeoutException {
35+
@NotYetImplemented(value = Browser.FIREFOX, reason = "Network interception not yet supported")
36+
public void canChangeUserAgent() {
3637
devTools.getDomains().network().setUserAgent(
3738
new Network.UserAgent("Camembert 1.0")
3839
.platform("FreeBSD").acceptLanguage("da, en-gb, *"));

java/client/test/org/openqa/selenium/devtools/ConsoleEventsTest.java

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import org.openqa.selenium.By;
2424
import org.openqa.selenium.devtools.events.ConsoleEvent;
2525
import org.openqa.selenium.environment.webserver.Page;
26+
import org.openqa.selenium.testing.NotYetImplemented;
27+
import org.openqa.selenium.testing.drivers.Browser;
2628

2729
import java.util.concurrent.CompletableFuture;
2830
import java.util.concurrent.ExecutionException;
@@ -32,6 +34,7 @@
3234
public class ConsoleEventsTest extends DevToolsTestBase {
3335

3436
@Test
37+
@NotYetImplemented(value = Browser.FIREFOX, reason = "`Log` domain not yet supported")
3538
public void canWatchConsoleEvents() throws InterruptedException, ExecutionException, TimeoutException {
3639
String page = appServer.create(
3740
new Page()

java/client/test/org/openqa/selenium/devtools/JavascriptExceptionsTest.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,24 @@
1717

1818
package org.openqa.selenium.devtools;
1919

20-
import static org.assertj.core.api.Assertions.assertThat;
21-
2220
import org.junit.Test;
2321
import org.openqa.selenium.By;
2422
import org.openqa.selenium.JavascriptException;
2523
import org.openqa.selenium.environment.webserver.Page;
24+
import org.openqa.selenium.testing.NotYetImplemented;
25+
import org.openqa.selenium.testing.drivers.Browser;
2626

2727
import java.util.concurrent.CompletableFuture;
2828
import java.util.concurrent.ExecutionException;
2929
import java.util.concurrent.TimeUnit;
3030
import java.util.concurrent.TimeoutException;
3131

32+
import static org.assertj.core.api.Assertions.assertThat;
33+
3234
public class JavascriptExceptionsTest extends DevToolsTestBase {
3335

3436
@Test
37+
@NotYetImplemented(value = Browser.FIREFOX, reason = "`Log` domain not yet supported")
3538
public void canWatchJavascriptExceptions() throws InterruptedException, ExecutionException, TimeoutException {
3639
String page = appServer.create(
3740
new Page()

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

+10-2
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,17 @@ public OutOfProcessSeleniumServer start(String mode, String... extraFlags) {
6666
String localAddress = new NetworkUtils().getPrivateLocalAddress();
6767
baseUrl = String.format("http://%s:%d", localAddress, port);
6868

69-
command = new CommandLine("java", Stream.concat(
69+
// Make sure we inherit system properties.
70+
Stream<String> javaFlags = System.getProperties().entrySet().stream()
71+
.filter(entry -> {
72+
String key = String.valueOf(entry.getKey());
73+
return key.startsWith("selenium") || key.startsWith("webdriver");
74+
})
75+
.map(entry -> "-D" + entry.getKey() + "=" + entry.getValue());
76+
77+
command = new CommandLine("java", Stream.concat(javaFlags, Stream.concat(
7078
Stream.of("-jar", serverJar, mode, "--port", String.valueOf(port)),
71-
Stream.of(extraFlags)).toArray(String[]::new));
79+
Stream.of(extraFlags))).toArray(String[]::new));
7280
if (Platform.getCurrent().is(Platform.WINDOWS)) {
7381
File workingDir = findBinRoot(new File(".").getAbsoluteFile());
7482
command.setWorkingDirectory(workingDir.getAbsolutePath());

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import org.openqa.selenium.Capabilities;
2121
import org.openqa.selenium.WebDriver;
22+
import org.openqa.selenium.remote.Augmenter;
2223
import org.openqa.selenium.remote.LocalFileDetector;
2324
import org.openqa.selenium.remote.RemoteWebDriver;
2425

@@ -59,7 +60,7 @@ public WebDriver get() {
5960

6061
RemoteWebDriver driver = new RemoteWebDriver(serverUrl, desiredCapabilities);
6162
driver.setFileDetector(new LocalFileDetector());
62-
return driver;
63+
return new Augmenter().augment(driver);
6364
}
6465

6566
private synchronized void startServer() {

0 commit comments

Comments
 (0)