Skip to content

Commit

Permalink
[java] Enable Edge tests on RBE
Browse files Browse the repository at this point in the history
  • Loading branch information
p0deje committed Mar 15, 2024
1 parent 66c08fe commit 4b584ef
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .skipped-tests
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@
-//java/test/org/openqa/selenium/bidi/browsingcontext:BrowsingContextTest-remote
-//java/test/org/openqa/selenium/chrome:ChromeDriverFunctionalTest
-//java/test/org/openqa/selenium/chrome:ChromeDriverFunctionalTest-remote
-//java/test/org/openqa/selenium/edge:EdgeDriverFunctionalTest
-//java/test/org/openqa/selenium/edge:EdgeDriverFunctionalTest-edge
-//java/test/org/openqa/selenium/edge:EdgeDriverFunctionalTest-remote
-//java/test/org/openqa/selenium/federatedcredentialmanagement:FederatedCredentialManagementTest
-//java/test/org/openqa/selenium/firefox:FirefoxDriverBuilderTest
-//java/test/org/openqa/selenium/grid/gridui:OverallGridTest
-//java/test/org/openqa/selenium/grid/router:RemoteWebDriverDownloadTest
-//java/test/org/openqa/selenium/grid/router:RemoteWebDriverDownloadTest-chrome
-//java/test/org/openqa/selenium/grid/router:RemoteWebDriverDownloadTest-chrome-remote
-//java/test/org/openqa/selenium/grid/router:RemoteWebDriverDownloadTest-edge
-//java/test/org/openqa/selenium/grid/router:RemoteWebDriverDownloadTest-edge-remote
-//java/test/org/openqa/selenium/grid/router:RemoteWebDriverDownloadTest-remote
-//java/test/org/openqa/selenium/interactions:DefaultMouseTest
-//java/test/org/openqa/selenium/interactions:DefaultMouseTest-remote
Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ There are a number of bazel configurations specific for testing.
### Common Options Examples

Here are examples of arguments we make use of in testing the Selenium code:
* `--pin_browsers=true` - run specific browser versions defined in the build (versions are updated regularly)
* `--pin_browsers` - run specific browser versions defined in the build (versions are updated regularly)
* `--headless` - run browsers in headless mode (supported be Chrome, Edge and Firefox)
* `--flaky_test_attempts 3` - re-run failed tests up to 3 times
* `--local_test_jobs 1` - control parallelism of tests
* `--cache_test_results=no`, `-t-` - disable caching of test results and re-runs all of them
Expand Down Expand Up @@ -368,11 +369,6 @@ Supported browsers:
* `safari`
* `safari-preview`

Useful command line options:

* `--pin_browsers` - use browsers and drivers downloaded by Bazel
* `--headless` - run browsers in headless mode (supported be Chrome, Edge and Firefox)

