Skip to content

Commit

Permalink
Annotate or fix some edge tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Sep 28, 2021
1 parent 33ecb85 commit ad13b0f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.assertj.core.api.Assumptions.assumeThat;

public class EdgeDriverFunctionalTest extends JUnit4TestBase {

Expand All @@ -46,8 +47,8 @@ public void canSetPermission() {
HasPermissions permissions = (HasPermissions) driver;

driver.get(pages.clicksPage);
assertThat(checkPermission(driver, CLIPBOARD_READ)).isEqualTo("prompt");
assertThat(checkPermission(driver, CLIPBOARD_WRITE)).isEqualTo("granted");
assumeThat(checkPermission(driver, CLIPBOARD_READ)).isEqualTo("prompt");
assumeThat(checkPermission(driver, CLIPBOARD_WRITE)).isEqualTo("granted");

permissions.setPermission(CLIPBOARD_READ, "denied");
permissions.setPermission(CLIPBOARD_WRITE, "prompt");
Expand Down
23 changes: 15 additions & 8 deletions java/test/org/openqa/selenium/edge/EdgeOptionsFunctionalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@
import org.junit.After;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.HasCapabilities;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.build.InProject;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.testing.JUnit4TestBase;
import org.openqa.selenium.testing.NotYetImplemented;
import org.openqa.selenium.testing.drivers.WebDriverBuilder;

import java.io.IOException;
import java.nio.file.Files;
Expand All @@ -38,7 +43,7 @@ public class EdgeOptionsFunctionalTest extends JUnit4TestBase {

private static final String EXT_PATH = "third_party/chrome_ext/backspace.crx";

private EdgeDriver edgeDriver = null;
private WebDriver edgeDriver = null;

@After
public void tearDown() {
Expand All @@ -51,10 +56,10 @@ public void tearDown() {
public void canStartChromeWithCustomOptions() {
EdgeOptions options = new EdgeOptions();
options.addArguments("user-agent=foo;bar");
edgeDriver = new EdgeDriver(options);
edgeDriver = new WebDriverBuilder().get(options);

edgeDriver.get(pages.clickJacker);
Object userAgent = edgeDriver.executeScript("return window.navigator.userAgent");
Object userAgent = ((JavascriptExecutor) edgeDriver).executeScript("return window.navigator.userAgent");
assertThat(userAgent).isEqualTo("foo;bar");
}

Expand All @@ -71,17 +76,18 @@ public void optionsStayEqualAfterSerialization() {
public void canSetAcceptInsecureCerts() {
EdgeOptions options = new EdgeOptions();
options.setAcceptInsecureCerts(true);
edgeDriver = new EdgeDriver(options);
System.out.println(edgeDriver.getCapabilities());
edgeDriver = new WebDriverBuilder().get(options);
System.out.println(((HasCapabilities) edgeDriver).getCapabilities());

assertThat(edgeDriver.getCapabilities().getCapability(ACCEPT_INSECURE_CERTS)).isEqualTo(true);
assertThat(((HasCapabilities) edgeDriver).getCapabilities().getCapability(ACCEPT_INSECURE_CERTS)).isEqualTo(true);
}

@Test
@NotYetImplemented
public void canAddExtensionFromFile() {
EdgeOptions options = new EdgeOptions();
options.addExtensions(InProject.locate(EXT_PATH).toFile());
edgeDriver = new EdgeDriver(options);
edgeDriver = new WebDriverBuilder().get(options);

edgeDriver.get(pages.clicksPage);

Expand All @@ -93,11 +99,12 @@ public void canAddExtensionFromFile() {
}

@Test
@NotYetImplemented
public void canAddExtensionFromStringEncodedInBase64() throws IOException {
EdgeOptions options = new EdgeOptions();
options.addEncodedExtensions(Base64.getEncoder().encodeToString(
Files.readAllBytes(InProject.locate(EXT_PATH))));
edgeDriver = new EdgeDriver(options);
edgeDriver = new WebDriverBuilder().get(options);

edgeDriver.get(pages.clicksPage);

Expand Down

0 comments on commit ad13b0f

Please sign in to comment.