summaryrefslogtreecommitdiffstats
path: root/uitest/src/test
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2018-09-04 16:26:17 +0300
committerIlia Motornyi <elmot@vaadin.com>2018-09-04 16:26:17 +0300
commitd14892408fca6172209b465235f50d6d596edfe5 (patch)
treeab6142960f04325fa4b53e5fbf2b3573b9064759 /uitest/src/test
parentdc4e6036a5806f8ff6a5c5b1d219a038f39a978f (diff)
downloadvaadin-framework-d14892408fca6172209b465235f50d6d596edfe5.tar.gz
vaadin-framework-d14892408fca6172209b465235f50d6d596edfe5.zip
Use Chrome for validation builds
Diffstat (limited to 'uitest/src/test')
-rw-r--r--uitest/src/test/java/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java3
-rw-r--r--uitest/src/test/java/com/vaadin/tests/application/TimingInfoReportedTest.java4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/application/WebBrowserTimeZoneTest.java21
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/abstractfield/ShortcutWhenBodyFocusedTest.java5
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java6
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridThemeChangeTest.java6
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridSortingIndicatorsTest.java7
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridClientContextMenuEventTest.java6
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java6
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicatorTest.java1
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptPreloadingTest.java5
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/label/LabelTooltipTest.java4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectPushSelectionChangesTest.java4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValoTest.java13
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarTooltipsNearEdgeTest.java39
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/menubar/MenuTooltipTest.java20
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectNullTest.java5
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/orderedlayout/ErrorIndicatorTest.java10
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java9
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansionTest.java4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/table/CustomTableElement.java19
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java25
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetFocusedTabTest.java7
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowedTest.java3
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java2
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportEmptyTest.java37
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportTest.java27
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationModifierKeysTest.java2
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java7
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/ui/WindowAndUIShortcutsTest.java26
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/upload/InterruptUploadTest.java53
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/upload/TestFileUploadTest.java6
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/upload/UploadInTabsheetTest.java6
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/window/WindowShadowTest.java25
-rw-r--r--uitest/src/test/java/com/vaadin/tests/core/SpecialCharactersEncodingUITest.java7
-rw-r--r--uitest/src/test/java/com/vaadin/tests/customelements/CustomProgressBarElement.java18
-rw-r--r--uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdateTest.java2
-rw-r--r--uitest/src/test/java/com/vaadin/tests/extensions/SetThemeAndResponsiveLayoutTest.java7
-rw-r--r--uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridTest.java4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java27
-rw-r--r--uitest/src/test/java/com/vaadin/tests/integration/ParameterizedTB3Runner.java5
-rw-r--r--uitest/src/test/java/com/vaadin/tests/layoutmanager/ConcurrentModificationUITest.java5
-rw-r--r--uitest/src/test/java/com/vaadin/tests/layouts/RelativeSizeInUndefinedCssLayoutTest.java4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/push/ReconnectLongPollingTest.java9
-rwxr-xr-xuitest/src/test/java/com/vaadin/tests/push/ReconnectStreamingTest.java9
-rw-r--r--uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java164
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java23
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserTest.java18
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTest.java7
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTestWithProxy.java7
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java61
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/RetryOnFail.java49
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/ScreenshotTB3Test.java149
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/SingleBrowserTest.java2
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/SingleBrowserTestPhantomJS2.java14
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/TB3Runner.java65
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/VaadinBrowserFactory.java2
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/XvfbHubBrowserFactory.java24
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/newelements/WindowElement.java4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java2
-rw-r--r--uitest/src/test/java/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java7
-rw-r--r--uitest/src/test/java/com/vaadin/tests/themes/valo/ResponsiveStylesTest.java5
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java27
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tooltip/StationaryTooltipTest.java46
66 files changed, 451 insertions, 753 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java b/uitest/src/test/java/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java
index 1231b0036e..0250889a6c 100644
--- a/uitest/src/test/java/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java
@@ -16,8 +16,7 @@ public class ActionsOnInvisibleComponentsTest extends MultiBrowserTest {
// This method should be removed once #12785 is fixed
@Override
public List<DesiredCapabilities> getBrowsersToTest() {
- return getBrowserCapabilities(Browser.IE9, Browser.IE10, Browser.IE11,
- Browser.PHANTOMJS);
+ return getBrowserCapabilities(Browser.IE9, Browser.IE10, Browser.IE11);
}
@Test
diff --git a/uitest/src/test/java/com/vaadin/tests/application/TimingInfoReportedTest.java b/uitest/src/test/java/com/vaadin/tests/application/TimingInfoReportedTest.java
index 15d6e383ca..6298c461d2 100644
--- a/uitest/src/test/java/com/vaadin/tests/application/TimingInfoReportedTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/application/TimingInfoReportedTest.java
@@ -1,12 +1,12 @@
package com.vaadin.tests.application;
+import com.vaadin.tests.tb3.SingleBrowserTest;
import org.junit.Assert;
import org.junit.Test;
import com.vaadin.testbench.elements.ButtonElement;
-import com.vaadin.tests.tb3.SingleBrowserTestPhantomJS2;
-public class TimingInfoReportedTest extends SingleBrowserTestPhantomJS2 {
+public class TimingInfoReportedTest extends SingleBrowserTest {
@Test
public void ensureTimingsAvailable() {
diff --git a/uitest/src/test/java/com/vaadin/tests/application/WebBrowserTimeZoneTest.java b/uitest/src/test/java/com/vaadin/tests/application/WebBrowserTimeZoneTest.java
index 10b6dfb7a9..f15968256c 100644
--- a/uitest/src/test/java/com/vaadin/tests/application/WebBrowserTimeZoneTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/application/WebBrowserTimeZoneTest.java
@@ -6,22 +6,31 @@ import org.junit.Test;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.LabelElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
+import org.openqa.selenium.JavascriptExecutor;
public class WebBrowserTimeZoneTest extends MultiBrowserTest {
@Test
- public void testBrowserTimeZoneInfo() throws Exception {
+ public void testBrowserTimeZoneInfo() {
openTestURL();
$(ButtonElement.class).first().click();
- assertLabelText("Browser raw offset", "7200000");
- assertLabelText("Browser to Europe/Helsinki offset difference", "0");
- assertLabelText("Browser could be in Helsinki", "Yes");
+
+ // Ask TimeZone from browser
+ String tzOffset = ((JavascriptExecutor) getDriver())
+ .executeScript("return new Date().getTimezoneOffset()")
+ .toString();
+
+ // Translate the same way as Vaadin should
+ int offsetMillis = -Integer.parseInt(tzOffset) * 60 * 1000;
+
+ // Check that server got the same value.
+ assertLabelText("Browser offset", offsetMillis);
}
- private void assertLabelText(String caption, String expected) {
+ private void assertLabelText(String caption, int expected) {
String actual = $(LabelElement.class).caption(caption).first()
.getText();
Assert.assertEquals(
String.format("Unexpected text in label '%s',", caption),
- expected, actual);
+ "" + expected, actual);
}
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/abstractfield/ShortcutWhenBodyFocusedTest.java b/uitest/src/test/java/com/vaadin/tests/components/abstractfield/ShortcutWhenBodyFocusedTest.java
index 9b186514e0..e508350825 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/abstractfield/ShortcutWhenBodyFocusedTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/abstractfield/ShortcutWhenBodyFocusedTest.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.components.abstractfield;
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import com.vaadin.testbench.elements.ButtonElement;
@@ -17,11 +18,11 @@ public class ShortcutWhenBodyFocusedTest extends SingleBrowserTest {
b.click();
Assert.assertEquals("1. Hello clicked", getLogRow(0));
- b.sendKeys("A");
+ b.sendKeys("a");
Assert.assertEquals("2. Hello clicked", getLogRow(0));
WebElement body = findElement(By.xpath("//body"));
- body.sendKeys("A");
+ body.sendKeys("a");
Assert.assertEquals("3. Hello clicked", getLogRow(0));
}
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java
index 187d6d40f4..b191e87217 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java
@@ -5,16 +5,16 @@ import static org.hamcrest.collection.IsEmptyCollection.empty;
import java.util.List;
+import com.vaadin.tests.tb3.SingleBrowserTest;
import org.junit.Test;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import com.vaadin.testbench.By;
-import com.vaadin.tests.tb3.SingleBrowserTestPhantomJS2;
import com.vaadin.tests.tb3.newelements.ComboBoxElement;
public class ComboBoxEmptyItemsKeyboardNavigationTest
- extends SingleBrowserTestPhantomJS2 {
+ extends SingleBrowserTest {
@Test
public void navigatingUpOnAnEmptyMenuDoesntThrowErrors() {
diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java
index e4e623440a..e27aab0f5a 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java
@@ -56,11 +56,11 @@ public class ComboboxPopupScrollingTest extends MultiBrowserTest {
Point newComboLocation = cb.getLocation();
Point newPopupLocation = popup.getLocation();
- assertNotEquals("ComboBox didn't move on the page", 0,
- newComboLocation.y - comboLocation.y);
+ assertNotEquals("ComboBox didn't move on the page", comboLocation.y,
+ newComboLocation.y);
assertEquals("Popup didn't move with the combo box",
newComboLocation.y - comboLocation.y,
- newPopupLocation.y - popupLocation.y);
+ newPopupLocation.y - popupLocation.y, 1);
}
private void testNoScrollbars(String theme) {
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridThemeChangeTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridThemeChangeTest.java
index ae61954ee0..ea0c148556 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridThemeChangeTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridThemeChangeTest.java
@@ -12,12 +12,6 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
@TestCategory("grid")
public class GridThemeChangeTest extends MultiBrowserTest {
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- // Seems like stylesheet onload is not fired on PhantomJS
- // https://github.com/ariya/phantomjs/issues/12332
- return super.getBrowsersExcludingPhantomJS();
- }
@Test
public void testThemeChange() {
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridSortingIndicatorsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridSortingIndicatorsTest.java
index 4b50a62cdc..4c407bdbe4 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridSortingIndicatorsTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridSortingIndicatorsTest.java
@@ -13,13 +13,6 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
@TestCategory("grid")
public class GridSortingIndicatorsTest extends MultiBrowserTest {
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- List<DesiredCapabilities> browsers = getBrowsersExcludingPhantomJS();
- browsers.add(PHANTOMJS2());
- return browsers;
- }
-
@Test
public void testSortingIndicators() throws IOException {
openTestURL();
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridClientContextMenuEventTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridClientContextMenuEventTest.java
index c0faa5b064..70aa6c9e36 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridClientContextMenuEventTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridClientContextMenuEventTest.java
@@ -14,12 +14,6 @@ import com.vaadin.tests.components.grid.basicfeatures.GridBasicClientFeaturesTes
public class GridClientContextMenuEventTest
extends GridBasicClientFeaturesTest {
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- // PhantomJS doesn't support context click..
- return getBrowsersExcludingPhantomJS();
- }
-
@Test
public void testContextMenuEventIsHandledCorrectly() {
setDebug(true);
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java
index 8f467402e7..3c951e5a12 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java
@@ -60,10 +60,4 @@ public class GridSidebarThemeTest extends GridBasicFeaturesTest {
compareScreen(theme + "-SidebarClosed2");
}
-
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- // phantom JS looks wrong from the beginning, so not tested
- return getBrowsersExcludingPhantomJS();
- }
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicatorTest.java b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicatorTest.java
index c88ea234f6..bb6c880ed1 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicatorTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicatorTest.java
@@ -12,6 +12,7 @@ public class JSComponentLoadingIndicatorTest extends SingleBrowserTest {
@Test
public void ensureLoadingIndicatorShown() {
openTestURL();
+ waitForElementPresent(By.id("js"));
testBench().disableWaitForVaadin();
WebElement js = findElement(By.id("js"));
diff --git a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptPreloadingTest.java b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptPreloadingTest.java
index 4c5b2cbd8f..528feabbe6 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptPreloadingTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptPreloadingTest.java
@@ -16,11 +16,6 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
public class JavaScriptPreloadingTest extends MultiBrowserTest {
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- return getBrowsersExcludingPhantomJS();
- }
-
@Test
public void scriptsShouldPreloadAndExecuteInCorrectOrder()
throws InterruptedException {
diff --git a/uitest/src/test/java/com/vaadin/tests/components/label/LabelTooltipTest.java b/uitest/src/test/java/com/vaadin/tests/components/label/LabelTooltipTest.java
index 1003c3aff1..f33b25c042 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/label/LabelTooltipTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/label/LabelTooltipTest.java
@@ -44,9 +44,7 @@ public class LabelTooltipTest extends MultiBrowserTest {
/*
* Some cases tooltip doesn't disappear without some extra mouse events
*/
- new Actions(getDriver()).moveByOffset(100, -40).perform();
- new Actions(getDriver()).moveToElement($(LabelElement.class).get(1))
- .click().perform();
+ $(LabelElement.class).get(1).showTooltip();
$(LabelElement.class).get(4).showTooltip();
Assert.assertEquals(
diff --git a/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectPushSelectionChangesTest.java b/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectPushSelectionChangesTest.java
index e16e532d72..2fa83e0321 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectPushSelectionChangesTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/listselect/ListSelectPushSelectionChangesTest.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.components.listselect;
import java.util.List;
+import com.vaadin.tests.tb3.SingleBrowserTest;
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
@@ -11,10 +12,9 @@ import org.openqa.selenium.support.ui.Select;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.ListSelectElement;
import com.vaadin.testbench.elements.OptionGroupElement;
-import com.vaadin.tests.tb3.SingleBrowserTestPhantomJS2;
public class ListSelectPushSelectionChangesTest
- extends SingleBrowserTestPhantomJS2 {
+ extends SingleBrowserTest {
@Test
public void testMultiSelectBehavior() {
openTestURL();
diff --git a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValoTest.java b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValoTest.java
index a9644fd2b9..2026fcc753 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValoTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValoTest.java
@@ -6,6 +6,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.interactions.HasInputDevices;
import org.openqa.selenium.interactions.Mouse;
import org.openqa.selenium.internal.Locatable;
@@ -38,20 +39,18 @@ public class MenuBarSubmenusClosingValoTest extends MultiBrowserTest {
public void testEnableParentLayoutControlByMouse() {
openTestURL();
- Mouse mouse = ((HasInputDevices) getDriver()).getMouse();
-
List<WebElement> menuItemList = driver
.findElements(By.className("v-menubar-menuitem"));
- mouse.click(((Locatable) menuItemList.get(0)).getCoordinates());
+ new Actions(getDriver()).moveToElement(menuItemList.get(1)).click()
+ .perform();
waitForElementPresent(By.className("v-menubar-popup"));
- mouse.mouseMove(((Locatable) menuItemList.get(1)).getCoordinates());
- mouse.mouseMove(((Locatable) menuItemList.get(2)).getCoordinates());
-
+ new Actions(getDriver()).moveToElement(menuItemList.get(1)).perform();
+ new Actions(getDriver()).moveToElement(menuItemList.get(2)).perform();
waitForElementPresent(By.className("v-menubar-popup"));
int count = driver.findElements(By.className("v-menubar-popup")).size();
- Assert.assertTrue("The count of open popups should be one", count == 1);
+ Assert.assertEquals("The count of open popups should be one", 1, count);
}
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarTooltipsNearEdgeTest.java b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarTooltipsNearEdgeTest.java
index c02d8ed1b7..2e36c366e2 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarTooltipsNearEdgeTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarTooltipsNearEdgeTest.java
@@ -3,16 +3,11 @@ package com.vaadin.tests.components.menubar;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThan;
import static org.junit.Assert.assertThat;
-
-import java.util.List;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.openqa.selenium.WebElement;
-import org.openqa.selenium.interactions.HasInputDevices;
-import org.openqa.selenium.interactions.Mouse;
-import org.openqa.selenium.interactions.internal.Coordinates;
-import org.openqa.selenium.internal.Locatable;
-import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.interactions.Actions;
import com.vaadin.testbench.elements.MenuBarElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -24,22 +19,24 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
*/
public class MenuBarTooltipsNearEdgeTest extends MultiBrowserTest {
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- // Tooltip test is unreliable on IE8
- return getBrowsersExcludingIE8();
- };
-
@Test
public void testTooltipLocation() {
openTestURL();
- Mouse mouse = ((HasInputDevices) getDriver()).getMouse();
- WebElement menu = $(MenuBarElement.class).first().getWrappedElement();
- Coordinates menuLocation = ((Locatable) menu).getCoordinates();
- mouse.click(menuLocation);
- mouse.mouseMove(menuLocation, 5, -40);
+
+ final MenuBarElement menuBar = $(MenuBarElement.class).first();
+ new Actions(getDriver()).moveToElement(menuBar).click()
+ .moveByOffset(0, -40).perform();
+
WebElement tooltip = getTooltipElement();
- assertThat(tooltip.getLocation().x, is(lessThan(
- menuLocation.onPage().x - tooltip.getSize().getWidth())));
+ assertTrue("Tooltip outside of the screen.",
+ tooltip.getLocation().getX() > 0
+ && tooltip.getLocation().getY() > 0);
+ assertThat("Tooltip too far to the right",
+ tooltip.getLocation().getX() + tooltip.getSize().getWidth(),
+ is(lessThan(menuBar.getLocation().getX()
+ + menuBar.getSize().getWidth() / 2)));
+ assertThat("Tooltip too low on the screen",
+ tooltip.getLocation().getY(),
+ is(lessThan(menuBar.getLocation().getY())));
}
-}
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuTooltipTest.java b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuTooltipTest.java
index fef1d3297e..c852dbb016 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuTooltipTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuTooltipTest.java
@@ -8,6 +8,7 @@ import static org.junit.Assert.assertThat;
import java.util.List;
import org.junit.Test;
+import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.interactions.HasInputDevices;
import org.openqa.selenium.interactions.Mouse;
import org.openqa.selenium.interactions.internal.Coordinates;
@@ -32,24 +33,21 @@ public class MenuTooltipTest extends MultiBrowserTest {
public void testToolTipDelay() throws InterruptedException {
openTestURL();
- Coordinates elementCoordinates = getCoordinates(
- $(MenuBarElement.class).first());
- sleep(1000);
-
- Mouse mouse = ((HasInputDevices) getDriver()).getMouse();
-
- mouse.click(elementCoordinates);
- mouse.mouseMove(elementCoordinates, 15, 40);
-
- sleep(1000);
+ final MenuBarElement menuBar = $(MenuBarElement.class).first();
+ // Open menu bar and move on top of the first menu item
+ new Actions(getDriver()).moveToElement(menuBar).click()
+ .moveByOffset(0, menuBar.getSize().getHeight()).perform();
+ // Make sure tooltip is outside of the screen
assertThat(getTooltipElement().getLocation().getX(),
is(lessThan(-1000)));
+ // Wait for tooltip to open up
sleep(3000);
+ // Make sure it's the correct tooltip
assertThat(getTooltipElement().getLocation().getX(),
- is(greaterThan(elementCoordinates.onPage().getX())));
+ is(greaterThan(menuBar.getLocation().getX())));
assertThat(getTooltipElement().getText(), is("TOOLTIP 1"));
}
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectNullTest.java b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectNullTest.java
index 613efbb566..5fd8179a4e 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectNullTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectNullTest.java
@@ -1,13 +1,12 @@
package com.vaadin.tests.components.nativeselect;
+import com.vaadin.tests.tb3.SingleBrowserTest;
import org.junit.Assert;
import org.junit.Test;
import com.vaadin.testbench.elements.NativeSelectElement;
-import com.vaadin.tests.tb3.SingleBrowserTest;
-import com.vaadin.tests.tb3.SingleBrowserTestPhantomJS2;
-public class NativeSelectNullTest extends SingleBrowserTestPhantomJS2 {
+public class NativeSelectNullTest extends SingleBrowserTest {
@Test
public void selectNull() {
openTestURL();
diff --git a/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/ErrorIndicatorTest.java b/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/ErrorIndicatorTest.java
index ae5cf232ad..9c3f4ec0e3 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/ErrorIndicatorTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/ErrorIndicatorTest.java
@@ -20,18 +20,12 @@ public class ErrorIndicatorTest extends MultiBrowserTest {
String tooltipText;
openTestURL();
- showTooltip($(TextFieldElement.class).first());
+ $(TextFieldElement.class).first().showTooltip();
tooltipText = driver.findElement(By.className("v-tooltip")).getText();
assertEquals(tooltipText, "Vertical layout tooltip");
- showTooltip($(TextFieldElement.class).get(1));
+ $(TextFieldElement.class).get(1).showTooltip();
tooltipText = driver.findElement(By.className("v-tooltip")).getText();
assertEquals(tooltipText, "Horizontal layout tooltip");
}
-
- private void showTooltip(WebElement element) {
- Coordinates elementCoordinates = ((Locatable) element).getCoordinates();
- Mouse mouse = ((HasInputDevices) getDriver()).getMouse();
- mouse.mouseMove(elementCoordinates);
- }
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java b/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java
index 05c679dfb7..607f0d9c85 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java
@@ -8,9 +8,7 @@ import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
-import org.openqa.selenium.interactions.HasInputDevices;
-import org.openqa.selenium.interactions.internal.Coordinates;
-import org.openqa.selenium.internal.Locatable;
+import org.openqa.selenium.interactions.Actions;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -29,8 +27,7 @@ public class NestedLayoutCaptionHoverTest extends MultiBrowserTest {
assertEquals("inner layout", caption.getText());
// Hover over the caption
- Coordinates coords = ((Locatable) caption).getCoordinates();
- ((HasInputDevices) getDriver()).getMouse().mouseMove(coords);
+ new Actions(getDriver()).moveToElement(caption).perform();
sleep(1000);
String selector = "Root/VNotification[0]";
@@ -43,4 +40,4 @@ public class NestedLayoutCaptionHoverTest extends MultiBrowserTest {
assertTrue(e.getMessage().contains(selector));
}
}
-}
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansionTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansionTest.java
index cf2fbc574a..3e38969bc5 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansionTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansionTest.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.components.table;
import java.io.IOException;
+import com.vaadin.testbench.elements.TableElement;
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.JavascriptExecutor;
@@ -10,7 +11,6 @@ import org.openqa.selenium.WebElement;
import com.vaadin.testbench.TestBenchElement;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.parallel.BrowserUtil;
-import com.vaadin.tests.components.table.CustomTableElement.ContextMenuElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class ColumnCollapsingAndColumnExpansionTest extends MultiBrowserTest {
@@ -40,7 +40,7 @@ public class ColumnCollapsingAndColumnExpansionTest extends MultiBrowserTest {
show2.click();
} else {
contextClick(table.getCell(0, 0));
- ContextMenuElement contextMenu = table.getContextMenu();
+ TableElement.ContextMenuElement contextMenu = table.getContextMenu();
WebElement i = contextMenu.getItem(0);
i.click();
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/CustomTableElement.java b/uitest/src/test/java/com/vaadin/tests/components/table/CustomTableElement.java
index 7196c8b61d..0ffd7c91cb 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/table/CustomTableElement.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/table/CustomTableElement.java
@@ -4,7 +4,6 @@ import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import com.vaadin.testbench.elements.TableElement;
-import com.vaadin.testbench.elementsbase.AbstractElement;
import com.vaadin.testbench.elementsbase.ServerClass;
@ServerClass("com.vaadin.ui.Table")
@@ -17,26 +16,10 @@ public class CustomTableElement extends TableElement {
return wrapElement(cm, getCommandExecutor()).wrap(CollapseMenu.class);
}
- public static class CollapseMenu extends ContextMenuElement {
+ public static class CollapseMenu extends TableElement.ContextMenuElement {
}
public WebElement getCollapseMenuToggle() {
return findElement(By.className("v-table-column-selector"));
}
-
- public static class ContextMenuElement extends AbstractElement {
-
- public WebElement getItem(int index) {
- return findElement(
- By.xpath(".//table//tr[" + (index + 1) + "]//td/*"));
- }
-
- }
-
- public ContextMenuElement getContextMenu() {
- WebElement cm = getDriver().findElement(By.className("v-contextmenu"));
- return wrapElement(cm, getCommandExecutor())
- .wrap(ContextMenuElement.class);
- }
-
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java
index f7bd6db9b1..628422aa3c 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java
@@ -1,18 +1,14 @@
package com.vaadin.tests.components.tabsheet;
import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import java.io.IOException;
-import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
-import org.openqa.selenium.interactions.HasInputDevices;
-import org.openqa.selenium.interactions.Mouse;
-import org.openqa.selenium.interactions.internal.Coordinates;
-import org.openqa.selenium.internal.Locatable;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -33,14 +29,14 @@ public class TabSheetErrorTooltipTest extends MultiBrowserTest {
}
private void assertTabHasTooltipAndError(int index, String tooltip,
- String errorMessage) {
- showTooltip(index);
+ String errorMessage) {
+ testBenchElement(getTab(index)).showTooltip();
assertTooltip(tooltip);
assertErrorMessage(errorMessage);
}
private void assertTabHasNoTooltipNorError(int index) {
- showTooltip(index);
+ testBenchElement(getTab(index)).showTooltip();
WebElement tooltip = getCurrentTooltip();
assertThat(tooltip.getText(), is(""));
@@ -50,13 +46,6 @@ public class TabSheetErrorTooltipTest extends MultiBrowserTest {
}
- private void showTooltip(int index) {
- Coordinates elementCoordinates = ((Locatable) getTab(index))
- .getCoordinates();
- Mouse mouse = ((HasInputDevices) getDriver()).getMouse();
- mouse.mouseMove(elementCoordinates);
- }
-
private WebElement getTab(int index) {
return vaadinElement(
"/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild["
@@ -74,10 +63,10 @@ public class TabSheetErrorTooltipTest extends MultiBrowserTest {
}
private void assertTooltip(String tooltip) {
- Assert.assertEquals(tooltip, getCurrentTooltip().getText());
+ assertEquals(tooltip, getCurrentTooltip().getText());
}
private void assertErrorMessage(String message) {
- Assert.assertEquals(message, getCurrentErrorMessage().getText());
+ assertEquals(message, getCurrentErrorMessage().getText());
}
-}
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetFocusedTabTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetFocusedTabTest.java
index 8488fd9e9b..7a551d2a4d 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetFocusedTabTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetFocusedTabTest.java
@@ -17,13 +17,6 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
public class TabSheetFocusedTabTest extends MultiBrowserTest {
@Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- // PhantomJS doesn't send Focus / Blur events when clicking or
- // navigating with keyboard
- return getBrowsersExcludingPhantomJS();
- }
-
- @Override
protected Class<?> getUIClass() {
return TabsheetScrolling.class;
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowedTest.java b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowedTest.java
index 61e69b2510..ed0484a302 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowedTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowedTest.java
@@ -10,6 +10,7 @@ import org.openqa.selenium.WebElement;
import com.vaadin.testbench.elements.CheckBoxElement;
import com.vaadin.testbench.elements.TreeElement;
import com.vaadin.tests.tb3.SingleBrowserTest;
+import org.openqa.selenium.interactions.Actions;
public class TreeHtmlContentAllowedTest extends SingleBrowserTest {
@@ -29,7 +30,7 @@ public class TreeHtmlContentAllowedTest extends SingleBrowserTest {
assertTreeCaptionTexts("Just text", "Some html", "Child element html");
// Expand the HTML parent
- findElements(By.className("v-tree-node")).get(1).click();
+ new Actions(getDriver()).moveToElement(findElements(By.className("v-tree-node")).get(1), 2, 2).click().perform();
assertTreeCaptionTexts("Just text", "Some html", "Child html",
"Child element html");
diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java
index a1f812d0f4..814c7db930 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java
@@ -47,7 +47,7 @@ public class ComboboxSelectedItemTextTest extends MultiBrowserTest {
public List<DesiredCapabilities> getBrowsersToTest() {
// Ignoring Chrome 40 because of a regression. See #16636.
return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10,
- Browser.IE11, Browser.FIREFOX, Browser.PHANTOMJS);
+ Browser.IE11, Browser.FIREFOX);
}
@Test
diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportEmptyTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportEmptyTest.java
deleted file mode 100644
index b5b3b11d22..0000000000
--- a/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportEmptyTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.vaadin.tests.components.ui;
-
-import java.util.List;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.remote.DesiredCapabilities;
-
-import com.vaadin.testbench.parallel.Browser;
-import com.vaadin.tests.tb3.MultiBrowserTest;
-
-public class DynamicViewportEmptyTest extends MultiBrowserTest {
-
- @Override
- protected Class<?> getUIClass() {
- return DynamicViewport.class;
- }
-
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- return getBrowserCapabilities(Browser.CHROME);
- }
-
- @Test
- public void testGeneratedEmptyViewport() {
- openTestURL();
-
- List<WebElement> viewportElements = findElements(
- By.cssSelector("meta[name=viewport]"));
-
- Assert.assertTrue("There should be no viewport tags",
- viewportElements.isEmpty());
- }
-
-}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportTest.java
index be6c32db7b..6df7f1a406 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/ui/DynamicViewportTest.java
@@ -1,6 +1,10 @@
package com.vaadin.tests.components.ui;
-import org.junit.Assert;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+import java.util.Locale;
+
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
@@ -16,7 +20,22 @@ public class DynamicViewportTest extends SingleBrowserTest {
WebElement viewportElement = findElement(
By.cssSelector("meta[name=viewport]"));
- Assert.assertTrue(
- viewportElement.getAttribute("content").contains("PhantomJS"));
+ String viewportContent = viewportElement.getAttribute("content")
+ .toLowerCase(Locale.ROOT);
+ String browserName = getDesiredCapabilities().getBrowserName()
+ .toLowerCase(Locale.ROOT);
+
+ assertTrue(viewportContent.contains(browserName));
+ }
+
+ @Test
+ public void testGeneratedEmptyViewport() {
+ openTestURL(DynamicViewport.VIEWPORT_DISABLE_PARAMETER);
+
+ List<WebElement> viewportElements = findElements(
+ By.cssSelector("meta[name=viewport]"));
+
+ assertTrue("There should be no viewport tags",
+ viewportElements.isEmpty());
}
-}
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationModifierKeysTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationModifierKeysTest.java
index e2f9266d35..af6c5040bc 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationModifierKeysTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationModifierKeysTest.java
@@ -56,7 +56,7 @@ public class TextAreaEventPropagationModifierKeysTest extends MultiBrowserTest {
public List<DesiredCapabilities> getBrowsersToTest() {
// IE8 and Firefox can't handle ctrl.
// IE9-11 has issues with shift and ctrl
- return getBrowserCapabilities(Browser.CHROME, Browser.PHANTOMJS);
+ return getBrowserCapabilities(Browser.CHROME);
}
@Override
diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java
index 7430f23db1..df44764b43 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java
@@ -5,20 +5,13 @@ import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
-import com.vaadin.tests.tb3.RetryOnFail;
public class TimeoutRedirectResetsOnActivityTest extends MultiBrowserTest {
- @Rule
- // Timing issues are really hard to resolve in a way that this test would be
- // 100% reliable on all browsers. Hence we shall allow one retry.
- public RetryOnFail retry = new RetryOnFail();
-
private int waitBeforeActivity = 4000;
private int communicationOverhead = 2000;
diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/WindowAndUIShortcutsTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/WindowAndUIShortcutsTest.java
index 46486ef706..e8040427d0 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/ui/WindowAndUIShortcutsTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/ui/WindowAndUIShortcutsTest.java
@@ -1,13 +1,14 @@
package com.vaadin.tests.components.ui;
-import org.junit.Assert;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
import com.vaadin.testbench.elements.ButtonElement;
-import com.vaadin.testbench.elements.TextFieldElement;
import com.vaadin.testbench.elements.WindowElement;
import com.vaadin.tests.tb3.SingleBrowserTest;
@@ -19,14 +20,13 @@ public class WindowAndUIShortcutsTest extends SingleBrowserTest {
$(ButtonElement.class).caption("Show page").first().click();
$(ButtonElement.class).caption("Open dialog window").first().click();
- WindowElement window = $(WindowElement.class).first();
- window.$(TextFieldElement.class).first().sendKeys(Keys.ESCAPE);
+ $(WindowElement.class).$(ButtonElement.class).first()
+ .sendKeys(Keys.ESCAPE);
// Window should have been closed
- Assert.assertTrue($(WindowElement.class).all().isEmpty());
+ assertTrue($(WindowElement.class).all().isEmpty());
// "Close page" should not have been clicked
- Assert.assertTrue(
- $(ButtonElement.class).caption("Close page").exists());
+ assertTrue($(ButtonElement.class).caption("Close page").exists());
}
@Test
@@ -37,10 +37,14 @@ public class WindowAndUIShortcutsTest extends SingleBrowserTest {
WebElement curtain = findElement(
By.className("v-window-modalitycurtain"));
- curtain.sendKeys(Keys.ESCAPE);
+
+ // Click in the curtain next to the window and send escape
+ new Actions(getDriver()).moveToElement(curtain,
+ $(WindowElement.class).first().getSize().getWidth() * 2, 0)
+ .click().sendKeys(Keys.ESCAPE).perform();
+
// "Close page" should not have been clicked
- Assert.assertTrue(
- $(ButtonElement.class).caption("Close page").exists());
+ assertTrue($(ButtonElement.class).caption("Close page").exists());
}
-}
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/components/upload/InterruptUploadTest.java b/uitest/src/test/java/com/vaadin/tests/components/upload/InterruptUploadTest.java
index ee8e0146a7..2e7891699e 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/upload/InterruptUploadTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/upload/InterruptUploadTest.java
@@ -1,45 +1,37 @@
package com.vaadin.tests.components.upload;
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.List;
-
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.tests.util.LoremIpsum;
import org.junit.Test;
import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.internal.WrapsElement;
-import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.LocalFileDetector;
import org.openqa.selenium.remote.RemoteWebElement;
-import com.vaadin.testbench.elements.ButtonElement;
-import com.vaadin.testbench.elements.LabelElement;
-import com.vaadin.testbench.elements.WindowElement;
-import com.vaadin.tests.tb3.MultiBrowserTest;
-import com.vaadin.tests.util.LoremIpsum;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
-public class InterruptUploadTest extends MultiBrowserTest {
+import static org.junit.Assert.assertTrue;
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- // PhantomJS fails to upload files for unknown reasons
- return getBrowsersExcludingPhantomJS();
- }
+public class InterruptUploadTest extends MultiBrowserTest {
@Test
public void testInterruptUpload() throws Exception {
openTestURL();
File tempFile = createTempFile();
- fillPathToUploadInput(tempFile.getPath());
+ // Schedule upload cancel in a second
+ ((JavascriptExecutor)getDriver()).executeScript("setTimeout( function () {window.document.querySelector(\".v-window .v-button\").click()},2000)");
- waitForElementPresent(By.className("v-window"));
+ fillPathToUploadInput(tempFile.getPath());
- $(ButtonElement.class).caption("Cancel").first().click();
+ // Wait for 3 seconds until everything is done.
+ Thread.sleep(3000);
String expected = " (counting interrupted at ";
String actual = $(LabelElement.class).caption("Line breaks counted")
@@ -47,15 +39,6 @@ public class InterruptUploadTest extends MultiBrowserTest {
assertTrue("Line break count note does not match expected (was: "
+ actual + ")", actual.contains(expected));
- $(WindowElement.class).first()
- .findElement(By.className("v-window-closebox")).click();
- waitForElementNotPresent(By.className("v-window"));
-
- tempFile = createTempFile();
- fillPathToUploadInput(tempFile.getPath());
-
- waitForElementPresent(By.className("v-window"));
- $(ButtonElement.class).caption("Cancel").first().click();
}
/**
@@ -80,7 +63,7 @@ public class InterruptUploadTest extends MultiBrowserTest {
return sb.toString();
}
- private void fillPathToUploadInput(String tempFileName) throws Exception {
+ private void fillPathToUploadInput(String tempFileName) {
// create a valid path in upload input element. Instead of selecting a
// file by some file browsing dialog, we use the local path directly.
WebElement input = getInput();
@@ -92,7 +75,7 @@ public class InterruptUploadTest extends MultiBrowserTest {
return getDriver().findElement(By.className("gwt-FileUpload"));
}
- private void setLocalFileDetector(WebElement element) throws Exception {
+ private void setLocalFileDetector(WebElement element) {
if (getRunLocallyBrowser() != null) {
return;
}
@@ -110,4 +93,4 @@ public class InterruptUploadTest extends MultiBrowserTest {
}
}
-}
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/components/upload/TestFileUploadTest.java b/uitest/src/test/java/com/vaadin/tests/components/upload/TestFileUploadTest.java
index 1b216679df..462260cd96 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/upload/TestFileUploadTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/upload/TestFileUploadTest.java
@@ -23,12 +23,6 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
public class TestFileUploadTest extends MultiBrowserTest {
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- // PhantomJS fails to upload files for unknown reasons
- return getBrowsersExcludingPhantomJS();
- }
-
@Test
public void testUploadAnyFile() throws Exception {
openTestURL();
diff --git a/uitest/src/test/java/com/vaadin/tests/components/upload/UploadInTabsheetTest.java b/uitest/src/test/java/com/vaadin/tests/components/upload/UploadInTabsheetTest.java
index b842f78550..12923317e4 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/upload/UploadInTabsheetTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/upload/UploadInTabsheetTest.java
@@ -38,12 +38,6 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
*/
public class UploadInTabsheetTest extends MultiBrowserTest {
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- // PhantomJS fails to upload files for unknown reasons
- return getBrowsersExcludingPhantomJS();
- }
-
@Test
public void testThatChangingTabAfterUploadDoesntCauseErrors()
throws Exception {
diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/WindowShadowTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/WindowShadowTest.java
index 2d0c57eabc..a74c2b4479 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/window/WindowShadowTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/window/WindowShadowTest.java
@@ -2,17 +2,12 @@ package com.vaadin.tests.components.window;
import java.awt.AWTException;
import java.io.IOException;
-import java.util.List;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebElement;
-import org.openqa.selenium.interactions.HasInputDevices;
-import org.openqa.selenium.interactions.Mouse;
-import org.openqa.selenium.interactions.internal.Coordinates;
-import org.openqa.selenium.internal.Locatable;
-import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.interactions.Actions;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -28,23 +23,15 @@ public class WindowShadowTest extends MultiBrowserTest {
WebElement wnd1Footer = wnd
.findElement(By.className("v-window-footer"));
Point startLoc = wnd.getLocation();
- Coordinates footerCoordinates = ((Locatable) wnd1Footer)
- .getCoordinates();
- Mouse mouse = ((HasInputDevices) getDriver()).getMouse();
- mouse.mouseDown(footerCoordinates);
- mouse.mouseMove(footerCoordinates, 200, 200);
- mouse.mouseUp(footerCoordinates);
+
+ new Actions(getDriver()).moveToElement(wnd1Footer).clickAndHold()
+ .moveByOffset(200, 200).release().perform();
+
Point endLoc = wnd.getLocation();
// don't compare to specific coordinate, because in IE9 and IE11
// the window position is random.
- // So, checkt that the window was moved
+ // So, check that the window was moved
org.junit.Assert.assertNotEquals(startLoc, endLoc);
}
- // IE8 doesn't support shadow-box css rule
- // ignore this browser in testing
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- return getBrowsersExcludingIE8();
- }
} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/core/SpecialCharactersEncodingUITest.java b/uitest/src/test/java/com/vaadin/tests/core/SpecialCharactersEncodingUITest.java
index f92e6cbcf5..12cfb45d07 100644
--- a/uitest/src/test/java/com/vaadin/tests/core/SpecialCharactersEncodingUITest.java
+++ b/uitest/src/test/java/com/vaadin/tests/core/SpecialCharactersEncodingUITest.java
@@ -1,21 +1,14 @@
package com.vaadin.tests.core;
-import java.util.Collections;
-import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.WebElement;
-import org.openqa.selenium.remote.DesiredCapabilities;
import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.LabelElement;
import com.vaadin.testbench.elements.MenuBarElement;
import com.vaadin.testbench.elements.TextFieldElement;
-import com.vaadin.testbench.parallel.Browser;
-import com.vaadin.tests.tb3.MultiBrowserTest;
import com.vaadin.tests.tb3.SingleBrowserTest;
-import com.vaadin.tests.tb3.SingleBrowserTestPhantomJS2;
public class SpecialCharactersEncodingUITest extends SingleBrowserTest {
diff --git a/uitest/src/test/java/com/vaadin/tests/customelements/CustomProgressBarElement.java b/uitest/src/test/java/com/vaadin/tests/customelements/CustomProgressBarElement.java
index 20bc92a723..a760fa6bf5 100644
--- a/uitest/src/test/java/com/vaadin/tests/customelements/CustomProgressBarElement.java
+++ b/uitest/src/test/java/com/vaadin/tests/customelements/CustomProgressBarElement.java
@@ -20,22 +20,4 @@ public class CustomProgressBarElement extends ProgressBarElement {
return Double.parseDouble(width.replace("%", "")) / 100.0;
}
- /**
- * @since 7.5.6
- * @param indicator
- * @param string
- * @return
- */
- private String getStyleAttribute(WebElement element, String styleName) {
- String style = element.getAttribute("style");
- String[] styles = style.split(";");
- for (String s : styles) {
- if (s.startsWith(styleName + ":")) {
- return s.substring(styleName.length() + 1).trim();
- }
- }
-
- return null;
- }
-
}
diff --git a/uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdateTest.java b/uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdateTest.java
index 42065903c3..d6afe9889e 100644
--- a/uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdateTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdateTest.java
@@ -23,7 +23,7 @@ public class ResponsiveLayoutUpdateTest extends MultiBrowserTest {
compareScreen("large");
// Resize below 600px width breakpoint
- testBench().resizeViewPortTo(400, 768);
+ testBench().resizeViewPortTo(550, 768);
waitUntil(new ExpectedCondition<Boolean>() {
@Override
diff --git a/uitest/src/test/java/com/vaadin/tests/extensions/SetThemeAndResponsiveLayoutTest.java b/uitest/src/test/java/com/vaadin/tests/extensions/SetThemeAndResponsiveLayoutTest.java
index 63f58bf9c7..e242bae94c 100644
--- a/uitest/src/test/java/com/vaadin/tests/extensions/SetThemeAndResponsiveLayoutTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/extensions/SetThemeAndResponsiveLayoutTest.java
@@ -24,13 +24,6 @@ public class SetThemeAndResponsiveLayoutTest extends MultiBrowserTest {
testBench().resizeViewPortTo(1024, 768);
}
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- // Seems like stylesheet onload is not fired on PhantomJS
- // https://github.com/ariya/phantomjs/issues/12332
- return getBrowsersExcludingPhantomJS();
- }
-
@Test
public void testWidthAndHeightRanges() throws Exception {
openTestURL();
diff --git a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridTest.java b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridTest.java
index 09767f5286..e654df886b 100644
--- a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridTest.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.fieldgroup;
import java.util.List;
+import com.vaadin.tests.tb3.SingleBrowserTest;
import org.junit.Assert;
import org.junit.Test;
@@ -9,9 +10,8 @@ import com.vaadin.testbench.AbstractHasTestBenchCommandExecutor;
import com.vaadin.testbench.elements.AbstractComponentElement;
import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.elements.TextFieldElement;
-import com.vaadin.tests.tb3.SingleBrowserTestPhantomJS2;
-public class BasicCrudGridTest extends SingleBrowserTestPhantomJS2 {
+public class BasicCrudGridTest extends SingleBrowserTest {
@Test
public void fieldsInitiallyEmpty() {
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 56ec53724e..9e854bfea8 100644
--- a/uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/fieldgroup/DateFormTest.java
@@ -1,33 +1,40 @@
package com.vaadin.tests.fieldgroup;
-import org.junit.Assert;
+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;
import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.DateFieldElement;
import com.vaadin.testbench.elements.InlineDateFieldElement;
-import com.vaadin.testbench.elements.PopupDateFieldElement;
import com.vaadin.testbench.elements.TextFieldElement;
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();
- Assert.assertEquals("Unexpected DateField value,", "1/20/84",
+ assertEquals("Unexpected DateField value,", "1/20/84",
getDateFieldValue());
- Assert.assertEquals("Unexpected PopupDateField value,", "1/20/84",
+ assertEquals("Unexpected PopupDateField value,", "1/21/84",
getPopupDateFieldValue());
WebElement day20 = getInlineDateFieldCalendarPanel()
.findElement(By.vaadin("#day20"));
- Assert.assertTrue(
- "Unexpected InlineDateField state, 20th not selected.",
+ assertTrue("Unexpected InlineDateField state, 20th not selected.",
hasCssClass(day20,
"v-inline-datefield-calendarpanel-day-selected"));
- Assert.assertEquals("Unexpected TextField contents,",
- "Jan 20, 1984 4:34:49 PM",
+ // Depends on the TZ offset on the server
+ assertEquals("Unexpected TextField contents,",
+ FORMAT.format(DateForm.DATE),
$(TextFieldElement.class).first().getValue());
}
@@ -36,7 +43,7 @@ public class DateFormTest extends MultiBrowserTest {
}
protected String getPopupDateFieldValue() {
- return $(PopupDateFieldElement.class).first().getValue();
+ return $(DateFieldElement.class).get(1).getValue();
}
protected WebElement getInlineDateFieldCalendarPanel() {
@@ -44,4 +51,4 @@ public class DateFormTest extends MultiBrowserTest {
.findElement(By.className("v-inline-datefield-calendarpanel"));
}
-}
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/integration/ParameterizedTB3Runner.java b/uitest/src/test/java/com/vaadin/tests/integration/ParameterizedTB3Runner.java
index 0bceccbeef..b1bd95ce53 100644
--- a/uitest/src/test/java/com/vaadin/tests/integration/ParameterizedTB3Runner.java
+++ b/uitest/src/test/java/com/vaadin/tests/integration/ParameterizedTB3Runner.java
@@ -8,12 +8,11 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import com.vaadin.testbench.parallel.ParallelRunner;
import org.junit.runners.Parameterized.Parameters;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
-import com.vaadin.tests.tb3.TB3Runner;
-
/**
* TestBench test runner which supports static @Parameters annotated methods
* providing parameters for the corresponding setter.
@@ -25,7 +24,7 @@ import com.vaadin.tests.tb3.TB3Runner;
*
* @author Vaadin Ltd
*/
-public class ParameterizedTB3Runner extends TB3Runner {
+public class ParameterizedTB3Runner extends ParallelRunner {
public ParameterizedTB3Runner(Class<?> klass) throws InitializationError {
super(klass);
diff --git a/uitest/src/test/java/com/vaadin/tests/layoutmanager/ConcurrentModificationUITest.java b/uitest/src/test/java/com/vaadin/tests/layoutmanager/ConcurrentModificationUITest.java
index 4a64fc3173..bfa617f7e9 100644
--- a/uitest/src/test/java/com/vaadin/tests/layoutmanager/ConcurrentModificationUITest.java
+++ b/uitest/src/test/java/com/vaadin/tests/layoutmanager/ConcurrentModificationUITest.java
@@ -3,14 +3,15 @@ package com.vaadin.tests.layoutmanager;
import org.junit.Test;
import com.vaadin.tests.tb3.SingleBrowserTest;
+import org.openqa.selenium.Dimension;
public class ConcurrentModificationUITest extends SingleBrowserTest {
@Test
public void noExceptionWhenEnlarging() {
- testBench().resizeViewPortTo(100, 100);
+ getDriver().manage().window().setSize(new Dimension(100, 100));
openTestURL("debug");
- testBench().resizeViewPortTo(200, 200);
+ getDriver().manage().window().setSize(new Dimension(200, 200));
assertNoErrorNotifications();
}
}
diff --git a/uitest/src/test/java/com/vaadin/tests/layouts/RelativeSizeInUndefinedCssLayoutTest.java b/uitest/src/test/java/com/vaadin/tests/layouts/RelativeSizeInUndefinedCssLayoutTest.java
index 7af16b47ca..cab9d234ec 100644
--- a/uitest/src/test/java/com/vaadin/tests/layouts/RelativeSizeInUndefinedCssLayoutTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/layouts/RelativeSizeInUndefinedCssLayoutTest.java
@@ -1,14 +1,14 @@
package com.vaadin.tests.layouts;
+import com.vaadin.tests.tb3.SingleBrowserTest;
import org.junit.Assert;
import org.junit.Test;
import com.vaadin.testbench.elements.FormLayoutElement;
import com.vaadin.testbench.elements.TextFieldElement;
-import com.vaadin.tests.tb3.SingleBrowserTestPhantomJS2;
public class RelativeSizeInUndefinedCssLayoutTest
- extends SingleBrowserTestPhantomJS2 {
+ extends SingleBrowserTest {
@Test
public void relativeSizeInUndefinedCssLayout() {
diff --git a/uitest/src/test/java/com/vaadin/tests/push/ReconnectLongPollingTest.java b/uitest/src/test/java/com/vaadin/tests/push/ReconnectLongPollingTest.java
index 18f5249a29..bb82e3bc1a 100644
--- a/uitest/src/test/java/com/vaadin/tests/push/ReconnectLongPollingTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/push/ReconnectLongPollingTest.java
@@ -7,15 +7,6 @@ import java.util.List;
public class ReconnectLongPollingTest extends ReconnectTest {
@Override
- public List<DesiredCapabilities> getBrowsersToTest() {
-
- // PhantomJS doesn't seem to detect disconnection on
- // Long-Polling/Streaming:
- // https://github.com/ariya/phantomjs/issues/11938
- return getBrowsersExcludingPhantomJS();
- }
-
- @Override
protected Class<?> getUIClass() {
return BasicPushLongPolling.class;
}
diff --git a/uitest/src/test/java/com/vaadin/tests/push/ReconnectStreamingTest.java b/uitest/src/test/java/com/vaadin/tests/push/ReconnectStreamingTest.java
index a903999fe6..0bb6be2eed 100755
--- a/uitest/src/test/java/com/vaadin/tests/push/ReconnectStreamingTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/push/ReconnectStreamingTest.java
@@ -7,15 +7,6 @@ import java.util.List;
public class ReconnectStreamingTest extends ReconnectTest {
@Override
- public List<DesiredCapabilities> getBrowsersToTest() {
-
- // PhantomJS doesn't seem to detect disconnection on
- // Long-Polling/Streaming:
- // https://github.com/ariya/phantomjs/issues/11938
- return getBrowsersExcludingPhantomJS();
- }
-
- @Override
protected Class<?> getUIClass() {
return BasicPushStreaming.class;
}
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 e24f1ac168..22d5be34d3 100644
--- a/uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java
@@ -1,118 +1,150 @@
package com.vaadin.tests.serialization;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+
import org.junit.Test;
import com.vaadin.tests.tb3.MultiBrowserTest;
+import org.openqa.selenium.JavascriptExecutor;
public class SerializerTestTest extends MultiBrowserTest {
+ private final SimpleDateFormat FORMAT = new SimpleDateFormat(
+ "EEE MMM dd HH:mm:ss 'GMT'Z yyyy", new Locale("en", "fi"));
+
@Test
public void testSerialization() {
+ // Set up formatting with browsers timezone
+ FORMAT.setTimeZone(getBrowserTimeZone());
+
openTestURL();
int logRow = 0;
- Assert.assertEquals(
- "sendJson: {\"b\":false,\"s\":\"JSON\"}, null, \"value\"",
+ assertEquals("sendJson: {\"b\":false,\"s\":\"JSON\"}, null, \"value\"",
getLogRow(logRow++));
- Assert.assertEquals(
- "sendDateArray: January 31, 2013 10:00:00 PM UTC January 31, 2012 10:00:00 PM UTC",
+ assertEquals(
+ "sendDateArray: January 31, 2013 12:00:00 AM UTC January 31, 2012 12:00:00 AM UTC",
getLogRow(logRow++));
- Assert.assertEquals("sendDate: May 31, 2013 8:12:13 AM UTC",
+ assertEquals("sendDate: May 1, 2013 11:12:13 AM UTC",
getLogRow(logRow++));
- Assert.assertEquals("sendDate: January 1, 1970 12:00:00 AM UTC",
+ assertEquals("sendDate: January 1, 1970 12:00:00 AM UTC",
getLogRow(logRow++));
- Assert.assertEquals(
+ assertEquals(
"sendEnum: PREFORMATTED, [HTML, RAW], [PREFORMATTED, XML]",
getLogRow(logRow++));
- Assert.assertEquals(
+ assertEquals(
"sendWrappedGenerics: {[SimpleTestBean(1)]={1=[SimpleTestBean(42)]}}",
getLogRow(logRow++));
- Assert.assertEquals(
+ assertEquals(
"sendMap: {a=SimpleTestBean(1)}, [com.vaadin.tests.widgetset.server.SerializerTestExtension=SimpleTestBean(4)], [2=com.vaadin.tests.widgetset.server.SerializerTestExtension], {SimpleTestBean(4)=SimpleTestBean(-4), SimpleTestBean(-5)=SimpleTestBean(5)}",
getLogRow(logRow++));
- Assert.assertEquals(
+ assertEquals(
"sendSet: [-12, -7, -4], class com.vaadin.tests.serialization.SerializerTest, [SimpleTestBean(2), SimpleTestBean(3)]",
getLogRow(logRow++));
- Assert.assertEquals(
+ assertEquals(
"sendArrayList: [[2], [2]], [[2, 1], [2, 3]], [[SimpleTestBean(7)]]",
getLogRow(logRow++));
- Assert.assertEquals(
+ assertEquals(
"sendList: [-234, 5, 8], class com.vaadin.tests.widgetset.server.SerializerTestExtension, class com.vaadin.tests.serialization.SerializerTest, [SimpleTestBean(-568), SimpleTestBean(234)]",
getLogRow(logRow++));
- Assert.assertEquals(
+ assertEquals(
"sendNestedArray: [[7, 5]], [[SimpleTestBean(2)], [SimpleTestBean(4)]]",
getLogRow(logRow++));
- Assert.assertEquals("sendNull: null, Not null", getLogRow(logRow++));
- Assert.assertEquals(
+ assertEquals("sendNull: null, Not null", getLogRow(logRow++));
+ assertEquals(
"sendBean: ComplexTestBean [innerBean1=SimpleTestBean(1), innerBean2=SimpleTestBean(3), innerBeanCollection=[SimpleTestBean(6), SimpleTestBean(0)], privimite=6], SimpleTestBean(0), [SimpleTestBean(7)]",
getLogRow(logRow++));
- Assert.assertEquals(
+ assertEquals(
"sendConnector: com.vaadin.tests.widgetset.server.SerializerTestExtension",
getLogRow(logRow++));
- Assert.assertEquals("sendString: Taegghiiiinnrsssstt‡, [null, ‡]",
+ assertEquals("sendString: Taegghiiiinnrsssstt‡, [null, ‡]",
getLogRow(logRow++));
- Assert.assertEquals(
+ assertEquals(
"sendDouble: 0.423310825130748, 5.859874482048838, [2.0, 1.7976931348623157E308, 4.9E-324]",
getLogRow(logRow++));
- Assert.assertEquals("sendFloat: 1.0000001, 3.14159, [-12.0, 0.0, 57.0]",
- getLogRow(logRow++));
- Assert.assertEquals("sendLong: -57841235865, 577431841358, [57, 0]",
+ assertEquals("sendFloat: 1.0000001, 3.14159, [-12.0, 0.0, 57.0]",
getLogRow(logRow++));
- Assert.assertEquals("sendInt: 2, 5, [2147483647, 0]",
+ assertEquals("sendLong: -57841235865, 577431841358, [57, 0]",
getLogRow(logRow++));
- Assert.assertEquals("sendChar: Å, ∫, [a, b, c, d]",
- getLogRow(logRow++));
- Assert.assertEquals("sendByte: 5, -12, [3, 1, 2]", getLogRow(logRow++));
- Assert.assertEquals(
+ assertEquals("sendInt: 2, 5, [2147483647, 0]", getLogRow(logRow++));
+ assertEquals("sendChar: Å, ∫, [a, b, c, d]", getLogRow(logRow++));
+ assertEquals("sendByte: 5, -12, [3, 1, 2]", getLogRow(logRow++));
+ assertEquals(
"sendBoolean: false, false, [false, false, true, false, true, true]",
getLogRow(logRow++));
- Assert.assertEquals("sendBeanSubclass: 43", getLogRow(logRow++));
- Assert.assertEquals(
- "state.dateArray: Thu Jan 01 02:00:00 GMT+200 1970 Thu Jan 01 02:00:00 GMT+200 1970",
- getLogRow(logRow++));
- Assert.assertEquals("state.date2: Fri May 31 11:12:13 GMT+300 2013",
- getLogRow(logRow++));
- Assert.assertEquals("state.date1: Thu Jan 01 02:00:00 GMT+200 1970",
- getLogRow(logRow++));
- Assert.assertEquals("state.jsonBoolean: false", getLogRow(logRow++));
- Assert.assertEquals("state.jsonString: a string", getLogRow(logRow++));
- Assert.assertEquals("state.jsonNull: NULL", getLogRow(logRow++));
- Assert.assertEquals("state.stringArray: [null, ‡]",
- getLogRow(logRow++));
- Assert.assertEquals("state.string: This is a tesing string ‡",
+ assertEquals("sendBeanSubclass: 43", getLogRow(logRow++));
+
+ // Dates from state
+ Date date1 = new Date(1);
+ Date date2 = new Date(Date.UTC(2013 - 1900, 4, 1, 11, 12, 13));
+ Date[] dateArray = new Date[] { new Date(1), new Date(2) };
+
+ StringBuilder expected = new StringBuilder();
+ for (int i = 0; i < dateArray.length; ++i) {
+ if (i > 0) {
+ expected.append(" ");
+ }
+ expected.append(formatDate(dateArray[i]));
+ }
+
+ assertEquals(
+ "state.dateArray: " + expected.toString(),
getLogRow(logRow++));
- Assert.assertEquals(
- "state.doubleArray: [1.7976931348623157e+308, 5e-324]",
+ assertEquals("state.date2: " + formatDate(date2), getLogRow(logRow++));
+ assertEquals("state.date1: " + formatDate(date1), getLogRow(logRow++));
+
+ assertEquals("state.jsonBoolean: false", getLogRow(logRow++));
+ assertEquals("state.jsonString: a string", getLogRow(logRow++));
+ assertEquals("state.jsonNull: NULL", getLogRow(logRow++));
+ assertEquals("state.stringArray: [null, ‡]", getLogRow(logRow++));
+ assertEquals("state.string: This is a tesing string ‡",
getLogRow(logRow++));
- Assert.assertEquals("state.doubleObjectValue: -2.718281828459045",
+ assertEquals("state.doubleArray: [1.7976931348623157e+308, 5e-324]",
getLogRow(logRow++));
- Assert.assertEquals("state.doubleValue: 3.141592653589793",
+ assertEquals("state.doubleObjectValue: -2.718281828459045",
getLogRow(logRow++));
- Assert.assertEquals("state.floatArray: [57, 0, -12]",
+ assertEquals("state.doubleValue: 3.141592653589793",
getLogRow(logRow++));
- Assert.assertTrue(getLogRow(logRow++)
+ assertEquals("state.floatArray: [57, 0, -12]", getLogRow(logRow++));
+ assertTrue(getLogRow(logRow++)
.startsWith("state.floatObjectValue: 1.0000001"));
- Assert.assertTrue(
- getLogRow(logRow++).startsWith("state.floatValue: 3.14159"));
- Assert.assertEquals("state.longArray: [-57841235865, 57]",
- getLogRow(logRow++));
- Assert.assertEquals("state.longObjectValue: 577431841360",
- getLogRow(logRow++));
- Assert.assertEquals("state.longValue: 577431841359",
- getLogRow(logRow++));
- Assert.assertEquals("state.intArray: [5, 7]", getLogRow(logRow++));
- Assert.assertEquals("state.intObjectValue: 42", getLogRow(logRow++));
- Assert.assertEquals("state.intValue: 2147483647", getLogRow(logRow++));
- Assert.assertEquals("state.charArray: aBcD", getLogRow(logRow++));
- Assert.assertEquals("state.charObjectValue: å", getLogRow(logRow++));
- Assert.assertEquals("state.charValue: ∫", getLogRow(logRow++));
- Assert.assertEquals("state.byteArray: [3, 1, 2]", getLogRow(logRow++));
- Assert.assertEquals("state.byteObjectValue: -12", getLogRow(logRow++));
- Assert.assertEquals("state.byteValue: 5", getLogRow(logRow++));
- Assert.assertEquals(
+ assertTrue(getLogRow(logRow++).startsWith("state.floatValue: 3.14159"));
+ assertEquals("state.longArray: [-57841235865, 57]",
+ getLogRow(logRow++));
+ assertEquals("state.longObjectValue: 577431841360",
+ getLogRow(logRow++));
+ assertEquals("state.longValue: 577431841359", getLogRow(logRow++));
+ assertEquals("state.intArray: [5, 7]", getLogRow(logRow++));
+ assertEquals("state.intObjectValue: 42", getLogRow(logRow++));
+ assertEquals("state.intValue: 2147483647", getLogRow(logRow++));
+ assertEquals("state.charArray: aBcD", getLogRow(logRow++));
+ assertEquals("state.charObjectValue: å", getLogRow(logRow++));
+ assertEquals("state.charValue: ∫", getLogRow(logRow++));
+ assertEquals("state.byteArray: [3, 1, 2]", getLogRow(logRow++));
+ assertEquals("state.byteObjectValue: -12", getLogRow(logRow++));
+ assertEquals("state.byteValue: 5", getLogRow(logRow++));
+ assertEquals(
"state.booleanArray: [true, true, false, true, false, false]",
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");
}
-}
+} \ No newline at end of file
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 0b964de356..4df23a54ba 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -43,7 +43,6 @@ import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
-import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
import com.vaadin.server.LegacyApplication;
import com.vaadin.server.UIProvider;
import com.vaadin.testbench.TestBenchDriverProxy;
@@ -79,15 +78,11 @@ import elemental.json.impl.JsonUtil;
*
* @author Vaadin Ltd
*/
-@RunWith(TB3Runner.class)
public abstract class AbstractTB3Test extends ParallelTest {
@Rule
public TestName testName = new TestName();
- @Rule
- public RetryOnFail retry = new RetryOnFail();
-
/**
* Height of the screenshots we want to capture
*/
@@ -103,15 +98,6 @@ public abstract class AbstractTB3Test extends ParallelTest {
*/
private static final int BROWSER_TIMEOUT_IN_MS = 30 * 1000;
- protected static DesiredCapabilities PHANTOMJS2() {
- DesiredCapabilities phantomjs2 = new VaadinBrowserFactory()
- .create(Browser.PHANTOMJS, "2");
- // Hack for the test cluster
- phantomjs2.setCapability("phantomjs.binary.path",
- "/usr/bin/phantomjs2");
- return phantomjs2;
- }
-
private boolean debug = false;
private boolean push = false;
@@ -820,14 +806,7 @@ public abstract class AbstractTB3Test extends ParallelTest {
}
public void hitButton(String id) {
- if (BrowserUtil.isPhantomJS(getDesiredCapabilities())) {
- driver.findElement(By.id(id)).click();
- } else {
- WebDriverBackedSelenium selenium = new WebDriverBackedSelenium(
- driver, driver.getCurrentUrl());
-
- selenium.keyPress("id=" + id, "\\13");
- }
+ driver.findElement(By.id(id)).click();
}
protected void openDebugLogTab() {
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java b/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java
index f9b5091b47..6151298dfb 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java
@@ -5,6 +5,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import com.vaadin.testbench.Parameters;
import org.eclipse.jgit.api.DiffCommand;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
@@ -105,8 +106,7 @@ public class ChangedTB3TestLocator extends TB3TestLocator {
}
private String getScreenshotDirectory() {
- return PrivateTB3Configuration
- .getProperty(PrivateTB3Configuration.SCREENSHOT_DIRECTORY);
+ return Parameters.getScreenshotReferenceDirectory();
}
private List<DiffEntry> getDiffsInHead(Repository repository)
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserTest.java b/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserTest.java
index c3bb87a23d..8aa1dceb78 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserTest.java
@@ -31,26 +31,20 @@ public abstract class MultiBrowserTest extends PrivateTB3Configuration {
Browser.FIREFOX, Browser.CHROME);
}
- protected List<DesiredCapabilities> getBrowsersExcludingPhantomJS() {
- return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10,
- Browser.IE11, Browser.CHROME, Browser.FIREFOX);
- }
-
protected List<DesiredCapabilities> getBrowsersExcludingIE() {
- return getBrowserCapabilities(Browser.FIREFOX, Browser.CHROME,
- Browser.PHANTOMJS);
+ return getBrowserCapabilities(Browser.FIREFOX, Browser.CHROME);
}
protected List<DesiredCapabilities> getBrowsersExcludingFirefox() {
// this is sometimes needed as the Firefox driver causes extra mouseOut
// events that make tooltips disappear etc.
return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10,
- Browser.IE11, Browser.CHROME, Browser.PHANTOMJS);
+ Browser.IE11, Browser.CHROME);
}
protected List<DesiredCapabilities> getBrowsersExcludingIE8() {
return getBrowserCapabilities(Browser.IE9, Browser.IE10, Browser.IE11,
- Browser.FIREFOX, Browser.CHROME, Browser.PHANTOMJS);
+ Browser.FIREFOX, Browser.CHROME);
}
protected List<DesiredCapabilities> getBrowsersSupportingShiftClick() {
@@ -78,15 +72,15 @@ public abstract class MultiBrowserTest extends PrivateTB3Configuration {
// On Firefox, the driver causes additional mouseOut events causing the
// tooltip to disappear immediately. Tooltips may work in some
// particular cases, but not in general.
- return getBrowserCapabilities(Browser.CHROME, Browser.PHANTOMJS);
+ return getBrowserCapabilities(Browser.CHROME);
}
@Override
public List<DesiredCapabilities> getBrowsersToTest() {
// Uncomment Safari and Opera if those become tested browsers again.
return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10,
- Browser.IE11, Browser.FIREFOX, Browser.CHROME,
- Browser.PHANTOMJS /* , Browser.SAFARI, Browser.OPERA */);
+ Browser.IE11, Browser.FIREFOX, Browser.CHROME
+ /* , Browser.SAFARI, Browser.OPERA */);
}
protected List<DesiredCapabilities> getBrowserCapabilities(
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTest.java b/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTest.java
index 28a22e1a34..27265d036a 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTest.java
@@ -41,11 +41,4 @@ public abstract class MultiBrowserThemeTest extends MultiBrowserTest {
params.add("theme=" + theme);
super.openTestURL(uiClass, params.toArray(new String[params.size()]));
}
-
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- List<DesiredCapabilities> browsersToTest = getBrowsersExcludingPhantomJS();
- browsersToTest.add(PHANTOMJS2());
- return browsersToTest;
- }
}
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTestWithProxy.java b/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTestWithProxy.java
index d1a3fd01dc..335fb8c255 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTestWithProxy.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTestWithProxy.java
@@ -39,11 +39,4 @@ public abstract class MultiBrowserThemeTestWithProxy
params.add("theme=" + theme);
super.openTestURL(uiClass, params.toArray(new String[params.size()]));
}
-
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- List<DesiredCapabilities> browsersToTest = getBrowsersExcludingPhantomJS();
- browsersToTest.add(PHANTOMJS2());
- return browsersToTest;
- }
}
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java
index abee2c1c2c..36de54db26 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java
@@ -26,6 +26,7 @@ import java.util.Calendar;
import java.util.Enumeration;
import java.util.Properties;
+import com.vaadin.testbench.Parameters;
import org.junit.Assert;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
@@ -49,7 +50,6 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
/**
*
*/
- public static final String SCREENSHOT_DIRECTORY = "com.vaadin.testbench.screenshot.directory";
private static final String HOSTNAME_PROPERTY = "com.vaadin.testbench.deployment.hostname";
private static final String RUN_LOCALLY_PROPERTY = "com.vaadin.testbench.runLocally";
private static final String ALLOW_RUN_LOCALLY_PROPERTY = "com.vaadin.testbench.allowRunLocally";
@@ -60,31 +60,48 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
private static final File propertiesFile = new File("../work",
"eclipse-run-selected-test.properties");
private static final String FIREFOX_PATH = "firefox.path";
- private static final String PHANTOMJS_PATH = "phantomjs.binary.path";
+ private static final String BROWSER_FACTORY = "browser.factory";
+ private static final String BROWSERS_INCLUDE = "browsers.include";
+ private static final String BROWSERS_EXCLUDE = "browsers.exclude";
+ private static final String CATEGORIES_INCLUDE = "categories.include";
+ private static final String CATEGORIES_EXCLUDE = "categories.exclude";
static {
if (propertiesFile.exists()) {
try {
properties.load(new FileInputStream(propertiesFile));
- if (properties.containsKey(RUN_LOCALLY_PROPERTY)) {
- System.setProperty("useLocalWebDriver", "true");
- DesiredCapabilities localBrowser = getRunLocallyCapabilities();
- System.setProperty("browsers.include",
- localBrowser.getBrowserName()
- + localBrowser.getVersion());
- }
- if (properties.containsKey(FIREFOX_PATH)) {
- System.setProperty(FIREFOX_PATH,
- properties.getProperty(FIREFOX_PATH));
- }
- if (properties.containsKey(PHANTOMJS_PATH)) {
- System.setProperty(PHANTOMJS_PATH,
- properties.getProperty(PHANTOMJS_PATH));
- }
+ System.err.println("LOADED");
} catch (IOException e) {
throw new RuntimeException(e);
}
}
+
+ if (properties.containsKey(RUN_LOCALLY_PROPERTY)) {
+ System.setProperty("useLocalWebDriver", "true");
+ DesiredCapabilities localBrowser = getRunLocallyCapabilities();
+ System.setProperty("browsers.include",
+ localBrowser.getBrowserName()
+ + localBrowser.getVersion());
+ }
+
+ String[] vars = new String[] {FIREFOX_PATH, BROWSER_FACTORY, BROWSERS_INCLUDE, BROWSERS_EXCLUDE, CATEGORIES_INCLUDE, CATEGORIES_EXCLUDE};
+
+ for (String var : vars) {
+ if (properties.containsKey(var)) {
+ System.err.println("Var; " + var + ", Value: " + properties.getProperty(var));
+ System.setProperty(var, properties.getProperty(var));
+ }
+ }
+
+ final String base = Parameters.class.getName() + ".";
+ if (properties.containsKey(base + "screenshotReferenceDirectory")) {
+ Parameters.setScreenshotReferenceDirectory(properties
+ .getProperty(base + "screenshotReferenceDirectory"));
+ }
+ if (properties.containsKey(base + "screenshotErrorDirectory")) {
+ Parameters.setScreenshotErrorDirectory(properties
+ .getProperty(base + "screenshotErrorDirectory"));
+ }
}
@Override
@@ -150,16 +167,6 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
}
@Override
- protected String getScreenshotDirectory() {
- String screenshotDirectory = getProperty(SCREENSHOT_DIRECTORY);
- if (screenshotDirectory == null) {
- throw new RuntimeException("No screenshot directory defined. Use -D"
- + SCREENSHOT_DIRECTORY + "=<path>");
- }
- return screenshotDirectory;
- }
-
- @Override
protected String getHubURL() {
String hubUrl = getProperty(HUB_URL);
if (hubUrl == null || hubUrl.trim().isEmpty()) {
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/RetryOnFail.java b/uitest/src/test/java/com/vaadin/tests/tb3/RetryOnFail.java
deleted file mode 100644
index 063f322929..0000000000
--- a/uitest/src/test/java/com/vaadin/tests/tb3/RetryOnFail.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.vaadin.tests.tb3;
-
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-public class RetryOnFail implements TestRule {
- @Override
- public Statement apply(Statement base, Description description) {
- return statement(base, description);
- }
-
- private Statement statement(final Statement base,
- final Description description) {
- return new Statement() {
- @Override
- public void evaluate() throws Throwable {
- Throwable caughtThrowable = null;
- int retryCount = getRetryCount();
-
- for (int i = 0; i <= retryCount; i++) {
- try {
- base.evaluate();
- return;
- } catch (Throwable t) {
- caughtThrowable = t;
- System.err
- .println(String.format("%s: run %s/%s failed.",
- description.getDisplayName(), i + 1,
- retryCount + 1));
- System.err.println(t.getMessage());
- }
- }
- throw caughtThrowable;
- }
-
- private int getRetryCount() {
- String retryCount = System
- .getProperty("com.vaadin.testbench.max.retries");
-
- if (retryCount != null && retryCount != "") {
- return Integer.parseInt(retryCount);
- }
-
- return 0;
- }
- };
- }
-}
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/ScreenshotTB3Test.java b/uitest/src/test/java/com/vaadin/tests/tb3/ScreenshotTB3Test.java
index fe4e3a0405..041b9e78b2 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/ScreenshotTB3Test.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/ScreenshotTB3Test.java
@@ -1,12 +1,9 @@
package com.vaadin.tests.tb3;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
+import com.vaadin.testbench.Parameters;
+import com.vaadin.testbench.ScreenshotOnFailureRule;
+import com.vaadin.testbench.parallel.BrowserUtil;
+import com.vaadin.testbench.screenshot.ImageFileUtil;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
@@ -14,14 +11,17 @@ import org.junit.Rule;
import org.junit.rules.TestRule;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
+import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
-import com.vaadin.testbench.Parameters;
-import com.vaadin.testbench.ScreenshotOnFailureRule;
-import com.vaadin.testbench.parallel.BrowserUtil;
-import com.vaadin.testbench.screenshot.ImageFileUtil;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
/**
* Base class which provides functionality for tests which use the automatic
@@ -84,10 +84,6 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
@Before
public void setupScreenComparisonParameters() {
screenshotFailures = new ArrayList<String>();
-
- Parameters.setScreenshotErrorDirectory(getScreenshotErrorDirectory());
- Parameters.setScreenshotReferenceDirectory(
- getScreenshotReferenceDirectory());
}
/**
@@ -97,7 +93,7 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
*
* In case of a failed comparison this method stores the grabbed screenshots
* in the error directory as defined by
- * {@link #getScreenshotErrorDirectory()}. It will also generate a html file
+ * {@link Parameters#getScreenshotErrorDirectory()}. It will also generate a html file
* in the same directory, comparing the screenshot with the first found
* reference.
*
@@ -231,16 +227,18 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
*
* @param referenceFile
* The reference image file (in the directory defined by
- * {@link #getScreenshotReferenceDirectory()})
+ * {@link Parameters#getScreenshotReferenceDirectory()})
* @return the file name of the file generated in the directory defined by
- * {@link #getScreenshotErrorDirectory()} if comparison with the
+ * {@link Parameters#getScreenshotErrorDirectory()} if comparison with the
* given reference image fails.
*/
private File getErrorFileFromReference(File referenceFile) {
String absolutePath = referenceFile.getAbsolutePath();
- String screenshotReferenceDirectory = getScreenshotReferenceDirectory();
- String screenshotErrorDirectory = getScreenshotErrorDirectory();
+ String screenshotReferenceDirectory = Parameters
+ .getScreenshotReferenceDirectory();
+ String screenshotErrorDirectory = Parameters
+ .getScreenshotErrorDirectory();
// We throw an exception to safeguard against accidental reference
// deletion. See (#14446)
if (!absolutePath.contains(screenshotReferenceDirectory)) {
@@ -281,7 +279,8 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
}
/**
- * @param testName
+ * @param identifier
+ * the screenshot name identifier
* @return the reference file name to use for the given browser, as
* described by {@literal capabilities}, and identifier
*/
@@ -315,39 +314,6 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
}
/**
- * @return the base directory of 'reference' and 'errors' screenshots
- */
- protected abstract String getScreenshotDirectory();
-
- /**
- * @return the base directory of 'reference' and 'errors' screenshots with a
- * trailing file separator
- */
- private String getScreenshotDirectoryWithTrailingSeparator() {
- String screenshotDirectory = getScreenshotDirectory();
- if (!screenshotDirectory.endsWith(File.separator)) {
- screenshotDirectory += File.separator;
- }
- return screenshotDirectory;
- }
-
- /**
- * @return the directory where reference images are stored (the 'reference'
- * folder inside the screenshot directory)
- */
- private String getScreenshotReferenceDirectory() {
- return getScreenshotDirectoryWithTrailingSeparator() + "reference";
- }
-
- /**
- * @return the directory where comparison error images should be created
- * (the 'errors' folder inside the screenshot directory)
- */
- private String getScreenshotErrorDirectory() {
- return getScreenshotDirectoryWithTrailingSeparator() + "errors";
- }
-
- /**
* Checks if any screenshot comparisons failures occurred during the test
* and combines all comparison errors into one exception
*
@@ -366,11 +332,11 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
/**
* @return the name of a "failure" image which is stored in the folder
- * defined by {@link #getScreenshotErrorDirectory()} when the test
+ * defined by {@link Parameters#getScreenshotErrorDirectory()} when the test
* fails
*/
private String getScreenshotFailureName() {
- return getScreenshotBaseName() + "_" + getUniqueIdentifier(null)
+ return getScreenshotBaseName() + "_" + getUniqueIdentifier(null, null)
+ "-failure.png";
}
@@ -385,13 +351,23 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
/**
* Returns the name of the reference file based on the given parameters.
*
- * @param testName
- * @param capabilities
* @param identifier
+ * the identifier for the screenshot
* @return the full path of the reference
*/
private String getScreenshotReferenceName(String identifier) {
- return getScreenshotReferenceName(identifier, null);
+ String fileName = getScreenshotReferenceName(identifier, null);
+ File refFile = new File(fileName);
+ if (!refFile.exists() && getDesiredCapabilities().getVersion().isEmpty()) {
+ int version = 100;
+ while (version > 0) {
+ String tmpName = getScreenshotReferenceName(identifier,version--);
+ if (new File(tmpName).exists()) {
+ return tmpName;
+ }
+ }
+ }
+ return fileName;
}
/**
@@ -399,20 +375,38 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
* version given in {@literal capabilities} is used unless it is overridden
* by the {@literal versionOverride} parameter.
*
- * @param testName
- * @param capabilities
* @param identifier
+ * the identifier for the screenshot
+ * @param versionOverride
+ * the version number to use in the screenshot name
* @return the full path of the reference
*/
private String getScreenshotReferenceName(String identifier,
Integer versionOverride) {
- return getScreenshotReferenceDirectory() + File.separator
+ String fileName = getScreenshotReferenceName(identifier,
+ versionOverride, null);
+ File refFile = new File(fileName);
+ if (!refFile.exists()
+ && getDesiredCapabilities().getPlatform() == Platform.ANY) {
+ for (Platform p : Platform.values()) {
+ String tmpName = getScreenshotReferenceName(identifier,
+ versionOverride, p);
+ if (new File(tmpName).exists()) {
+ return tmpName;
+ }
+ }
+ }
+ return fileName;
+ }
+
+ private String getScreenshotReferenceName(String identifier, Integer versionOverride, Platform platformOverride) {
+ return Parameters.getScreenshotReferenceDirectory() + File.separator
+ getScreenshotBaseName() + "_"
- + getUniqueIdentifier(versionOverride) + "_" + identifier
+ + getUniqueIdentifier(versionOverride, platformOverride) + "_" + identifier
+ ".png";
}
- private String getUniqueIdentifier(Integer versionOverride) {
+ private String getUniqueIdentifier(Integer versionOverride, Platform platformOverride) {
String testNameAndParameters = testName.getMethodName();
// runTest-wildfly9-nginx[Windows_Firefox_24][/buffering/demo][valo]
@@ -429,13 +423,32 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
if (versionOverride != null) {
// Windows_Firefox_17_bufferingdemo_valo
- parameters = parameters.replaceFirst(
+ int indexOfBrowser = parameters.indexOf("_") + 1;
+ parameters = parameters.substring(0, indexOfBrowser) + parameters.substring(indexOfBrowser).replaceFirst(
"_" + getDesiredCapabilities().getVersion(),
"_" + versionOverride);
+
}
+
+ if (platformOverride != null) {
+ // LINUX_Firefox_17_bufferingdemo_valo
+ parameters = getPlatformName(platformOverride)
+ + parameters.substring(parameters.indexOf("_"));
+ }
+
return parameters;
}
+ private String getPlatformName(Platform platform) {
+ switch (platform) {
+ case WINDOWS:
+ // Reference file names have Windows instead of WINDOWS
+ return "Windows";
+ default:
+ return platform.name();
+ }
+ }
+
/**
* Returns the base name of the screenshot in the error directory. This is a
* name so that all files matching {@link #getScreenshotErrorBaseName()}*
@@ -445,8 +458,8 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
*/
private String getScreenshotErrorBaseName() {
return getScreenshotReferenceName("dummy", null)
- .replace(getScreenshotReferenceDirectory(),
- getScreenshotErrorDirectory())
+ .replace(Parameters.getScreenshotReferenceDirectory(),
+ Parameters.getScreenshotErrorDirectory())
.replace("_dummy.png", "");
}
@@ -458,7 +471,7 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
public void cleanErrorDirectory() {
// Remove any screenshots for this test from the error directory
// before running it. Leave unrelated files as-is
- File errorDirectory = new File(getScreenshotErrorDirectory());
+ File errorDirectory = new File(Parameters.getScreenshotErrorDirectory());
// Create errors directory if it does not exist
if (!errorDirectory.exists()) {
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/SingleBrowserTest.java b/uitest/src/test/java/com/vaadin/tests/tb3/SingleBrowserTest.java
index e655d4992a..762f002c61 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/SingleBrowserTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/SingleBrowserTest.java
@@ -14,6 +14,6 @@ public abstract class SingleBrowserTest extends PrivateTB3Configuration {
return Collections.singletonList(getRunLocallyCapabilities());
}
return Collections
- .singletonList(Browser.PHANTOMJS.getDesiredCapabilities());
+ .singletonList(Browser.CHROME.getDesiredCapabilities());
}
}
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/SingleBrowserTestPhantomJS2.java b/uitest/src/test/java/com/vaadin/tests/tb3/SingleBrowserTestPhantomJS2.java
deleted file mode 100644
index 432d582e04..0000000000
--- a/uitest/src/test/java/com/vaadin/tests/tb3/SingleBrowserTestPhantomJS2.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.vaadin.tests.tb3;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.openqa.selenium.remote.DesiredCapabilities;
-
-public abstract class SingleBrowserTestPhantomJS2
- extends PrivateTB3Configuration {
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- return Collections.singletonList(PHANTOMJS2());
- }
-}
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/TB3Runner.java b/uitest/src/test/java/com/vaadin/tests/tb3/TB3Runner.java
deleted file mode 100644
index 4a0d15baa0..0000000000
--- a/uitest/src/test/java/com/vaadin/tests/tb3/TB3Runner.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.vaadin.tests.tb3;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-
-import org.apache.http.client.HttpClient;
-import org.junit.runners.Parameterized;
-import org.junit.runners.model.InitializationError;
-import org.openqa.selenium.remote.internal.ApacheHttpClient;
-import org.openqa.selenium.remote.internal.HttpClientFactory;
-
-import com.vaadin.testbench.parallel.ParallelRunner;
-
-/**
- * This runner is loosely based on FactoryTestRunner by Ted Young
- * (http://tedyoung.me/2011/01/23/junit-runtime-tests-custom-runners/). The
- * generated test names give information about the parameters used (unlike
- * {@link Parameterized}).
- *
- * @since 7.1
- */
-public class TB3Runner extends ParallelRunner {
-
- /**
- * Socket timeout for HTTP connections to the grid hub. The connection is
- * closed after 30 minutes of inactivity to avoid builds hanging for up to
- * three hours per connection if the test client crashes/hangs.
- */
- private static final int SOCKET_TIMEOUT = 30 * 60 * 1000;
-
- static {
-
- // reduce socket timeout to avoid tests hanging for three hours
- try {
- Field field = ApacheHttpClient.Factory.class
- .getDeclaredField("defaultClientFactory");
- assert (Modifier.isStatic(field.getModifiers()));
- field.setAccessible(true);
- field.set(null, new HttpClientFactory() {
- @Override
- public HttpClient getGridHttpClient(int connection_timeout,
- int socket_timeout) {
-
- if (socket_timeout == 0
- || socket_timeout > SOCKET_TIMEOUT) {
- return super.getGridHttpClient(connection_timeout,
- SOCKET_TIMEOUT);
- }
-
- return super.getGridHttpClient(connection_timeout,
- socket_timeout);
- }
- });
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(
- "Changing socket timeout for TestBench failed", e);
- }
- }
-
- public TB3Runner(Class<?> klass) throws InitializationError {
- super(klass);
- }
-
-}
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/VaadinBrowserFactory.java b/uitest/src/test/java/com/vaadin/tests/tb3/VaadinBrowserFactory.java
index 27f50a6a17..1e7e68ae92 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/VaadinBrowserFactory.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/VaadinBrowserFactory.java
@@ -16,7 +16,7 @@ public class VaadinBrowserFactory extends DefaultBrowserFactory {
@Override
public DesiredCapabilities create(Browser browser) {
- String browserFactoryClass = System.getProperty("testbench.browser.factory");
+ String browserFactoryClass = System.getProperty("browser.factory");
if (browserFactoryClass != null
&& !browserFactoryClass.trim().isEmpty()) {
if (delegate == null) {
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/XvfbHubBrowserFactory.java b/uitest/src/test/java/com/vaadin/tests/tb3/XvfbHubBrowserFactory.java
new file mode 100644
index 0000000000..856a09f1ca
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/XvfbHubBrowserFactory.java
@@ -0,0 +1,24 @@
+package com.vaadin.tests.tb3;
+
+import org.openqa.selenium.Platform;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.testbench.parallel.Browser;
+import com.vaadin.testbench.parallel.DefaultBrowserFactory;
+
+public class XvfbHubBrowserFactory extends DefaultBrowserFactory {
+
+ public DesiredCapabilities create(Browser browser) {
+ switch (browser) {
+ case IE11:
+ return super.create(browser);
+ case PHANTOMJS:
+ return create(browser, "2", Platform.LINUX);
+ case CHROME:
+ return create(browser, "", Platform.ANY);
+ case FIREFOX:
+ default:
+ return create(Browser.FIREFOX, "", Platform.ANY);
+ }
+ }
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/newelements/WindowElement.java b/uitest/src/test/java/com/vaadin/tests/tb3/newelements/WindowElement.java
index 784d203ab0..de162fe8d7 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/newelements/WindowElement.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/newelements/WindowElement.java
@@ -25,10 +25,6 @@ public class WindowElement extends com.vaadin.testbench.elements.WindowElement {
}
}
- private boolean isMaximized() {
- return isElementPresent(By.className(restoreBoxClass));
- }
-
private WebElement getRestoreButton() {
return findElement(By.className("v-window-restorebox"));
}
diff --git a/uitest/src/test/java/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java b/uitest/src/test/java/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java
index de55664242..07d2acf836 100644
--- a/uitest/src/test/java/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java
@@ -38,7 +38,7 @@ public class LegacyComponentThemeChangeTest extends MultiBrowserTest {
public List<DesiredCapabilities> getBrowsersToTest() {
// Seems like stylesheet onload is not fired on PhantomJS
// https://github.com/ariya/phantomjs/issues/12332
- List<DesiredCapabilities> l = getBrowsersExcludingPhantomJS();
+ List<DesiredCapabilities> l = super.getBrowsersToTest();
// For some reason, IE times out when trying to open the combobox,
// #18341
diff --git a/uitest/src/test/java/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java b/uitest/src/test/java/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java
index ba2fd41778..bfbe4e3eeb 100644
--- a/uitest/src/test/java/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java
@@ -31,13 +31,6 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
public class ThemeChangeOnTheFlyTest extends MultiBrowserTest {
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- // Seems like stylesheet onload is not fired on PhantomJS
- // https://github.com/ariya/phantomjs/issues/12332
- return getBrowsersExcludingPhantomJS();
- }
-
@Test
public void injectedStyleAndThemeChange() throws IOException {
openTestURL();
diff --git a/uitest/src/test/java/com/vaadin/tests/themes/valo/ResponsiveStylesTest.java b/uitest/src/test/java/com/vaadin/tests/themes/valo/ResponsiveStylesTest.java
index 529cfd8478..78cdac01d7 100644
--- a/uitest/src/test/java/com/vaadin/tests/themes/valo/ResponsiveStylesTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/themes/valo/ResponsiveStylesTest.java
@@ -5,6 +5,7 @@ import static org.hamcrest.Matchers.equalTo;
import java.util.List;
+import com.vaadin.testbench.elements.LabelElement;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
@@ -62,6 +63,10 @@ public class ResponsiveStylesTest extends MultiBrowserTest {
public void testValoMenuResponsiveHover() throws Exception {
openTestURL(COLLAPSED_MENU_TEST_PARAM);
+ // Make sure mouse is not hovering the menu
+ new Actions(getDriver()).moveToElement($(LabelElement.class).first())
+ .moveByOffset(0, 300).perform();
+
compareScreen("collapsedMenu");
List<WebElement> toggles = findElements(
diff --git a/uitest/src/test/java/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java b/uitest/src/test/java/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java
index 4ea550b106..02fe6f574d 100644
--- a/uitest/src/test/java/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java
@@ -8,8 +8,7 @@ import static org.junit.Assert.assertThat;
import java.util.List;
import org.junit.Test;
-import org.openqa.selenium.interactions.Mouse;
-import org.openqa.selenium.interactions.internal.Coordinates;
+import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.DesiredCapabilities;
import com.vaadin.testbench.elements.ButtonElement;
@@ -31,27 +30,23 @@ public class AdjacentElementsWithTooltipsTest extends MultiBrowserTest {
@Test
public void tooltipsHaveQuickOpenDelay() throws InterruptedException {
openTestURL();
- Coordinates button0Coordinates = getButtonCoordinates("Button 0");
- Coordinates button1Coordinates = getButtonCoordinates("Button 1");
- Mouse mouse = getMouse();
- mouse.mouseMove(button0Coordinates, 10, 10);
+ new Actions(getDriver()).moveToElement(getButton("Button 0")).perform();
sleep(1000);
- assertThat(getTooltipElement().getLocation().x, is(greaterThan(0)));
+ assertThat(getTooltipElement().getLocation().getX(),
+ is(greaterThan(0)));
- mouse.mouseMove(button1Coordinates, 10, 10);
- assertThat(getTooltipElement().getLocation().x, is(lessThan(-1000)));
+ ButtonElement button1 = getButton("Button 1");
+ new Actions(getDriver()).moveToElement(button1).perform();
+ assertThat(getTooltipElement().getLocation().getX(),
+ is(lessThan(-1000)));
sleep(1000);
- assertThat(getTooltipElement().getLocation().x,
- is(greaterThan(button1Coordinates.onPage().x)));
- }
-
- private Coordinates getButtonCoordinates(String caption) {
- return getCoordinates(getButton(caption));
+ assertThat(getTooltipElement().getLocation().getX(),
+ is(greaterThan(button1.getLocation().getX())));
}
private ButtonElement getButton(String caption) {
return $(ButtonElement.class).caption(caption).first();
}
-}
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/tooltip/StationaryTooltipTest.java b/uitest/src/test/java/com/vaadin/tests/tooltip/StationaryTooltipTest.java
index b4ce5ff903..a4a6132fca 100644
--- a/uitest/src/test/java/com/vaadin/tests/tooltip/StationaryTooltipTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/tooltip/StationaryTooltipTest.java
@@ -7,9 +7,7 @@ import static org.junit.Assert.assertThat;
import java.util.List;
import org.junit.Test;
-import org.openqa.selenium.Dimension;
-import org.openqa.selenium.interactions.Mouse;
-import org.openqa.selenium.interactions.internal.Coordinates;
+import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.DesiredCapabilities;
import com.vaadin.testbench.elements.ButtonElement;
@@ -25,48 +23,30 @@ public class StationaryTooltipTest extends MultiBrowserTest {
@Test
public void tooltipShouldBeStationary() throws InterruptedException {
openTestURL();
+ ButtonElement button = getButtonElement();
- Mouse mouse = getMouse();
-
- moveMouseToButtonUpperLeftCorner(mouse);
+ // Top left corner
+ new Actions(getDriver()).moveToElement(button, 2, 2).perform();
sleep(3000); // wait for the tooltip to become visible
+
int originalTooltipLocationX = getTooltipLocationX();
+ assertThat("Tooltip not displayed", originalTooltipLocationX,
+ is(greaterThan(0)));
- moveMouseToButtonBottomRightCorner(mouse);
+ // Bottom right corner
+ new Actions(getDriver()).moveToElement(button,
+ button.getSize().width - 2, button.getSize().height - 2)
+ .perform();
int actualTooltipLocationX = getTooltipLocationX();
- assertThat(actualTooltipLocationX, is(greaterThan(0)));
- assertThat(actualTooltipLocationX, is(originalTooltipLocationX));
- }
-
- private Coordinates getButtonCoordinates() {
- return getCoordinates(getButtonElement());
+ assertThat("Tooltip should not move", actualTooltipLocationX,
+ is(originalTooltipLocationX));
}
private ButtonElement getButtonElement() {
return $(ButtonElement.class).first();
}
- private void moveMouseToButtonBottomRightCorner(Mouse mouse) {
- Coordinates buttonCoordinates = getButtonCoordinates();
- Dimension buttonDimensions = getButtonDimensions();
-
- mouse.mouseMove(buttonCoordinates, buttonDimensions.getWidth() - 1,
- buttonDimensions.getHeight() - 1);
- }
-
- private void moveMouseToButtonUpperLeftCorner(Mouse mouse) {
- Coordinates buttonCoordinates = getButtonCoordinates();
-
- mouse.mouseMove(buttonCoordinates, 0, 0);
- }
-
- private org.openqa.selenium.Dimension getButtonDimensions() {
- ButtonElement buttonElement = getButtonElement();
-
- return buttonElement.getWrappedElement().getSize();
- }
-
private int getTooltipLocationX() {
return getTooltipElement().getLocation().getX();
}