Skip to content

Commit

Permalink
[java] Deleting tests ignored for all browsers because the target fea…
Browse files Browse the repository at this point in the history
…ture is not available in modern browser versions
  • Loading branch information
barancev committed Feb 6, 2021
1 parent 5ca811e commit f6d2cb3
Showing 1 changed file with 0 additions and 66 deletions.
66 changes: 0 additions & 66 deletions java/client/test/org/openqa/selenium/AlertsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.junit.Assume.assumeFalse;
import static org.openqa.selenium.WaitingConditions.newWindowIsOpened;
import static org.openqa.selenium.support.ui.ExpectedConditions.alertIsPresent;
import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;
Expand All @@ -32,8 +31,6 @@
import static org.openqa.selenium.testing.drivers.Browser.IE;
import static org.openqa.selenium.testing.drivers.Browser.FIREFOX;
import static org.openqa.selenium.testing.drivers.Browser.SAFARI;
import static org.openqa.selenium.testing.TestUtilities.getFirefoxVersion;
import static org.openqa.selenium.testing.TestUtilities.isFirefox;

import org.junit.After;
import org.junit.Test;
Expand Down Expand Up @@ -410,33 +407,6 @@ public void testShouldNotHandleAlertInAnotherWindow() {
.isThrownBy(() -> wait.until(alertIsPresent()));
}

@Test
@Ignore(value = CHROME, reason = "Chrome does not trigger alerts on unload")
@Ignore(value = EDGIUM, reason = "Edge does not trigger alerts on unload")
@NotYetImplemented(HTMLUNIT)
@Ignore(SAFARI)
@NotYetImplemented(EDGE_HTML)
public void testShouldHandleAlertOnPageUnload() {
assumeFalse("Firefox 27+ does not trigger alerts on before unload",
isFirefox(driver) && getFirefoxVersion(driver) >= 27);

String pageWithOnBeforeUnload = appServer.create(new Page()
.withOnBeforeUnload("return \"onbeforeunload\"")
.withBody("<p>Page with onbeforeunload event handler</p>"));
driver.get(appServer.create(new Page()
.withBody(String.format("<a id='link' href='%s'>open new page</a>", pageWithOnBeforeUnload))));

driver.findElement(By.id("link")).click();
driver.navigate().back();

Alert alert = wait.until(alertIsPresent());
String value = alert.getText();
alert.accept();

assertThat(value).isEqualTo("onbeforeunload");
wait.until(textInElementLocated(By.id("link"), "open new page"));
}

@Test
@Ignore(value = LEGACY_FIREFOX_XPI, reason = "Non W3C conformant")
@Ignore(value = HTMLUNIT, reason = "Non W3C conformant")
Expand All @@ -456,42 +426,6 @@ public void testShouldImplicitlyHandleAlertOnPageBeforeUnload() {
wait.until(titleIs("Success"));
}

@Test
@Ignore(value = CHROME, reason = "Chrome does not trigger alerts on unload")
@Ignore(value = EDGIUM, reason = "Chrome does not trigger alerts on unload")
@NotYetImplemented(HTMLUNIT)
@Ignore(SAFARI)
@Ignore(value = IE, reason = "IE driver automatically dismisses alerts on window close")
@NotYetImplemented(EDGE_HTML)
public void testShouldHandleAlertOnWindowClose() {
assumeFalse("Firefox 27+ does not trigger alerts on unload",
isFirefox(driver) && getFirefoxVersion(driver) >= 27);

String pageWithOnBeforeUnload = appServer.create(new Page()
.withOnBeforeUnload("return \"onbeforeunload\"")
.withBody("<p>Page with onbeforeunload event handler</p>"));
driver.get(appServer.create(new Page()
.withBody(String.format(
"<a id='open-new-window' href='%s' target='newwindow'>open new window</a>", pageWithOnBeforeUnload))));

String mainWindow = driver.getWindowHandle();
try {
driver.findElement(By.id("open-new-window")).click();
wait.until(ableToSwitchToWindow("newwindow"));
driver.close();

Alert alert = wait.until(alertIsPresent());
String value = alert.getText();
alert.accept();

assertThat(value).isEqualTo("onbeforeunload");

} finally {
driver.switchTo().window(mainWindow);
wait.until(textInElementLocated(By.id("open-new-window"), "open new window"));
}
}

@Test
@Ignore(value = HTMLUNIT, reason = "https://github.com/SeleniumHQ/htmlunit-driver/issues/57")
@NotYetImplemented(value = FIREFOX,
Expand Down

0 comments on commit f6d2cb3

Please sign in to comment.