diff options
Diffstat (limited to 'uitest/src/com')
7 files changed, 95 insertions, 10 deletions
diff --git a/uitest/src/com/vaadin/tests/components/TooltipDelay.java b/uitest/src/com/vaadin/tests/components/TooltipDelay.java new file mode 100644 index 0000000000..06fec3b233 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/TooltipDelay.java @@ -0,0 +1,59 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Button; + +/** + * Test to see if tooltip delay is working properly. + * + * @author Vaadin Ltd + */ +public class TooltipDelay extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest vaadinRequest) { + + Button button = new Button("Expand"); + button.setDescription("Expand"); + addComponent(button); + + getTooltipConfiguration().setOpenDelay(5000); + + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "Tooltips should appear with a five second delay."; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 13695; + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicator.java b/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicator.java index def67c256a..89490bd167 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicator.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicator.java @@ -54,6 +54,9 @@ public class ErrorIndicator extends AbstractTestUI { horizontalLayout.addComponent(inHorizontal); layout.addComponent(horizontalLayout); + getTooltipConfiguration().setOpenDelay(0); + getTooltipConfiguration().setQuickOpenDelay(0); + getTooltipConfiguration().setCloseTimeout(1000); } /* diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicatorTest.java b/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicatorTest.java index 0367a77c7e..e784eb3b64 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicatorTest.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/ErrorIndicatorTest.java @@ -19,6 +19,11 @@ 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; @@ -30,12 +35,18 @@ public class ErrorIndicatorTest extends MultiBrowserTest { String tooltipText; openTestURL(); - $(TextFieldElement.class).first().showTooltip(); + showTooltip($(TextFieldElement.class).first()); tooltipText = driver.findElement(By.className("v-tooltip")).getText(); assertEquals(tooltipText, "Vertical layout tooltip"); - $(TextFieldElement.class).get(1).showTooltip(); + showTooltip($(TextFieldElement.class).get(1)); 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/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltip.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltip.java index d9cc077f67..c4af98eb3f 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltip.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltip.java @@ -39,6 +39,9 @@ public class TabSheetErrorTooltip extends AbstractTestUI { t.setDescription("This tab has both an error and a description"); setContent(tabSheet); + getTooltipConfiguration().setOpenDelay(0); + getTooltipConfiguration().setQuickOpenDelay(0); + getTooltipConfiguration().setCloseTimeout(1000); } private Tab addTab() { diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java index d639cd2ddc..5462ed2532 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java @@ -24,8 +24,11 @@ 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.testbench.commands.TestBenchElementCommands; import com.vaadin.tests.tb3.MultiBrowserTest; public class TabSheetErrorTooltipTest extends MultiBrowserTest { @@ -63,8 +66,10 @@ public class TabSheetErrorTooltipTest extends MultiBrowserTest { } private void showTooltip(int index) { - TestBenchElementCommands element = testBenchElement(getTab(index)); - element.showTooltip(); + Coordinates elementCoordinates = ((Locatable) getTab(index)) + .getCoordinates(); + Mouse mouse = ((HasInputDevices) getDriver()).getMouse(); + mouse.mouseMove(elementCoordinates); } private WebElement getTab(int index) { diff --git a/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java b/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java index 9730d1d8a1..cd2cc7d060 100644 --- a/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java +++ b/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java @@ -41,6 +41,9 @@ public class TooltipInWindow extends AbstractTestUI { TextField tf = new TextField("TextField with a tooltip"); tf.setDescription("My tooltip"); tf.setId(id); + getTooltipConfiguration().setOpenDelay(0); + getTooltipConfiguration().setQuickOpenDelay(0); + getTooltipConfiguration().setCloseTimeout(1000); return tf; } diff --git a/uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java b/uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java index 6f144ef7a4..06fb659d4a 100644 --- a/uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java +++ b/uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java @@ -35,7 +35,7 @@ import com.vaadin.tests.tb3.MultiBrowserTest; public class TooltipInWindowTest extends MultiBrowserTest { @Test - public void testTooltipsInSubWindow() throws Exception { + public void testTooltipsInSubWindow() throws InterruptedException { openTestURL(); WebElement textfield = vaadinElementById("tf1"); @@ -46,31 +46,32 @@ public class TooltipInWindowTest extends MultiBrowserTest { // Show tooltip mouse.mouseMove(textfieldCoordinates, 10, 10); - sleep(1000); + sleep(100); ensureVisibleTooltipPositionedCorrectly(); assertEquals("My tooltip", getTooltipElement().getText()); // Hide tooltip mouse.mouseMove(textfieldCoordinates, -100, -100); - sleep(1000); + sleep(2000); ensureHiddenTooltipPositionedCorrectly(); assertEquals("", getTooltipElement().getText()); // Show tooltip again mouse.mouseMove(textfieldCoordinates, 10, 10); - sleep(1000); + sleep(100); ensureVisibleTooltipPositionedCorrectly(); assertEquals("My tooltip", getTooltipElement().getText()); // Hide tooltip mouse.mouseMove(textfieldCoordinates, -100, -100); - sleep(1000); + sleep(2000); ensureHiddenTooltipPositionedCorrectly(); assertEquals("", getTooltipElement().getText()); + } private WebElement getTooltipElement() { |