@@ -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> | |||
@@ -510,16 +504,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> |
@@ -30,11 +30,6 @@ | |||
</repository> | |||
</repositories> | |||
<prerequisites> | |||
<!-- phantomjs-maven-plugin required maven 3.1 or newer --> | |||
<maven>3.1</maven> | |||
</prerequisites> | |||
<dependencies> | |||
<!-- API DEPENDENCIES --> | |||
@@ -312,7 +307,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> |
@@ -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)); | |||
} | |||
@@ -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(); | |||
} |
@@ -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(); |
@@ -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)); | |||
} | |||
} |
@@ -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)); | |||
} | |||
} |
@@ -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()); | |||
} | |||
@@ -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"); |
@@ -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) { |