From 29b985e9c6aa695a7a965b8ed1d0fe42eefe75be Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Thu, 16 Jan 2014 14:33:53 +0200 Subject: [PATCH] Fixed always failing testbench test. The test was always failing since it relied on the GWT generated gwt-X ids in its locator. Converted test to TB3 and used a different approach for testing the same thing. Change-Id: Ib806086c19b58fa9fac16e2270c46830f0706b22 --- .../NestedLayoutCaptionHover.java | 46 ++++++++++++++++ .../NestedLayoutCaptionHoverTest.java | 54 +++++++++++++++++++ .../NestedLayoutCaptionTooltip.html | 33 ------------ 3 files changed, 100 insertions(+), 33 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHover.java create mode 100644 uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java delete mode 100644 uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionTooltip.html diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHover.java b/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHover.java new file mode 100644 index 0000000000..e9b022eac2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHover.java @@ -0,0 +1,46 @@ +/* + * Copyright 2000-2013 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.orderedlayout; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.VerticalLayout; + +/** + * Test hovering over nested layout caption + * + * @author Vaadin Ltd + */ +public class NestedLayoutCaptionHover extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + VerticalLayout test = new VerticalLayout(); + test.setCaption("inner layout"); + addComponent(new VerticalLayout(new VerticalLayout(new VerticalLayout( + test)))); + } + + @Override + protected String getTestDescription() { + return "Hovering over nested layout caption should not freeze the browser"; + } + + @Override + protected Integer getTicketNumber() { + return 12469; + } +} diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java b/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java new file mode 100644 index 0000000000..904a4dd6f0 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java @@ -0,0 +1,54 @@ +/* + * Copyright 2000-2013 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.orderedlayout; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +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.internal.Coordinates; +import org.openqa.selenium.internal.Locatable; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Tests hovering over caption in nested layout + */ +public class NestedLayoutCaptionHoverTest extends MultiBrowserTest { + + @Test + public void testTooltipInNestedLayout() { + openTestURL(); + + WebElement caption = getDriver().findElement( + By.className("v-captiontext")); + + assertEquals("inner layout", caption.getText()); + + // Hover over the caption + Coordinates coords = ((Locatable) caption).getCoordinates(); + ((HasInputDevices) getDriver()).getMouse().mouseMove(coords); + sleep(1000); + + // Verify that there's no error notification + WebElement error = vaadinElement("Root/VNotification[0]"); + assertNull("No error should be found", error); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionTooltip.html b/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionTooltip.html deleted file mode 100644 index 4f574a92c7..0000000000 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionTooltip.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.applicationcontext.CloseSession?restartApplication&debug
showTooltip//div[@id='gwt-uid-4']/span
assertElementNotPresentvaadin=runcomvaadintestsapplicationcontextCloseSession::Root/VNotification[0]
- - -- 2.39.5