diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2018-06-27 11:36:02 +0300 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2018-06-27 11:36:02 +0300 |
commit | 54ae358e344f813682e93fb7e24e3c679620f1f2 (patch) | |
tree | a0aa5ba74c4f62766ac57b25a3d252ddc35192db | |
parent | dee4a2caa80066bcdd031ec445c8bf80ba313ab9 (diff) | |
download | vaadin-framework-54ae358e344f813682e93fb7e24e3c679620f1f2.tar.gz vaadin-framework-54ae358e344f813682e93fb7e24e3c679620f1f2.zip |
Fix valdiation builds to use correct browser (#11000)
18 files changed, 75 insertions, 34 deletions
@@ -52,7 +52,6 @@ too early in case of errors --> <!-- See e.g. https://issues.apache.org/jira/browse/SOLR-8453 --> <jetty.version>9.2.9.v20150224</jetty.version> - <phantomjs.version>2.1.1</phantomjs.version> <!-- Sonar properties --> <sonar.java.source>8</sonar.java.source> @@ -398,11 +397,6 @@ <version>2.19.1</version> </plugin> <plugin> - <groupId>com.github.klieber</groupId> - <artifactId>phantomjs-maven-plugin</artifactId> - <version>0.7</version> - </plugin> - <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.8</version> </plugin> @@ -542,16 +536,35 @@ <pluginExecution> <pluginExecutionFilter> <groupId> - com.github.klieber + net.revelc.code.formatter + </groupId> + <artifactId> + formatter-maven-plugin + </artifactId> + <versionRange> + [2.7.2,) + </versionRange> + <goals> + <goal>format</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore></ignore> + </action> + </pluginExecution> + <pluginExecution> + <pluginExecutionFilter> + <groupId> + com.github.dantwining.whitespace-maven-plugin </groupId> <artifactId> - phantomjs-maven-plugin + whitespace-maven-plugin </artifactId> <versionRange> - [0.7,) + [1.0.4,) </versionRange> <goals> - <goal>install</goal> + <goal>trim</goal> </goals> </pluginExecutionFilter> <action> diff --git a/uitest/pom.xml b/uitest/pom.xml index 4a859230cc..630d83144d 100644 --- a/uitest/pom.xml +++ b/uitest/pom.xml @@ -30,11 +30,6 @@ </repository> </repositories> - <prerequisites> - <!-- phantomjs-maven-plugin required maven 3.1 or newer --> - <maven>3.1</maven> - </prerequisites> - <dependencies> <!-- API DEPENDENCIES --> @@ -321,7 +316,6 @@ <browsers.exclude>${browsers.exclude}</browsers.exclude> <categories.include>${categories.include}</categories.include> <categories.exclude>${categories.exclude}</categories.exclude> - <useLocalWebDriver>${useLocalWebDriver}</useLocalWebDriver> <browserstack.identifier>${browserstack.identifier}</browserstack.identifier> </systemPropertyVariables> <includes> diff --git a/uitest/reference-screenshots/chrome/BottomComponentScrollsUpTest-windowScrollTest_ANY_Chrome__window.png b/uitest/reference-screenshots/chrome/BottomComponentScrollsUpTest-windowScrollTest_ANY_Chrome__window.png Binary files differdeleted file mode 100755 index 0a69bccd77..0000000000 --- a/uitest/reference-screenshots/chrome/BottomComponentScrollsUpTest-windowScrollTest_ANY_Chrome__window.png +++ /dev/null diff --git a/uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__paperplane_1.png b/uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__paperplane_1.png Binary files differnew file mode 100644 index 0000000000..847c2f05dc --- /dev/null +++ b/uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__paperplane_1.png diff --git a/uitest/reference-screenshots/chrome/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_ANY_Chrome__init.png b/uitest/reference-screenshots/chrome/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_ANY_Chrome__init.png Binary files differdeleted file mode 100755 index 9c5011d716..0000000000 --- a/uitest/reference-screenshots/chrome/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_ANY_Chrome__init.png +++ /dev/null diff --git a/uitest/reference-screenshots/firefox/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_ANY_Firefox__init.png b/uitest/reference-screenshots/firefox/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_ANY_Firefox__init.png Binary files differdeleted file mode 100644 index 46f045bca6..0000000000 --- a/uitest/reference-screenshots/firefox/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_ANY_Firefox__init.png +++ /dev/null diff --git a/uitest/reference-screenshots/internetexplorer/BottomComponentScrollsUpTest-windowScrollTest_Windows_InternetExplorer_11_window.png b/uitest/reference-screenshots/internetexplorer/BottomComponentScrollsUpTest-windowScrollTest_Windows_InternetExplorer_11_window.png Binary files differdeleted file mode 100755 index 163a6c60b9..0000000000 --- a/uitest/reference-screenshots/internetexplorer/BottomComponentScrollsUpTest-windowScrollTest_Windows_InternetExplorer_11_window.png +++ /dev/null diff --git a/uitest/reference-screenshots/internetexplorer/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_Windows_InternetExplorer_11_init.png b/uitest/reference-screenshots/internetexplorer/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_Windows_InternetExplorer_11_init.png Binary files differdeleted file mode 100755 index f0533a0f23..0000000000 --- a/uitest/reference-screenshots/internetexplorer/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_Windows_InternetExplorer_11_init.png +++ /dev/null diff --git a/uitest/reference-screenshots/phantomjs/BottomComponentScrollsUpTest-windowScrollTest_LINUX_PhantomJS_1_window.png b/uitest/reference-screenshots/phantomjs/BottomComponentScrollsUpTest-windowScrollTest_LINUX_PhantomJS_1_window.png Binary files differdeleted file mode 100644 index 3f87eedd11..0000000000 --- a/uitest/reference-screenshots/phantomjs/BottomComponentScrollsUpTest-windowScrollTest_LINUX_PhantomJS_1_window.png +++ /dev/null diff --git a/uitest/reference-screenshots/phantomjs/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_LINUX_PhantomJS_1_init.png b/uitest/reference-screenshots/phantomjs/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_LINUX_PhantomJS_1_init.png Binary files differdeleted file mode 100644 index b592e536d6..0000000000 --- a/uitest/reference-screenshots/phantomjs/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_LINUX_PhantomJS_1_init.png +++ /dev/null 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) { |