Skip to content

Commit

Permalink
[bidi] [java] Rework tests to run in different browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
pujagani committed Nov 1, 2023
1 parent 5402d1a commit 63baf0b
Showing 1 changed file with 40 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,42 @@

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.openqa.selenium.testing.Safely.safelyCall;
import static org.openqa.selenium.testing.drivers.Browser.CHROME;
import static org.openqa.selenium.testing.drivers.Browser.EDGE;
import static org.openqa.selenium.testing.drivers.Browser.FIREFOX;
import static org.openqa.selenium.testing.drivers.Browser.IE;
import static org.openqa.selenium.testing.drivers.Browser.SAFARI;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WindowType;
import org.openqa.selenium.bidi.BrowsingContextInspector;
import org.openqa.selenium.environment.webserver.AppServer;
import org.openqa.selenium.environment.webserver.NettyAppServer;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.testing.drivers.Browser;
import org.openqa.selenium.testing.JupiterTestBase;
import org.openqa.selenium.testing.NotYetImplemented;

class BrowsingContextInspectorTest {
class BrowsingContextInspectorTest extends JupiterTestBase {

private AppServer server;
private FirefoxDriver driver;

@BeforeEach
public void setUp() {
FirefoxOptions options = (FirefoxOptions) Browser.FIREFOX.getCapabilities();
options.setCapability("webSocketUrl", true);

driver = new FirefoxDriver(options);

server = new NettyAppServer();
server.start();
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(CHROME)
@NotYetImplemented(EDGE)
void canListenToWindowBrowsingContextCreatedEvent()
throws ExecutionException, InterruptedException, TimeoutException {
try (BrowsingContextInspector inspector = new BrowsingContextInspector(driver)) {
Expand All @@ -74,6 +75,10 @@ void canListenToWindowBrowsingContextCreatedEvent()
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(CHROME)
@NotYetImplemented(EDGE)
void canListenToTabBrowsingContextCreatedEvent()
throws ExecutionException, InterruptedException, TimeoutException {
try (BrowsingContextInspector inspector = new BrowsingContextInspector(driver)) {
Expand All @@ -93,6 +98,10 @@ void canListenToTabBrowsingContextCreatedEvent()
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(CHROME)
@NotYetImplemented(EDGE)
void canListenToDomContentLoadedEvent()
throws ExecutionException, InterruptedException, TimeoutException {
try (BrowsingContextInspector inspector = new BrowsingContextInspector(driver)) {
Expand All @@ -109,6 +118,10 @@ void canListenToDomContentLoadedEvent()
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(CHROME)
@NotYetImplemented(EDGE)
void canListenToBrowsingContextLoadedEvent()
throws ExecutionException, InterruptedException, TimeoutException {
try (BrowsingContextInspector inspector = new BrowsingContextInspector(driver)) {
Expand All @@ -125,7 +138,10 @@ void canListenToBrowsingContextLoadedEvent()
}

@Test
@Disabled
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(CHROME)
@NotYetImplemented(EDGE)
void canListenToNavigationStartedEvent()
throws ExecutionException, InterruptedException, TimeoutException {
try (BrowsingContextInspector inspector = new BrowsingContextInspector(driver)) {
Expand All @@ -142,7 +158,10 @@ void canListenToNavigationStartedEvent()
}

@Test
@Disabled
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(CHROME)
@NotYetImplemented(EDGE)
void canListenToFragmentNavigatedEvent()
throws ExecutionException, InterruptedException, TimeoutException {
try (BrowsingContextInspector inspector = new BrowsingContextInspector(driver)) {
Expand All @@ -163,7 +182,10 @@ void canListenToFragmentNavigatedEvent()
}

@Test
@Disabled
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(CHROME)
@NotYetImplemented(EDGE)
void canListenToUserPromptOpenedEvent()
throws ExecutionException, InterruptedException, TimeoutException {
try (BrowsingContextInspector inspector = new BrowsingContextInspector(driver)) {
Expand All @@ -183,7 +205,10 @@ void canListenToUserPromptOpenedEvent()
}

@Test
@Disabled
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(CHROME)
@NotYetImplemented(EDGE)
void canListenToUserPromptClosedEvent()
throws ExecutionException, InterruptedException, TimeoutException {
try (BrowsingContextInspector inspector = new BrowsingContextInspector(driver)) {
Expand Down

0 comments on commit 63baf0b

Please sign in to comment.