aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests
diff options
context:
space:
mode:
Diffstat (limited to 'uitest/src/com/vaadin/tests')
-rw-r--r--uitest/src/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValo.java60
-rw-r--r--uitest/src/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValoTest.java72
2 files changed, 132 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValo.java b/uitest/src/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValo.java
new file mode 100644
index 0000000000..88d89abbf4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValo.java
@@ -0,0 +1,60 @@
+package com.vaadin.tests.components.menubar;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.MenuBar;
+import com.vaadin.ui.MenuBar.MenuItem;
+
+@Theme("valo")
+public class MenuBarSubmenusClosingValo extends AbstractTestUI {
+
+ private MenuItem edit;
+ private MenuItem file;
+ private MenuItem help;
+
+ @Override
+ protected String getTestDescription() {
+ return "Tests that when moving mouse fast over menu items "
+ + "previous submenu popup closes before new submenu popup opens";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 15255;
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ // here we increase animation time to 1 second for to do auto testing
+ // possible
+ getPage().getStyles().add(
+ ".valo .v-menubar-popup[class*=\"animate-in\"] {"
+ + "-webkit-animation: valo-overlay-animate-in 1000ms; "
+ + "-moz-animation: valo-overlay-animate-in 1000ms; "
+ + "animation: valo-overlay-animate-in 1000ms;};");
+
+ getPage().getStyles().add(
+ ".valo .v-menubar-popup[class*=\"animate-out\"] {"
+ + "-webkit-animation: valo-animate-out-fade 1000ms; "
+ + "-moz-animation: valo-animate-out-fade 1000ms; "
+ + "animation: valo-animate-out-fade 1000ms;};");
+
+ MenuBar mb = new MenuBar();
+ file = mb.addItem("File", null);
+ file.addItem("File1", null);
+ file.addItem("File2", null);
+ file.addItem("File3", null);
+ edit = mb.addItem("Edit", null);
+ edit.addItem("Edit1", null);
+ edit.addItem("Edit2", null);
+ edit.addItem("Edit3", null);
+ help = mb.addItem("Help", null);
+ help.addItem("Help1", null);
+ help.addItem("Help2", null);
+ MenuItem helpMenuItem = help.addItem("Help3", null);
+ helpMenuItem.addItem("SubHelp3", null);
+
+ addComponent(mb);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValoTest.java b/uitest/src/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValoTest.java
new file mode 100644
index 0000000000..b7ed88c9ca
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/menubar/MenuBarSubmenusClosingValoTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.menubar;
+
+import java.util.List;
+
+import org.junit.Assert;
+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 com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.MenuBarElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class MenuBarSubmenusClosingValoTest extends MultiBrowserTest {
+
+ @Test
+ public void testEnableParentLayoutControlByKeyboard() {
+ openTestURL();
+
+ MenuBarElement menu = $(MenuBarElement.class).get(0);
+ menu.focus();
+ menu.sendKeys(Keys.SPACE);
+ menu.sendKeys(Keys.DOWN);
+
+ waitForElementPresent(By.className("v-menubar-popup"));
+
+ menu.sendKeys(Keys.ARROW_RIGHT);
+ menu.sendKeys(Keys.ARROW_RIGHT);
+
+ int count = driver.findElements(By.className("v-menubar-popup")).size();
+ Assert.assertTrue("The count of open popups should be one", count == 1);
+ }
+
+ @Test
+ 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());
+ waitForElementPresent(By.className("v-menubar-popup"));
+
+ mouse.mouseMove(((Locatable) menuItemList.get(1)).getCoordinates());
+ mouse.mouseMove(((Locatable) menuItemList.get(2)).getCoordinates());
+
+ 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);
+ }
+}