summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bom/pom.xml2
-rw-r--r--pom.xml2
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValoTest.java20
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarTooltipsNearEdgeTest.java28
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/menubar/MenuTooltipTest.java23
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/orderedlayout/ErrorIndicatorTest.java15
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java7
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java15
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/window/WindowShadowTest.java15
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java7
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java25
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tooltip/StationaryTooltipTest.java46
12 files changed, 72 insertions, 133 deletions
diff --git a/bom/pom.xml b/bom/pom.xml
index 5958c12bc8..8925dbf243 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -18,7 +18,7 @@
<properties>
<vaadin.spring.version>3.0.1</vaadin.spring.version>
- <vaadin.testbench.version>5.1.2</vaadin.testbench.version>
+ <vaadin.testbench.version>5.2.0.beta1</vaadin.testbench.version>
<vaadin.cdi.version>3.0.1</vaadin.cdi.version>
<vaadin.context-menu.version>2.0.0</vaadin.context-menu.version>
</properties>
diff --git a/pom.xml b/pom.xml
index 5163371932..a39fbedef8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,7 +60,7 @@
<sonar.issuesReport.html.enable>true</sonar.issuesReport.html.enable>
<vaadin.icons.version>3.0.1</vaadin.icons.version>
- <vaadin.testbench.version>5.1.2</vaadin.testbench.version>
+ <vaadin.testbench.version>5.2.0.beta1</vaadin.testbench.version>
</properties>
<pluginRepositories>
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 46a806eac5..4eba754815 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
@@ -1,5 +1,6 @@
package com.vaadin.tests.components.menubar;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.List;
@@ -7,9 +8,7 @@ import java.util.List;
import org.junit.Test;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
-import org.openqa.selenium.interactions.HasInputDevices;
-import org.openqa.selenium.interactions.Mouse;
-import org.openqa.selenium.internal.Locatable;
+import org.openqa.selenium.interactions.Actions;
import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.MenuBarElement;
@@ -36,23 +35,22 @@ public class MenuBarSubmenusClosingValoTest extends MultiBrowserTest {
}
@Test
- public void testEnableParentLayoutControlByMouse() {
+ public void testEnableParentLayoutControlByMouse()
+ throws InterruptedException {
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();
- assertTrue("The count of open popups should be one", count == 1);
+ 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 838b1e9c92..01d0461a69 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,13 +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 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.interactions.Actions;
import com.vaadin.testbench.elements.MenuBarElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -24,13 +22,21 @@ public class MenuBarTooltipsNearEdgeTest extends MultiBrowserTest {
@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())));
}
}
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..d15306bc5a 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,9 +8,7 @@ import static org.junit.Assert.assertThat;
import java.util.List;
import org.junit.Test;
-import org.openqa.selenium.interactions.HasInputDevices;
-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.MenuBarElement;
@@ -32,24 +30,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/orderedlayout/ErrorIndicatorTest.java b/uitest/src/test/java/com/vaadin/tests/components/orderedlayout/ErrorIndicatorTest.java
index ae5cf232ad..df77685871 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
@@ -4,11 +4,6 @@ import static org.junit.Assert.assertEquals;
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.testbench.elements.TextFieldElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -20,18 +15,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..8d3a92a203 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]";
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 fd54b54594..03ded11647 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
@@ -9,10 +9,6 @@ import java.io.IOException;
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;
@@ -34,13 +30,13 @@ public class TabSheetErrorTooltipTest extends MultiBrowserTest {
private void assertTabHasTooltipAndError(int index, String tooltip,
String errorMessage) {
- showTooltip(index);
+ 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["
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 ce5cd2d336..40630ad81b 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
@@ -7,10 +7,7 @@ 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.interactions.Actions;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -26,12 +23,10 @@ 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.
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 7bbd3aa498..a762d7d466 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -34,14 +34,13 @@ import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.Point;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.interactions.HasInputDevices;
import org.openqa.selenium.interactions.Keyboard;
import org.openqa.selenium.interactions.Mouse;
-import org.openqa.selenium.interactions.internal.Coordinates;
-import org.openqa.selenium.internal.Locatable;
import org.openqa.selenium.internal.WrapsElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.HttpCommandExecutor;
@@ -169,10 +168,6 @@ public abstract class AbstractTB3Test extends ParallelTest {
com.vaadin.testbench.By.className("v-tooltip-text"));
}
- protected Coordinates getCoordinates(TestBenchElement element) {
- return ((Locatable) element.getWrappedElement()).getCoordinates();
- }
-
private boolean hasDebugMessage(String message) {
return getDebugMessage(message) != null;
}
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..0b060a9a3f 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,24 +30,20 @@ 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) {
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 b35a1e4bce..b4ca5c332c 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();
}