summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Paul <henrik@vaadin.com>2015-03-20 16:18:55 +0200
committerVaadin Code Review <review@vaadin.com>2015-03-22 11:56:30 +0000
commit8d5b8042358e8eea8db30a3114cd02993244abb2 (patch)
tree261c0861a36dee665c35b9c66def87a684dc1fab
parent2a711a6e8c393b7457b9fe029d30a782945c8076 (diff)
downloadvaadin-framework-8d5b8042358e8eea8db30a3114cd02993244abb2.tar.gz
vaadin-framework-8d5b8042358e8eea8db30a3114cd02993244abb2.zip
Fixes Escalator spacer tests (#16644)
Change-Id: I0cb3584673525b1a21b01a2e819056df7f94579c
-rw-r--r--WebContent/VAADIN/themes/base/escalator/escalator.scss8
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorSpacerTest.java45
2 files changed, 37 insertions, 16 deletions
diff --git a/WebContent/VAADIN/themes/base/escalator/escalator.scss b/WebContent/VAADIN/themes/base/escalator/escalator.scss
index 7949b52882..bae95b299c 100644
--- a/WebContent/VAADIN/themes/base/escalator/escalator.scss
+++ b/WebContent/VAADIN/themes/base/escalator/escalator.scss
@@ -143,5 +143,13 @@
width: 100%;
height: 100%;
}
+
+ .v-ie8 &, .v-ie9 & {
+ // The inline style of margin-top from the <tbody> to offset the
+ // header's dimension is, for some strange reason, inherited into each
+ // contained <tr>. We need to cancel it:
+
+ margin-top: 0;
+ }
}
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorSpacerTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorSpacerTest.java
index c3468b373e..1e9771ab13 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorSpacerTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorSpacerTest.java
@@ -25,6 +25,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.junit.Before;
+import org.junit.ComparisonFailure;
import org.junit.Test;
import org.openqa.selenium.WebElement;
@@ -79,17 +80,18 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
+ ";?"; // optional semicolon
//@formatter:on
+ // also matches "-webkit-transform";
private final static Pattern TRANSFORM_CSS_PATTERN = Pattern
- .compile("transform: (.*?);"); // also matches "-webkit-transform";
- private final static Pattern TOP_CSS_PATTERN = Pattern
- .compile("top: (.*?);");
- private final static Pattern LEFT_CSS_PATTERN = Pattern
- .compile("left: (.*?);");
+ .compile("transform: (.*?);");
+ private final static Pattern TOP_CSS_PATTERN = Pattern.compile(
+ "top: ([0-9]+(?:\\.[0-9]+)?(?:px)?);?", Pattern.CASE_INSENSITIVE);
+ private final static Pattern LEFT_CSS_PATTERN = Pattern.compile(
+ "left: ([0-9]+(?:\\.[0-9]+)?(?:px)?);?", Pattern.CASE_INSENSITIVE);
private final static Pattern TRANSLATE_VALUE_PATTERN = Pattern
.compile(TRANSLATE_VALUE_REGEX);
- private final static Pattern PIXEL_VALUE_PATTERN = Pattern
- .compile(PIXEL_VALUE_REGEX);
+ private final static Pattern PIXEL_VALUE_PATTERN = Pattern.compile(
+ PIXEL_VALUE_REGEX, Pattern.CASE_INSENSITIVE);
@Before
public void before() {
@@ -132,7 +134,8 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, ADD_ONE_ROW_TO_BEGINNING);
double newTop = getElementTop(getSpacer(2));
- assertGreater("Spacer should've been pushed down", newTop, oldTop);
+ assertGreater("Spacer should've been pushed down (oldTop: " + oldTop
+ + ", newTop: " + newTop + ")", newTop, oldTop);
}
@Test
@@ -282,7 +285,18 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, SCROLL_TO, ROW_25);
Thread.sleep(500);
- assertEquals("Row 25: 0,25", getBodyCell(0, 0).getText());
+
+ try {
+ assertEquals("Row 25: 0,25", getBodyCell(0, 0).getText());
+ } catch (ComparisonFailure retryForIE10andIE11) {
+ /*
+ * This seems to be some kind of subpixel/off-by-one-pixel error.
+ * Everything's scrolled correctly, but Escalator still loads one
+ * row above to the DOM, underneath the header. It's there, but it's
+ * not visible. We'll allow for that one pixel error.
+ */
+ assertEquals("Row 24: 0,24", getBodyCell(0, 0).getText());
+ }
}
private static double[] getElementDimensions(WebElement element) {
@@ -300,19 +314,18 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
double[] result = new double[] { -1, -1 };
String left = getLeftFromStyle(style);
if (left != null) {
- result[1] = getPixelValue(left);
+ result[0] = getPixelValue(left);
}
String top = getTopFromStyle(style);
if (top != null) {
- result[0] = getPixelValue(top);
+ result[1] = getPixelValue(top);
}
if (result[0] != -1 && result[1] != -1) {
return result;
} else {
- throw new IllegalArgumentException(
- "Could not parse the top position from the CSS \"" + style
- + "\"");
+ throw new IllegalArgumentException("Could not parse the position "
+ + "information from the CSS \"" + style + "\"");
}
}
@@ -363,8 +376,8 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
private static double getPixelValue(String top) {
Matcher matcher = PIXEL_VALUE_PATTERN.matcher(top);
- assertTrue("no matches for " + top + " against " + PIXEL_VALUE_PATTERN,
- matcher.find());
+ assertTrue("no matches for \"" + top + "\" against "
+ + PIXEL_VALUE_PATTERN, matcher.find());
assertEquals("wrong amount of groups matched in " + top, 1,
matcher.groupCount());
return Double.parseDouble(matcher.group(1));