]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed always failing testbench test.
authorJohn Ahlroos <john@vaadin.com>
Thu, 16 Jan 2014 12:33:53 +0000 (14:33 +0200)
committerVaadin Code Review <review@vaadin.com>
Fri, 17 Jan 2014 13:43:26 +0000 (13:43 +0000)
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

uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHover.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionTooltip.html [deleted file]

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 (file)
index 0000000..e9b022e
--- /dev/null
@@ -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 (file)
index 0000000..904a4dd
--- /dev/null
@@ -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 (file)
index 4f574a9..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="" />
-<title>New Test</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">New Test</td></tr>
-</thead><tbody>
-<tr>
-       <td>open</td>
-       <td>/run/com.vaadin.tests.applicationcontext.CloseSession?restartApplication&amp;debug</td>
-       <td></td>
-</tr>
-<!-- Show tooltip for the Events caption -->
-<tr>
-       <td>showTooltip</td>
-       <td>//div[@id='gwt-uid-4']/span</td>
-       <td></td>
-</tr>
-<!-- Verify that there's no error notification -->
-<tr>
-       <td>assertElementNotPresent</td>
-       <td>vaadin=runcomvaadintestsapplicationcontextCloseSession::Root/VNotification[0]</td>
-       <td></td>
-</tr>
-</tbody></table>
-</body>
-</html>