In addition to the [Common Options Examples](#common-options-examples), here are some additional Ruby specific ones:
* `--test_arg "-tfocus"` - test only [focused specs](https://relishapp.com/rspec/rspec-core/v/3-12/docs/filtering/inclusion-filters)
* `--test_arg "-eTimeouts"` - test only specs which name include "Timeouts"
Expand Down
6 changes: 6 additions & 0 deletions java/browsers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,19 @@ chrome_jvm_flags = select({
}) + chromedriver_jvm_flags

edgedriver_jvm_flags = select({
"@selenium//common:use_pinned_linux_edge": [
"-Dwebdriver.edge.driver=$(location @linux_edgedriver//:msedgedriver)",
],
"@selenium//common:use_pinned_macos_edge": [
"-Dwebdriver.edge.driver=$(location @mac_edgedriver//:msedgedriver)",
],
"//conditions:default": [],
})

edge_jvm_flags = select({
"@selenium//common:use_pinned_linux_edge": [
"-Dwebdriver.edge.binary=$(location @linux_edge//:opt/microsoft/msedge/microsoft-edge)",
],
"@selenium//common:use_pinned_macos_edge": [
"-Dwebdriver.edge.binary=\"$(location @mac_edge//:Edge.app)/Contents/MacOS/Microsoft Edge\"",
],
Expand Down
2 changes: 1 addition & 1 deletion java/private/selenium_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ BROWSERS = {
"deps": ["//java/src/org/openqa/selenium/edge"],
"jvm_flags": ["-Dselenium.browser=edge"] + edge_jvm_flags,
"data": edge_data,
"tags": COMMON_TAGS + ["edge", "skip-remote"],
"tags": COMMON_TAGS + ["edge"],
},
"firefox": {
"deps": ["//java/src/org/openqa/selenium/firefox"],
Expand Down
8 changes: 8 additions & 0 deletions java/test/org/openqa/selenium/CookieImplementationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static org.openqa.selenium.testing.drivers.Browser.ALL;
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;
Expand Down Expand Up @@ -205,6 +206,7 @@ public void testAddCookiesWithDifferentPathsThatAreRelatedToOurs() {
@Test
@Ignore(SAFARI)
@NotWorkingInRemoteBazelBuilds(CHROME)
@NotWorkingInRemoteBazelBuilds(EDGE)
@NotWorkingInRemoteBazelBuilds(FIREFOX)
public void testGetCookiesInAFrame() {
driver.get(domainHelper.getUrlForFirstValidHostname("/common/animals"));
Expand Down Expand Up @@ -301,6 +303,7 @@ public void testShouldBeAbleToSetDomainToTheCurrentDomain() throws Exception {
@Test
@NotYetImplemented(SAFARI)
@NotWorkingInRemoteBazelBuilds(CHROME)
@NotWorkingInRemoteBazelBuilds(EDGE)
@NotWorkingInRemoteBazelBuilds(FIREFOX)
public void testShouldWalkThePathToDeleteACookie() {
Cookie cookie1 = new Cookie.Builder("fish", "cod").build();
Expand Down Expand Up @@ -348,6 +351,7 @@ public void testShouldIgnoreThePortNumberOfTheHostWhenSettingTheCookie() throws
@Test
@NotYetImplemented(SAFARI)
@NotWorkingInRemoteBazelBuilds(CHROME)
@NotWorkingInRemoteBazelBuilds(EDGE)
@NotWorkingInRemoteBazelBuilds(FIREFOX)
public void testCookieEqualityAfterSetAndGet() {
driver.get(domainHelper.getUrlForFirstValidHostname("animals"));
Expand Down Expand Up @@ -394,6 +398,7 @@ public void testRetainsCookieExpiry() {
@Ignore(IE)
@Ignore(SAFARI)
@NotWorkingInRemoteBazelBuilds(CHROME)
@NotWorkingInRemoteBazelBuilds(EDGE)
@NotWorkingInRemoteBazelBuilds(FIREFOX)
public void canHandleSecureCookie() {
driver.get(domainHelper.getSecureUrlForFirstValidHostname("animals"));
Expand All @@ -412,6 +417,7 @@ public void canHandleSecureCookie() {
@Ignore(IE)
@Ignore(SAFARI)
@NotWorkingInRemoteBazelBuilds(CHROME)
@NotWorkingInRemoteBazelBuilds(EDGE)
@NotWorkingInRemoteBazelBuilds(FIREFOX)
public void testRetainsCookieSecure() {
driver.get(domainHelper.getSecureUrlForFirstValidHostname("animals"));
Expand All @@ -430,6 +436,7 @@ public void testRetainsCookieSecure() {
@Test
@Ignore(SAFARI)
@NotWorkingInRemoteBazelBuilds(CHROME)
@NotWorkingInRemoteBazelBuilds(EDGE)
@NotWorkingInRemoteBazelBuilds(FIREFOX)
public void canHandleHttpOnlyCookie() {
Cookie addedCookie =
Expand All @@ -445,6 +452,7 @@ public void canHandleHttpOnlyCookie() {
@Test
@Ignore(SAFARI)
@NotWorkingInRemoteBazelBuilds(CHROME)
@NotWorkingInRemoteBazelBuilds(EDGE)
@NotWorkingInRemoteBazelBuilds(FIREFOX)
public void testRetainsHttpOnlyFlag() {
Cookie addedCookie =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public void setUp() {

@Test
@NotYetImplemented(value = CHROME, reason = "Default to 5s")
@NotYetImplemented(value = EDGE, reason = "Default to 5s")
@NotYetImplemented(value = FIREFOX, reason = "Default to 5s")
@NotYetImplemented(value = SAFARI, reason = "Default to 5s")
public void shouldSetAndGetScriptTimeout() {
Expand Down
1 change: 1 addition & 0 deletions java/test/org/openqa/selenium/ExecutingJavascriptTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ public void testShouldThrowAnExceptionWhenArgumentsWithStaleElementPassed() {
@Test
@Ignore(IE)
@Ignore(value = CHROME, reason = "https://bugs.chromium.org/p/chromedriver/issues/detail?id=4395")
@Ignore(value = EDGE, reason = "https://bugs.chromium.org/p/chromedriver/issues/detail?id=4395")
public void testShouldBeAbleToReturnADateObject() throws ParseException {
driver.get(pages.simpleTestPage);

Expand Down
3 changes: 3 additions & 0 deletions java/test/org/openqa/selenium/PageLoadingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
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;
Expand Down Expand Up @@ -72,6 +73,7 @@ void testShouldBeAbleToGetAFragmentOnTheCurrentPage() {

@Test
@NotYetImplemented(CHROME)
@NotYetImplemented(EDGE)
@NotYetImplemented(FIREFOX)
public void testShouldReturnWhenGettingAUrlThatDoesNotResolve() {
assertThatCode(() -> driver.get("http://www.thisurldoesnotexist.comx/"))
Expand All @@ -93,6 +95,7 @@ public void testShouldThrowIfUrlIsMalformedInPortPart() {

@Test
@NotYetImplemented(CHROME)
@NotYetImplemented(EDGE)
@NotYetImplemented(FIREFOX)
public void testShouldReturnWhenGettingAUrlThatDoesNotConnect() {
// Here's hoping that there's nothing here. There shouldn't be
Expand Down
2 changes: 2 additions & 0 deletions java/test/org/openqa/selenium/ProxySettingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.openqa.selenium.remote.CapabilityType.PROXY;
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.SAFARI;

Expand Down Expand Up @@ -111,6 +112,7 @@ public void canConfigureProxyThroughPACFile() throws URISyntaxException, Interru
@NoDriverAfterTest
@Ignore(value = FIREFOX, travis = true)
@Ignore(value = CHROME, reason = "Flaky")
@Ignore(value = EDGE, reason = "Flaky")
public void canUsePACThatOnlyProxiesCertainHosts()
throws URISyntaxException, InterruptedException {
try (SimpleHttpServer helloServer =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static org.assertj.core.api.Assertions.fail;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
import static org.assertj.core.api.Assumptions.assumeThat;
import static org.openqa.selenium.testing.drivers.Browser.EDGE;

import java.time.Duration;
import java.util.List;
Expand All @@ -39,6 +40,7 @@
import org.openqa.selenium.chromium.HasPermissions;
import org.openqa.selenium.remote.RemoteWebDriverBuilder;
import org.openqa.selenium.remote.http.ClientConfig;
import org.openqa.selenium.testing.Ignore;
import org.openqa.selenium.testing.JupiterTestBase;
import org.openqa.selenium.testing.NoDriverBeforeTest;
import org.openqa.selenium.testing.drivers.WebDriverBuilder;
Expand Down Expand Up @@ -93,6 +95,7 @@ void builderWithClientConfigThrowsException() {
}

@Test
@Ignore(value = EDGE, reason = "https://bugs.chromium.org/p/chromedriver/issues/detail?id=4350")
void canSetPermission() {
HasPermissions permissions = (HasPermissions) driver;

Expand Down
2 changes: 1 addition & 1 deletion java/test/org/openqa/selenium/edge/EdgeDriverInfoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void canDetectBrowserByVendorSpecificCapability() {
assertThat(new EdgeDriverInfo())
.is(supporting(new ImmutableCapabilities(EdgeOptions.CAPABILITY, Collections.emptyMap())));
assertThat(new EdgeDriverInfo())
.is(supporting(new ImmutableCapabilities("edgeOptions", Collections.emptyMap())));
.is(supporting(new ImmutableCapabilities("ms:edgeOptions", Collections.emptyMap())));
}

private Condition<EdgeDriverInfo> supporting(Capabilities capabilities) {
Expand Down

0 comments on commit 4b584ef

Please sign in to comment.