Skip to content

Commit

Permalink
Attempt to reduce flakiness of BasicMouseInterfaceTest with Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Oct 4, 2016
1 parent f0c7418 commit 8b08e39
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static org.junit.Assert.fail;
import static org.openqa.selenium.WaitingConditions.elementTextToEqual;
import static org.openqa.selenium.WaitingConditions.elementValueToEqual;
import static org.openqa.selenium.support.ui.ExpectedConditions.attributeToBe;
import static org.openqa.selenium.support.ui.ExpectedConditions.not;
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;
import static org.openqa.selenium.testing.Driver.CHROME;
Expand All @@ -36,11 +37,8 @@
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.testing.NeedsFreshDriver;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.Point;
import org.openqa.selenium.testing.SwitchToTopAfterTest;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.Color;
Expand All @@ -49,7 +47,9 @@
import org.openqa.selenium.testing.Ignore;
import org.openqa.selenium.testing.JUnit4TestBase;
import org.openqa.selenium.testing.JavascriptEnabled;
import org.openqa.selenium.testing.NeedsFreshDriver;
import org.openqa.selenium.testing.NotYetImplemented;
import org.openqa.selenium.testing.SwitchToTopAfterTest;

import java.util.Map;

Expand Down Expand Up @@ -471,19 +471,17 @@ public void testMoveMouseByOffsetOverAndOutOfAnElement() {

new Actions(driver).moveToElement(greenbox, 2, 2).perform();

assertEquals(
Colors.GREEN.getColorValue(), Color.fromString(redbox.getCssValue("background-color")));
shortWait.until(attributeToBe(redbox, "background-color", Colors.GREEN.getColorValue().asRgba()));

new Actions(driver).moveToElement(greenbox, 2, 2)
.moveByOffset(shiftX, shiftY).perform();
assertEquals(
Colors.RED.getColorValue(), Color.fromString(redbox.getCssValue("background-color")));
shortWait.until(attributeToBe(redbox, "background-color", Colors.RED.getColorValue().asRgba()));

new Actions(driver).moveToElement(greenbox, 2, 2)
.moveByOffset(shiftX, shiftY)
.moveByOffset(-shiftX, -shiftY).perform();

wait.until(ExpectedConditions.attributeToBe(redbox, "background-color", Colors.GREEN.getColorValue().asRgba()));
shortWait.until(attributeToBe(redbox, "background-color", Colors.GREEN.getColorValue().asRgba()));
}

@JavascriptEnabled
Expand Down Expand Up @@ -513,7 +511,7 @@ public void testCanMoveOverAndOutOfAnElement() {
new Actions(driver).moveToElement(redbox, size.getWidth() + 2, size.getHeight() + 2)
.perform();

wait.until(ExpectedConditions.attributeToBe(redbox, "background-color", Colors.GREEN.getColorValue().asRgba()));
wait.until(attributeToBe(redbox, "background-color", Colors.GREEN.getColorValue().asRgba()));
}

private boolean fuzzyPositionMatching(int expectedX, int expectedY, String locationTouple) {
Expand Down

0 comments on commit 8b08e39

Please sign in to comment.