Skip to content

Commit

Permalink
[java] Use JupiterTestBase for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pujagani committed Oct 27, 2023
1 parent 696771e commit 5cf5f0e
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 27 deletions.
77 changes: 63 additions & 14 deletions java/test/org/openqa/selenium/bidi/script/LocalValueTest.java
Expand Up @@ -18,6 +18,10 @@
package org.openqa.selenium.bidi.script;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
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.IE;
import static org.openqa.selenium.testing.drivers.Browser.SAFARI;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -27,25 +31,18 @@
import java.util.Optional;
import java.util.Set;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.bidi.Script;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.testing.JupiterTestBase;
import org.openqa.selenium.testing.NotYetImplemented;

class LocalValueTest {

private FirefoxDriver driver;

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

driver = new FirefoxDriver(options);
}
class LocalValueTest extends JupiterTestBase {

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithUndefinedArgument() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -76,6 +73,10 @@ void canCallFunctionWithUndefinedArgument() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithNullArgument() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -106,6 +107,10 @@ void canCallFunctionWithNullArgument() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithMinusZeroArgument() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -138,6 +143,10 @@ void canCallFunctionWithMinusZeroArgument() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithInfinityArgument() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -170,6 +179,10 @@ void canCallFunctionWithInfinityArgument() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithMinusInfinityArgument() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -203,6 +216,10 @@ void canCallFunctionWithMinusInfinityArgument() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithNumberArgument() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -235,6 +252,10 @@ void canCallFunctionWithNumberArgument() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithBooleanArgument() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -267,6 +288,10 @@ void canCallFunctionWithBooleanArgument() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithBigIntArgument() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -299,6 +324,10 @@ void canCallFunctionWithBigIntArgument() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithArrayArgument() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -337,6 +366,10 @@ void canCallFunctionWithArrayArgument() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithSetArgument() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -375,6 +408,10 @@ void canCallFunctionWithSetArgument() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithDateArgument() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -408,6 +445,10 @@ void canCallFunctionWithDateArgument() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithMapArgument() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -448,6 +489,10 @@ void canCallFunctionWithMapArgument() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithObjectArgument() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -488,6 +533,10 @@ void canCallFunctionWithObjectArgument() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithRegExpArgument() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down
56 changes: 43 additions & 13 deletions java/test/org/openqa/selenium/bidi/script/ScriptCommandsTest.java
Expand Up @@ -18,31 +18,29 @@
package org.openqa.selenium.bidi.script;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
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.IE;
import static org.openqa.selenium.testing.drivers.Browser.SAFARI;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.bidi.Script;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.testing.JupiterTestBase;
import org.openqa.selenium.testing.NotYetImplemented;

public class ScriptCommandsTest {
private FirefoxDriver driver;

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

driver = new FirefoxDriver(options);
}
public class ScriptCommandsTest extends JupiterTestBase {

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithDeclaration() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand All @@ -61,6 +59,10 @@ void canCallFunctionWithDeclaration() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithArguments() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -90,6 +92,10 @@ void canCallFunctionWithArguments() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithAwaitPromise() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -117,6 +123,10 @@ void canCallFunctionWithAwaitPromise() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithAwaitPromiseFalse() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand All @@ -142,6 +152,10 @@ void canCallFunctionWithAwaitPromiseFalse() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithThisParameter() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down Expand Up @@ -169,6 +183,10 @@ void canCallFunctionWithThisParameter() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithOwnershipRoot() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand All @@ -191,6 +209,10 @@ void canCallFunctionWithOwnershipRoot() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionWithOwnershipNone() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand All @@ -213,6 +235,10 @@ void canCallFunctionWithOwnershipNone() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionThatThrowsException() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand All @@ -239,6 +265,10 @@ void canCallFunctionThatThrowsException() {
}

@Test
@NotYetImplemented(SAFARI)
@NotYetImplemented(IE)
@NotYetImplemented(EDGE)
@NotYetImplemented(CHROME)
void canCallFunctionInASandBox() {
String id = driver.getWindowHandle();
Script script = new Script(id, driver);
Expand Down

0 comments on commit 5cf5f0e

Please sign in to comment.