Skip to content

Commit

Permalink
Turns out that these tests only fail on OS X and Firefox
Browse files Browse the repository at this point in the history
And the latest geckodriver (0.16) with Firefox Nightly.
  • Loading branch information
shs96c committed Apr 24, 2017
1 parent 2f1df98 commit e181e41
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions java/client/test/org/openqa/selenium/ClickScrollingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;
import static org.openqa.selenium.testing.Driver.ALL;
import static org.openqa.selenium.testing.Driver.CHROME;
Expand All @@ -38,6 +39,7 @@
import org.openqa.selenium.testing.Ignore;
import org.openqa.selenium.testing.JUnit4TestBase;
import org.openqa.selenium.testing.SwitchToTopAfterTest;
import org.openqa.selenium.testing.drivers.Browser;

@Ignore(value = HTMLUNIT, reason = "Scrolling requires rendering")
public class ClickScrollingTest extends JUnit4TestBase {
Expand Down Expand Up @@ -86,12 +88,11 @@ public void testShouldBeAbleToClickOnAnElementHiddenByOverflow() {

@Test
@Ignore(value = CHROME, reason = "failed")
@Ignore(value = MARIONETTE, issue = "https://github.com/mozilla/geckodriver/issues/662")
public void testShouldBeAbleToClickOnAnElementHiddenByDoubleOverflow() {
driver.get(appServer.whereIs("scrolling_tests/page_with_double_overflow_auto.html"));

driver.findElement(By.id("link")).click();
wait.until(titleIs("Clicked Successfully!"));
onlyPassIfNotOnMac(662, () -> wait.until(titleIs("Clicked Successfully!")));
}

@Test
Expand Down Expand Up @@ -193,27 +194,40 @@ public void testShouldBeAbleToClickElementThatIsOutOfViewInAFrameThatIsOutOfView
@SwitchToTopAfterTest
@Test
@Ignore(SAFARI)
@Ignore(value = MARIONETTE, issue = "https://github.com/mozilla/geckodriver/issues/651")
public void testShouldBeAbleToClickElementThatIsOutOfViewInANestedFrame() {
driver.get(appServer.whereIs("scrolling_tests/page_with_nested_scrolling_frames.html"));
driver.switchTo().frame("scrolling_frame");
driver.switchTo().frame("nested_scrolling_frame");
WebElement element = driver.findElement(By.name("scroll_checkbox"));
element.click();
assertTrue(element.isSelected());
onlyPassIfNotOnMac(651, () -> assertTrue(element.isSelected()));
}

@SwitchToTopAfterTest
@Test
@Ignore(SAFARI)
@Ignore(value = MARIONETTE, issue = "https://github.com/mozilla/geckodriver/issues/651")
public void testShouldBeAbleToClickElementThatIsOutOfViewInANestedFrameThatIsOutOfView() {
driver.get(appServer.whereIs("scrolling_tests/page_with_nested_scrolling_frames_out_of_view.html"));
driver.switchTo().frame("scrolling_frame");
driver.switchTo().frame("nested_scrolling_frame");
WebElement element = driver.findElement(By.name("scroll_checkbox"));
element.click();
assertTrue(element.isSelected());

onlyPassIfNotOnMac(651, () -> assertTrue(element.isSelected()));
}

private void onlyPassIfNotOnMac(int mozIssue, Runnable toCheck) {
try {
toCheck.run();
assumeFalse(
"It appears https://github.com/mozilla/geckodriver/issues/" + mozIssue + " is fixed",
Platform.getCurrent() == Platform.MAC && Browser.detect() == Browser.ff);
} catch (Throwable e) {
// Swallow the exception, as this is expected for Firefox on OS X
if (!(Platform.getCurrent() == Platform.MAC && Browser.detect() == Browser.ff)) {
throw e;
}
}
}

@Test
Expand Down

0 comments on commit e181e41

Please sign in to comment.