aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcaalador <mikael.grankvist@gmail.com>2017-02-03 13:18:54 +0200
committerHenri Sara <henri.sara@gmail.com>2017-02-03 13:18:54 +0200
commit8163c0c77d5c099ef89a255ca87129a1422cda70 (patch)
tree167b5ade772e79622686ce918dd7435c379dcb1e
parent167e733f1f998976569b448a1b6f52854d5e8d1e (diff)
downloadvaadin-framework-8163c0c77d5c099ef89a255ca87129a1422cda70.tar.gz
vaadin-framework-8163c0c77d5c099ef89a255ca87129a1422cda70.zip
Fix absolute layout component resize test (#8429)
Fix test checking for left:auto by testing the actual wrapper width that should change.
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponentsTest.java45
1 files changed, 29 insertions, 16 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponentsTest.java b/uitest/src/test/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponentsTest.java
index d25e2088c9..45d7941c58 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponentsTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponentsTest.java
@@ -10,7 +10,8 @@ import org.openqa.selenium.WebElement;
import java.util.Optional;
/**
- * Tests for component positioning after width changes from defined to relative and relative to defined
+ * Tests for component positioning after width changes from defined to relative
+ * and relative to defined
*/
public class AbsoluteLayoutResizeComponentsTest extends MultiBrowserTest {
@@ -37,10 +38,13 @@ public class AbsoluteLayoutResizeComponentsTest extends MultiBrowserTest {
// Click button to change component size
$(ButtonElement.class).id(componentId + "-button").click();
- left = panelWrapper.get().getCssValue("left");
- Assert.assertEquals(
- "Component wrapper did not have its left positioning reset to auto",
- "auto", left);
+ // Not testing "left" here as testing for AUTO doesn't work in chrome
+ // version 40 which calculates the actual left value, testing width
+ // instead of the wrapper instead
+ String width = panelWrapper.get().getCssValue("width");
+ Assert.assertEquals("Width was more that it should have been.", "250px",
+ width);
+
Assert.assertNotEquals("Panel is still on the left side of the screen",
0, panelComponent.getLocation().getX());
}
@@ -57,9 +61,9 @@ public class AbsoluteLayoutResizeComponentsTest extends MultiBrowserTest {
"No wrapper element found for panel [ID: " + componentId + "]",
panelWrapper.isPresent());
- String left = panelWrapper.get().getCssValue("left");
- Assert.assertEquals("Component wrapper has a set Left marker", "auto",
- left);
+ String width = panelWrapper.get().getCssValue("width");
+ Assert.assertEquals("Width was more that it should have been.", "250px",
+ width);
WebElement panelComponent = findElement(By.id(componentId));
Assert.assertNotEquals(
@@ -69,11 +73,15 @@ public class AbsoluteLayoutResizeComponentsTest extends MultiBrowserTest {
// Click button to change component size
$(ButtonElement.class).id(componentId + "-button").click();
- left = panelWrapper.get().getCssValue("left");
+ String left = panelWrapper.get().getCssValue("left");
Assert.assertEquals(
"Component wrapper was missing left:0; from its css positioning",
"0px", left);
+ width = panelWrapper.get().getCssValue("width");
+ Assert.assertNotEquals("Width hasn't changed from the initial value.",
+ "250px", width);
+
Assert.assertEquals("Panel is not on the left side of the screen", 0,
panelComponent.getLocation().getX());
}
@@ -89,10 +97,9 @@ public class AbsoluteLayoutResizeComponentsTest extends MultiBrowserTest {
Assert.assertTrue("No wrapper element found for AbsoluteLayout [ID: "
+ componentId + "].", panelWrapper.isPresent());
- String left = panelWrapper.get().getCssValue("left");
- Assert.assertEquals(
- "Component wrapper did not have its left positioning reset to auto",
- "auto", left);
+ String width = panelWrapper.get().getCssValue("width");
+ Assert.assertEquals("Width was more that it should have been.", "250px",
+ width);
WebElement panelComponent = findElement(By.id(componentId));
Assert.assertNotEquals(
@@ -102,19 +109,25 @@ public class AbsoluteLayoutResizeComponentsTest extends MultiBrowserTest {
// Click button to change component size
$(ButtonElement.class).id(componentId + "-button").click();
- left = panelWrapper.get().getCssValue("left");
+ String left = panelWrapper.get().getCssValue("left");
Assert.assertEquals(
"Component wrapper was missing left:0; from its css positioning",
"0px", left);
+ width = panelWrapper.get().getCssValue("width");
+ Assert.assertNotEquals("Width hasn't changed from the initial value.",
+ "250px", width);
+
Assert.assertEquals("Panel is not on the left side of the screen", 0,
panelComponent.getLocation().getX());
}
/**
- * Search for the AbsoluteLayout wrapper element that contains component for componentId
+ * Search for the AbsoluteLayout wrapper element that contains component for
+ * componentId
*
- * @param componentId Id of component contained in Wrapper component
+ * @param componentId
+ * Id of component contained in Wrapper component
* @return WrapperComponent or null
*/
private Optional<WebElement> getComponentWrapper(String componentId) {