aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests
diff options
context:
space:
mode:
Diffstat (limited to 'uitest/src/test/java/com/vaadin/tests')
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheetTest.java2
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/window/BottomComponentScrollsUpTest.java7
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java15
-rw-r--r--uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java9
-rw-r--r--uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java13
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java15
6 files changed, 46 insertions, 15 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheetTest.java b/uitest/src/test/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheetTest.java
index eefd6b2f6c..030a114948 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheetTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheetTest.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.components.popupview;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.openqa.selenium.WebElement;
@@ -17,6 +18,7 @@ public class PopUpViewInTabsheetTest extends MultiBrowserTest {
}
@Test
+ @Ignore("Fix was based on TabSheet reattach hack, test broken by #10988")
public void testPopUpNotVisisble() {
WebElement view = findElement(By.className("v-popupview"));
view.click();
diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/BottomComponentScrollsUpTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/BottomComponentScrollsUpTest.java
index 4bf8802b9c..ec3c3bb1bd 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/window/BottomComponentScrollsUpTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/window/BottomComponentScrollsUpTest.java
@@ -1,5 +1,7 @@
package com.vaadin.tests.components.window;
+import static org.junit.Assert.assertEquals;
+
import java.io.IOException;
import org.junit.Test;
@@ -38,6 +40,7 @@ public class BottomComponentScrollsUpTest extends MultiBrowserTest {
Dimension verticalLayoutSize = verticalLayout.getSize();
panelScrollable.scroll(verticalLayoutSize.height);
+ int beforeClick = getScrollTop(panelScrollable);
WebElement button = verticalLayout
.findElement(By.className("v-button"));
@@ -50,6 +53,8 @@ public class BottomComponentScrollsUpTest extends MultiBrowserTest {
panelScrollableSize.height / 2)
.click().build().perform();
- compareScreen("window");
+ assertEquals(
+ "Clicking a button or the panel should not cause scrolling.",
+ beforeClick, getScrollTop(panelScrollable));
}
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java
index 379095f61b..1e5c92d16a 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java
@@ -1,10 +1,14 @@
package com.vaadin.tests.components.window;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
+import org.openqa.selenium.Point;
import org.openqa.selenium.WebElement;
import com.vaadin.testbench.By;
import com.vaadin.testbench.commands.TestBenchElementCommands;
+import com.vaadin.testbench.elements.WindowElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class ScrollingBodyElementWithModalOpenedTest extends MultiBrowserTest {
@@ -16,12 +20,21 @@ public class ScrollingBodyElementWithModalOpenedTest extends MultiBrowserTest {
WebElement bodyElement = driver
.findElement(By.className("v-modal-window-open"));
+ Point initial = $(WindowElement.class).first().getLocation();
+
TestBenchElementCommands scrollable = testBenchElement(bodyElement);
scrollable.scroll(1000);
Thread.sleep(1000);
- compareScreen("init");
+ Point current = $(WindowElement.class).first().getLocation();
+
+ assertEquals("Window moved along X-axis", initial.getX(),
+ current.getX());
+ assertEquals("Window moved along Y-axis", initial.getY(),
+ current.getY());
+
+ assertEquals("Body was scrolled", 0, getScrollTop(bodyElement));
}
}
diff --git a/uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java b/uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java
index 4a0b95fc73..bfa8ab4505 100644
--- a/uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java
@@ -3,6 +3,9 @@ package com.vaadin.tests.fieldgroup;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.text.SimpleDateFormat;
+import java.util.Locale;
+
import org.junit.Test;
import org.openqa.selenium.WebElement;
@@ -14,6 +17,9 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
public class DateFormTest extends MultiBrowserTest {
+ private final SimpleDateFormat FORMAT = new SimpleDateFormat(
+ "MMM dd, yyyy h:mm:ss a");
+
@Test
public void testCorrectDateFormat() throws Exception {
openTestURL();
@@ -26,8 +32,9 @@ public class DateFormTest extends MultiBrowserTest {
assertTrue("Unexpected InlineDateField state, 20th not selected.",
hasCssClass(day20,
"v-inline-datefield-calendarpanel-day-selected"));
+ // Depends on the TZ offset on the server
assertEquals("Unexpected TextField contents,",
- "Jan 20, 1984 4:34:49 PM",
+ FORMAT.format(DateForm.DATE),
$(TextFieldElement.class).first().getValue());
}
diff --git a/uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java b/uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java
index eece869929..06af403ba6 100644
--- a/uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java
@@ -7,17 +7,15 @@ import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
-import java.util.TimeZone;
import java.util.stream.Collectors;
import org.junit.Test;
-import org.openqa.selenium.JavascriptExecutor;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class SerializerTestTest extends MultiBrowserTest {
- private static final SimpleDateFormat FORMAT = new SimpleDateFormat(
+ private final SimpleDateFormat FORMAT = new SimpleDateFormat(
"EEE MMM dd HH:mm:ss 'GMT'Z yyyy", new Locale("en", "fi"));
@Test
@@ -129,15 +127,6 @@ public class SerializerTestTest extends MultiBrowserTest {
getLogRow(logRow++));
}
- private TimeZone getBrowserTimeZone() {
- // Ask TimeZone from browser
- String browserTimeZone = ((JavascriptExecutor) getDriver())
- .executeScript(
- "return Intl.DateTimeFormat().resolvedOptions().timeZone;")
- .toString();
- return TimeZone.getTimeZone(browserTimeZone);
- }
-
private String formatDate(Date date) {
// JavaScript formatting drops leading 0 from offset
return FORMAT.format(date).replaceAll("(GMT[+-])0", "$1");
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java
index d825f2959f..6459b6affb 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -16,6 +16,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.TimeZone;
import java.util.logging.Level;
import org.apache.commons.io.IOUtils;
@@ -1171,6 +1172,11 @@ public abstract class AbstractTB3Test extends ParallelTest {
element)).intValue();
}
+ protected int getScrollTop(WebElement element) {
+ return ((Number) executeScript("return arguments[0].scrollTop;",
+ element)).intValue();
+ }
+
/**
* Returns client height rounded up instead of as double because of IE9
* issues: https://dev.vaadin.com/ticket/18469
@@ -1193,6 +1199,15 @@ public abstract class AbstractTB3Test extends ParallelTest {
return ((Number) executeScript(script, e)).intValue();
}
+ protected TimeZone getBrowserTimeZone() {
+ // Ask TimeZone from browser
+ String browserTimeZone = ((JavascriptExecutor) getDriver())
+ .executeScript(
+ "return Intl.DateTimeFormat().resolvedOptions().timeZone;")
+ .toString();
+ return TimeZone.getTimeZone(browserTimeZone);
+ }
+
protected void assertElementsEquals(WebElement expectedElement,
WebElement actualElement) {
while (expectedElement instanceof WrapsElement) {