Browse Source

Fix valdiation builds to use correct browser (#11000)

tags/8.5.0.alpha2
Teemu Suo-Anttila 5 years ago
parent
commit
54ae358e34
18 changed files with 75 additions and 34 deletions
  1. 23
    10
      pom.xml
  2. 0
    6
      uitest/pom.xml
  3. BIN
      uitest/reference-screenshots/chrome/BottomComponentScrollsUpTest-windowScrollTest_ANY_Chrome__window.png
  4. BIN
      uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__paperplane_1.png
  5. BIN
      uitest/reference-screenshots/chrome/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_ANY_Chrome__init.png
  6. BIN
      uitest/reference-screenshots/firefox/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_ANY_Firefox__init.png
  7. BIN
      uitest/reference-screenshots/internetexplorer/BottomComponentScrollsUpTest-windowScrollTest_Windows_InternetExplorer_11_window.png
  8. BIN
      uitest/reference-screenshots/internetexplorer/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_Windows_InternetExplorer_11_init.png
  9. BIN
      uitest/reference-screenshots/phantomjs/BottomComponentScrollsUpTest-windowScrollTest_LINUX_PhantomJS_1_window.png
  10. BIN
      uitest/reference-screenshots/phantomjs/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_LINUX_PhantomJS_1_init.png
  11. 3
    3
      uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java
  12. 3
    0
      uitest/src/main/java/com/vaadin/tests/util/TestDataGenerator.java
  13. 2
    0
      uitest/src/test/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheetTest.java
  14. 6
    1
      uitest/src/test/java/com/vaadin/tests/components/window/BottomComponentScrollsUpTest.java
  15. 14
    1
      uitest/src/test/java/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java
  16. 8
    1
      uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java
  17. 1
    12
      uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java
  18. 15
    0
      uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java

+ 23
- 10
pom.xml View File

@@ -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>
@@ -397,11 +396,6 @@
<artifactId>maven-failsafe-plugin</artifactId>
<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>
@@ -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>

+ 0
- 6
uitest/pom.xml View File

@@ -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>

BIN
uitest/reference-screenshots/chrome/BottomComponentScrollsUpTest-windowScrollTest_ANY_Chrome__window.png View File


BIN
uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__paperplane_1.png View File


BIN
uitest/reference-screenshots/chrome/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_ANY_Chrome__init.png View File


BIN
uitest/reference-screenshots/firefox/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_ANY_Firefox__init.png View File


BIN
uitest/reference-screenshots/internetexplorer/BottomComponentScrollsUpTest-windowScrollTest_Windows_InternetExplorer_11_window.png View File


BIN
uitest/reference-screenshots/internetexplorer/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_Windows_InternetExplorer_11_init.png View File


BIN
uitest/reference-screenshots/phantomjs/BottomComponentScrollsUpTest-windowScrollTest_LINUX_PhantomJS_1_window.png View File


BIN
uitest/reference-screenshots/phantomjs/ScrollingBodyElementWithModalOpenedTest-testWindowScrollbars_LINUX_PhantomJS_1_init.png View File


+ 3
- 3
uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java View File

@@ -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));
}


+ 3
- 0
uitest/src/main/java/com/vaadin/tests/util/TestDataGenerator.java View File

@@ -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();
}

+ 2
- 0
uitest/src/test/java/com/vaadin/tests/components/popupview/PopUpViewInTabsheetTest.java View File

@@ -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();

+ 6
- 1
uitest/src/test/java/com/vaadin/tests/components/window/BottomComponentScrollsUpTest.java View File

@@ -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));
}
}

+ 14
- 1
uitest/src/test/java/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java View File

@@ -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));
}

}

+ 8
- 1
uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java View File

@@ -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());
}


+ 1
- 12
uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java View File

@@ -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");

+ 15
- 0
uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java View File

@@ -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) {

Loading…
Cancel
Save