Skip to content

Commit

Permalink
Fir formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pujagani committed Nov 13, 2024
1 parent 3eea166 commit 652d07b
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions java/test/org/openqa/selenium/WebNetworkTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@

import java.net.URI;

import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.bidi.module.Network;
import org.openqa.selenium.bidi.network.Header;
import org.openqa.selenium.environment.webserver.NettyAppServer;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.http.HttpMethod;
import org.openqa.selenium.remote.http.HttpRequest;
Expand Down Expand Up @@ -179,7 +183,7 @@ void canClearAuthenticationHandlers() {
void canAddRequestHandler() {
Predicate<URI> filter = uri -> uri.getPath().contains("logEntry");

page = server.whereIs("/bidi/logEntryAdded.html");
page = appServer.whereIs("/bidi/logEntryAdded.html");

((RemoteWebDriver) driver).network().addRequestHandler(filter, httpRequest -> httpRequest);

Expand All @@ -194,7 +198,7 @@ void canAddRequestHandler() {
void canAddRequestHandlerToModifyMethod() {
Predicate<URI> filter = uri -> uri.getPath().contains("logEntry");

page = server.whereIs("/bidi/logEntryAdded.html");
page = appServer.whereIs("/bidi/logEntryAdded.html");

((RemoteWebDriver) driver)
.network()
Expand Down Expand Up @@ -226,14 +230,14 @@ void canAddRequestHandlerToModifyHeaders() throws InterruptedException {
return response.setContent(utf8String("Received response for network"));
});

server = new NettyAppServer(route);
server.start();
appServer = new NettyAppServer(route);
appServer.start();

Predicate<URI> filter = uri -> uri.getPath().contains("network");

CountDownLatch latch = new CountDownLatch(1);

page = server.whereIs("network.html");
page = appServer.whereIs("network.html");

((RemoteWebDriver) driver)
.network()
Expand Down Expand Up @@ -275,12 +279,12 @@ void canAddRequestHandlerToModifyBody() throws InterruptedException {
return response.setContent(req.getContent());
});

server = new NettyAppServer(route);
server.start();
appServer = new NettyAppServer(route);
appServer.start();

Predicate<URI> filter = uri -> uri.getPath().contains("network");

page = server.whereIs("network.html");
page = appServer.whereIs("network.html");

((RemoteWebDriver) driver)
.network()
Expand All @@ -299,7 +303,7 @@ void canAddRequestHandlerToModifyBody() throws InterruptedException {
@Ignore(Browser.CHROME)
@Ignore(Browser.EDGE)
void canAddMultipleRequestHandlers() {
page = server.whereIs("/bidi/logEntryAdded.html");
page = appServer.whereIs("/bidi/logEntryAdded.html");

((RemoteWebDriver) driver)
.network()
Expand Down Expand Up @@ -328,7 +332,7 @@ void canAddMultipleRequestHandlersWithTheSameFilter() {
.network()
.addRequestHandler(uri -> uri.getPath().contains("logEntry"), httpRequest -> httpRequest);

page = server.whereIs("/bidi/logEntryAdded.html");
page = appServer.whereIs("/bidi/logEntryAdded.html");

driver.get(page);

Expand All @@ -355,14 +359,14 @@ void canRemoveRequestHandler() throws InterruptedException {
return response.setContent(utf8String("Received response for network"));
});

server = new NettyAppServer(route);
server.start();
appServer = new NettyAppServer(route);
appServer.start();

Predicate<URI> filter = uri -> uri.getPath().contains("network");

CountDownLatch latch = new CountDownLatch(1);

page = server.whereIs("network.html");
page = appServer.whereIs("network.html");

long id =
((RemoteWebDriver) driver)
Expand Down Expand Up @@ -399,7 +403,7 @@ void canRemoveRequestHandler() throws InterruptedException {
@Ignore(Browser.EDGE)
void canRemoveRequestHandlerThatDoesNotExist() {
((RemoteWebDriver) driver).network().removeAuthenticationHandler(5);
page = server.whereIs("/bidi/logEntryAdded.html");
page = appServer.whereIs("/bidi/logEntryAdded.html");
driver.get(page);

assertThat(driver.findElement(By.tagName("h1")).getText()).isEqualTo("Long entry added events");
Expand All @@ -409,7 +413,7 @@ void canRemoveRequestHandlerThatDoesNotExist() {
@Ignore(Browser.CHROME)
@Ignore(Browser.EDGE)
void canClearRequestHandlers() {
page = server.whereIs("/bidi/logEntryAdded.html");
page = appServer.whereIs("/bidi/logEntryAdded.html");

((RemoteWebDriver) driver)
.network()
Expand Down

0 comments on commit 652d07b

Please sign in to comment.