summaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2018-06-27 11:36:02 +0300
committerIlia Motornyi <elmot@vaadin.com>2018-06-27 11:36:02 +0300
commit54ae358e344f813682e93fb7e24e3c679620f1f2 (patch)
treea0aa5ba74c4f62766ac57b25a3d252ddc35192db /uitest/src
parentdee4a2caa80066bcdd031ec445c8bf80ba313ab9 (diff)
downloadvaadin-framework-54ae358e344f813682e93fb7e24e3c679620f1f2.tar.gz
vaadin-framework-54ae358e344f813682e93fb7e24e3c679620f1f2.zip
Fix valdiation builds to use correct browser (#11000)
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java6
-rw-r--r--uitest/src/main/java/com/vaadin/tests/util/TestDataGenerator.java3
-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
8 files changed, 52 insertions, 18 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java b/uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java
index 5262ed76af..5e32f377ae 100644
--- a/uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java
+++ b/uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java
@@ -20,6 +20,7 @@ import com.vaadin.v7.ui.TextField;
public class DateForm extends AbstractTestUIWithLog {
+ static final Date DATE = new Date(443457289789L);
@PropertyId("date1")
private DateField dateField;
@PropertyId("date2")
@@ -108,9 +109,8 @@ public class DateForm extends AbstractTestUIWithLog {
addComponent(discardButton);
addComponent(showBean);
- DateObject d = new DateObject(new Date(443457289789L),
- new Date(443543689789L), new Date(443457289789L),
- new Date(443457289789L));
+ DateObject d = new DateObject(DATE, new Date(443543689789L), DATE,
+ DATE);
fieldGroup.setItemDataSource(new BeanItem<>(d));
}
diff --git a/uitest/src/main/java/com/vaadin/tests/util/TestDataGenerator.java b/uitest/src/main/java/com/vaadin/tests/util/TestDataGenerator.java
index 6e7b6ef31a..91912a0c2b 100644
--- a/uitest/src/main/java/com/vaadin/tests/util/TestDataGenerator.java
+++ b/uitest/src/main/java/com/vaadin/tests/util/TestDataGenerator.java
@@ -80,6 +80,9 @@ public class TestDataGenerator {
c.set(Calendar.YEAR, r.nextInt(100) + 1900);
c.set(Calendar.MONTH, r.nextInt(12));
c.set(Calendar.DAY_OF_MONTH, r.nextInt(31));
+ c.set(Calendar.HOUR_OF_DAY, 11);
+ c.set(Calendar.HOUR, 11);
+ c.set(Calendar.AM_PM, Calendar.AM);
return c.getTime();
}
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 768624f3dc..bce227b939 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;
@@ -1183,6 +1184,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
@@ -1205,6 +1211,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) {