]> source.dussan.org Git - vaadin-framework.git/commitdiff
Test fixes (#12244)
authorAnna Koskinen <Ansku@users.noreply.github.com>
Thu, 18 Mar 2021 12:35:55 +0000 (14:35 +0200)
committerGitHub <noreply@github.com>
Thu, 18 Mar 2021 12:35:55 +0000 (14:35 +0200)
13 files changed:
uitest/reference-screenshots/chrome/ResponsiveStylesTest-testValoMenuResponsiveHover_ANY_Chrome__collapsedMenu.png
uitest/reference-screenshots/chrome/TableContextMenuAndIconsTest-tableContextMenuWithIcons_ANY_Chrome__contextmenu-empty-1.png [new file with mode: 0644]
uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridWithoutRenderer.java
uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxMenuBarAutoopenTest.java
uitest/src/test/java/com/vaadin/tests/components/grid/GridDetailsUpdateItemsTest.java
uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorMultiselectTest.java
uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeHiddenColumnTest.java
uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorSpacerTest.java
uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationTest.java
uitest/src/test/java/com/vaadin/tests/elements/menubar/MenuBarUITest.java
uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridClientRenderers.java
uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridWithoutRendererTest.java
uitest/src/test/java/com/vaadin/v7/tests/components/tree/TreeItemDoubleClickTest.java

index 9070133c4c4af092b159822ad5b884e7655ab5d2..d5cb48ca14e738611c6ba593628d6ac1ed6d8745 100755 (executable)
Binary files a/uitest/reference-screenshots/chrome/ResponsiveStylesTest-testValoMenuResponsiveHover_ANY_Chrome__collapsedMenu.png and b/uitest/reference-screenshots/chrome/ResponsiveStylesTest-testValoMenuResponsiveHover_ANY_Chrome__collapsedMenu.png differ
diff --git a/uitest/reference-screenshots/chrome/TableContextMenuAndIconsTest-tableContextMenuWithIcons_ANY_Chrome__contextmenu-empty-1.png b/uitest/reference-screenshots/chrome/TableContextMenuAndIconsTest-tableContextMenuWithIcons_ANY_Chrome__contextmenu-empty-1.png
new file mode 100644 (file)
index 0000000..52a4853
Binary files /dev/null and b/uitest/reference-screenshots/chrome/TableContextMenuAndIconsTest-tableContextMenuWithIcons_ANY_Chrome__contextmenu-empty-1.png differ
index 5b64996c529b9a8d4ab1c791bddeef1f0a0d5698..1dfb8074788f6b49c9366ba7fd81d7e48e5f77d3 100644 (file)
@@ -1,10 +1,13 @@
 package com.vaadin.v7.tests.components.grid;
 
+import com.vaadin.server.UserError;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.tests.util.PersonContainer;
+import com.vaadin.ui.Button;
 import com.vaadin.v7.ui.Grid;
 
+@SuppressWarnings("deprecation")
 public class GridWithoutRenderer extends AbstractTestUI {
 
     @Override
@@ -12,6 +15,8 @@ public class GridWithoutRenderer extends AbstractTestUI {
         Grid grid = new Grid();
         grid.setContainerDataSource(PersonContainer.createWithTestData());
         addComponent(grid);
+        addComponent(new Button("Add error",
+                e -> grid.setComponentError(new UserError("fail"))));
 
     }
 }
index 99b1c9652b4583c627ea091904fec3a4ae8aa904..4d4d8fb175e7bc87843a45d72a2f766ea705b152 100644 (file)
@@ -10,6 +10,7 @@ import org.openqa.selenium.interactions.Actions;
 import com.vaadin.testbench.elements.ComboBoxElement;
 import com.vaadin.testbench.elements.MenuBarElement;
 import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.ui.Notification.Type;
 
 /**
  * Test that checks whether Combobox popup is closed on click to autoopen
@@ -21,7 +22,6 @@ public class ComboboxMenuBarAutoopenTest extends MultiBrowserTest {
 
     @Test
     public void closeComboboxPopupOnClickToMenuBar() {
-        setDebug(true);
         openTestURL();
 
         openPopup();
@@ -29,15 +29,24 @@ public class ComboboxMenuBarAutoopenTest extends MultiBrowserTest {
         menuBar.click();
         assertFalse("Combobox popup items are visible",
                 isElementPresent(By.className("gwt-MenuItem")));
+    }
+
+    @Test
+    public void closeComboboxPopupOnClickToMenuBarItem() {
+        openTestURL();
 
         openPopup();
-        menuBar = selectMenuBar();
 
+        // hover over menubar to open
         WebElement menuBarItem = findElement(
                 By.className("v-menubar-menuitem-caption"));
-        Actions actions = new Actions(getDriver());
-        actions.moveToElement(menuBarItem).build().perform();
-        menuBar.click();
+        moveToElement(menuBarItem);
+
+        // click submenu item
+        findElements(By.className("v-menubar-menuitem-caption")).get(1).click();
+        assertElementPresent(By.className(
+                "v-Notification-" + Type.HUMANIZED_MESSAGE.getStyle()));
+
         assertFalse("Combobox popup items are visible",
                 isElementPresent(By.className("gwt-MenuItem")));
     }
@@ -46,20 +55,20 @@ public class ComboboxMenuBarAutoopenTest extends MultiBrowserTest {
         ComboBoxElement combobox = $(ComboBoxElement.class).first();
         combobox.openPopup();
 
-        Actions actions = new Actions(getDriver());
-        actions.moveToElement(
-                getDriver().findElement(By.className("gwt-MenuItem"))).build()
-                .perform();
+        moveToElement(findElement(By.className("gwt-MenuItem")));
     }
 
     private MenuBarElement selectMenuBar() {
         MenuBarElement menuBar = $(MenuBarElement.class).first();
         menuBar.focus();
 
-        Actions actions = new Actions(getDriver());
-        actions.moveToElement(menuBar).build().perform();
+        moveToElement(menuBar);
 
         return menuBar;
     }
 
+    private void moveToElement(WebElement target) {
+        Actions actions = new Actions(driver);
+        actions.moveToElement(target).build().perform();
+    }
 }
index 3f690ca7cdb29f1281491036f0ea645b5f9aab24..22c7da0c02066b896b5276024488cff9c4f8a186 100644 (file)
@@ -21,7 +21,6 @@ public class GridDetailsUpdateItemsTest extends MultiBrowserTest {
         ButtonElement button = $(ButtonElement.class).first();
 
         String details0 = grid.getDetails(0).getText();
-        System.out.println("details: " + details0);
 
         // change the contents
         button.click();
index 53a3ab0c3388594565589f410dd2e0e250215cad..4a2d3988aec7c76acc752547b2207c39d0a16fb3 100644 (file)
@@ -1,5 +1,8 @@
 package com.vaadin.tests.components.grid;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.util.List;
 
 import org.junit.Test;
@@ -10,9 +13,6 @@ import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 @TestCategory("grid")
 public class GridEditorMultiselectTest extends MultiBrowserTest {
 
@@ -27,7 +27,9 @@ public class GridEditorMultiselectTest extends MultiBrowserTest {
     public void testSelectCheckboxesEnabledBackOnSave() {
         openTestURL();
         GridElement grid = openEditor();
-        grid.getEditor().save();
+        waitForElementPresent(By.className("v-grid-editor-save"));
+        sleep(100); // wait for repositioning
+        findElement(By.className("v-grid-editor-save")).click();
         waitForElementNotPresent(By.className("v-grid-editor-cells"));
         assertCheckboxesEnabled(grid, true);
     }
@@ -36,14 +38,17 @@ public class GridEditorMultiselectTest extends MultiBrowserTest {
     public void testSelectCheckboxesEnabledBackOnCancel() {
         openTestURL();
         GridElement grid = openEditor();
-        grid.getEditor().cancel();
-        sleep(100);
+        waitForElementPresent(By.className("v-grid-editor-cancel"));
+        sleep(100); // wait for repositioning
+        findElement(By.className("v-grid-editor-cancel")).click();
+        waitForElementNotPresent(By.className("v-grid-editor-cells"));
         assertCheckboxesEnabled(grid, true);
     }
 
     private GridElement openEditor() {
         GridElement grid = $(GridElement.class).first();
         grid.getRow(0).doubleClick();
+        waitForElementPresent(By.className("v-grid-editor-cells"));
         assertTrue("Grid editor should be displayed.",
                 grid.getEditor().isDisplayed());
         return grid;
index dfe2158519bfabd1c7315b3c9dc225d972fe3565..bdaaf56d4c53162a68a1ed61059a9c052b2a76af 100644 (file)
@@ -62,6 +62,7 @@ public class GridResizeHiddenColumnTest extends MultiBrowserTest {
         // Click on "Last Name" menu item
         action.click(visibilityToggle).perform();
         waitUntilLoadingIndicatorNotVisible();
+        sleep(100); // wait for layouting
 
         // Check if column "Last Name" is visible
         headerCells = grid.getHeaderCells(0);
index 45e08f9683bbc0df78573b9e8272480cf241888d..a84e5c1eae280a6c6a6767f7b4eb6c8d5438fed4 100644 (file)
@@ -97,12 +97,15 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
         assertFalse("No spacers should be shown at the start",
                 spacersAreFoundInDom());
         selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX);
+        waitForElementPresent(By.className("v-escalator-spacer"));
         assertNotNull("Spacer should be shown after setting it", getSpacer(1));
     }
 
     @Test
     public void closeVisibleSpacer() {
         selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX);
+        waitForElementPresent(By.className("v-escalator-spacer"));
+        assertNotNull("Unexpectedly missing spacer from row 1", getSpacer(1));
         selectMenuPath(FEATURES, SPACERS, ROW_1, REMOVE);
         assertNull("Spacer should not exist after removing it", getSpacer(1));
     }
@@ -111,6 +114,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
     public void spacerPushesVisibleRowsDown() {
         double oldTop = getElementTop(getBodyRow(2));
         selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX);
+        waitForElementPresent(By.className("v-escalator-spacer"));
         double newTop = getElementTop(getBodyRow(2));
 
         assertGreater("Row below a spacer was not pushed down", newTop, oldTop);
@@ -123,6 +127,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
         selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, ADD_ONE_ROW_TO_BEGINNING);
 
         selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX);
+        waitForElementPresent(By.className("v-escalator-spacer"));
         double oldTop = getElementTop(getSpacer(1));
         selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, ADD_ONE_ROW_TO_BEGINNING);
         double newTop = getElementTop(getSpacer(2));
@@ -138,6 +143,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
         selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, ADD_ONE_ROW_TO_BEGINNING);
 
         selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX);
+        waitForElementPresent(By.className("v-escalator-spacer"));
         double oldTop = getElementTop(getSpacer(1));
         selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, ADD_ONE_ROW_TO_END);
         double newTop = getElementTop(getSpacer(1));
@@ -153,6 +159,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
         selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, ADD_ONE_ROW_TO_BEGINNING);
 
         selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX);
+        waitForElementPresent(By.className("v-escalator-spacer"));
         double spacerTop = getElementTop(getSpacer(1));
         selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, ADD_ONE_ROW_TO_END);
         double rowTop = getElementTop(getBodyRow(2));
@@ -175,6 +182,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
         scrollVerticallyTo(999999);
         long oldBottomScrollTop = getScrollTop();
         selectMenuPath(FEATURES, SPACERS, ROW_99, SET_100PX);
+        waitForElementPresent(By.className("v-escalator-spacer"));
 
         assertEquals(
                 "Adding a spacer underneath the current viewport should "
@@ -194,6 +202,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
     @Test
     public void removingRowAboveSpacerMovesSpacerUp() {
         selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX);
+        waitForElementPresent(By.className("v-escalator-spacer"));
         WebElement spacer = getSpacer(1);
         double originalElementTop = getElementTop(spacer);
 
@@ -225,6 +234,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
     public void spacersAreFixedInViewport_firstFreezeThenScroll() {
         selectMenuPath(FEATURES, FROZEN_COLUMNS, FREEZE_1_COLUMN);
         selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX);
+        waitForElementPresent(By.className("v-escalator-spacer"));
         assertEquals(
                 "Spacer's left position should've been 0 at the " + "beginning",
                 0d, getElementLeft(getSpacer(1)), WidgetUtil.PIXEL_EPSILON);
@@ -244,6 +254,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
         int scrollTo = 10;
         scrollHorizontallyTo(scrollTo);
         selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX);
+        waitForElementPresent(By.className("v-escalator-spacer"));
         assertEquals(
                 "Spacer's left position should've been " + scrollTo
                         + " after scrolling " + scrollTo + "px",
@@ -384,6 +395,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
 
         selectMenuPath(FEATURES, SPACERS, FOCUSABLE_UPDATER);
         selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX);
+        waitForElementPresent(By.className("v-escalator-spacer"));
 
         WebElement inputElement = getEscalator()
                 .findElement(By.tagName("input"));
@@ -401,6 +413,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
     @Test
     public void spacersAreInsertedInCorrectDomPosition() {
         selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX);
+        waitForElementPresent(By.className("v-escalator-spacer"));
 
         WebElement tbody = getEscalator().findElement(By.tagName("tbody"));
         WebElement spacer = getChild(tbody, 2);
@@ -414,6 +427,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
     public void spacersAreInCorrectDomPositionAfterScroll()
             throws InterruptedException {
         selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX);
+        waitForElementPresent(By.className("v-escalator-spacer"));
 
         scrollVerticallyTo(40); // roughly two rows' worth
 
@@ -483,6 +497,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest {
     public void spacerOpenedInViewGetsFocus() {
         selectMenuPath(FEATURES, SPACERS, FOCUSABLE_UPDATER);
         selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX);
+        waitForElementPresent(By.className("v-escalator-spacer"));
         tryToTabIntoFocusUpdaterElement();
         WebElement focusedElement = getFocusedElement();
         assertEquals("input", focusedElement.getTagName());
index ea33122541e123f071b6f42e6c2b7dae7b4eed5d..4bc34801dd7ec591a6bf0ae0bea179a5dfe77859 100644 (file)
@@ -1,10 +1,11 @@
 package com.vaadin.tests.components.ui;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
 import org.openqa.selenium.Keys;
-import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
 
 import com.vaadin.testbench.elements.TextAreaElement;
@@ -21,23 +22,17 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest {
     @Test
     public void textAreaEnterEventPropagation() throws InterruptedException {
         openTestURL();
-        WebElement textArea = $(TextAreaElement.class).first();
+        TextAreaElement textArea = $(TextAreaElement.class).first();
         Actions builder = new Actions(driver);
         builder.click(textArea);
-        builder.sendKeys(textArea, "first line asdf");
+        builder.sendKeys(textArea, "first line asdf", Keys.ENTER,
+                "second line jkl;");
         builder.perform();
         waitUntilLoadingIndicatorNotVisible();
 
-        builder.sendKeys(Keys.ENTER);
-        builder.perform();
-        waitUntilLoadingIndicatorNotVisible();
-
-        builder.sendKeys(textArea, "second line jkl;");
-        builder.perform();
-        waitUntilLoadingIndicatorNotVisible();
-
-        builder.perform();
-
+        String text = textArea.getValue();
+        assertEquals("Unexpected text area content,",
+                "first line asdf\nsecond line jkl;", text);
         // Should not have triggered shortcut
         assertEquals(" ", getLogRow(0));
     }
@@ -46,62 +41,55 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest {
     public void testTextAreaEscapeEventPropagation()
             throws InterruptedException {
         openTestURL();
-        WebElement textArea = $(TextAreaElement.class).first();
+        TextAreaElement textArea = $(TextAreaElement.class).first();
         Actions builder = new Actions(driver);
         builder.click(textArea);
-        builder.sendKeys(textArea, "first line asdf");
-        builder.perform();
-        waitUntilLoadingIndicatorNotVisible();
-
-        builder.sendKeys(Keys.ESCAPE);
-        builder.perform();
-        waitUntilLoadingIndicatorNotVisible();
-
-        builder.sendKeys(textArea, "second line jkl;");
+        builder.sendKeys(textArea, "first line asdf", Keys.ESCAPE,
+                "second line jkl;");
         builder.perform();
         waitUntilLoadingIndicatorNotVisible();
 
+        String text = textArea.getValue();
+        // sendKeys is erratic and can eat some letters after escape, so only
+        // test that beginning and end are present
+        assertTrue("Unexpected text area content: " + text,
+                text.startsWith("first line asdf"));
+        assertTrue("Unexpected text area content: " + text,
+                text.endsWith("nd line jkl;"));
+        assertFalse("Unexpected text area content: " + text,
+                text.contains("\n"));
         assertEquals("1. Escape button pressed", getLogRow(0));
     }
 
     @Test
     public void testTextFieldEscapeEventPropagation() {
         openTestURL();
-        WebElement textField = $(TextFieldElement.class).first();
+        TextFieldElement textField = $(TextFieldElement.class).first();
         Actions builder2 = new Actions(driver);
         builder2.click(textField);
 
-        builder2.sendKeys("third line");
-        builder2.perform();
-        waitUntilLoadingIndicatorNotVisible();
-
-        builder2.sendKeys(Keys.ENTER);
-        builder2.perform();
-        waitUntilLoadingIndicatorNotVisible();
-
-        builder2.sendKeys(Keys.ESCAPE);
+        builder2.sendKeys(textField, "third line", Keys.ESCAPE);
         builder2.perform();
         waitUntilLoadingIndicatorNotVisible();
 
-        assertEquals("1. Enter button pressed", getLogRow(1));
-        assertEquals("2. Escape button pressed", getLogRow(0));
+        String text = textField.getValue();
+        assertEquals("Unexpected text field content,", "third line", text);
+        assertEquals("1. Escape button pressed", getLogRow(0));
     }
 
     @Test
     public void testTextFieldEnterEventPropagation() {
         openTestURL();
-        WebElement textField = $(TextFieldElement.class).first();
+        TextFieldElement textField = $(TextFieldElement.class).first();
         Actions builder2 = new Actions(driver);
         builder2.click(textField);
 
-        builder2.sendKeys("third line");
-        builder2.perform();
-        waitUntilLoadingIndicatorNotVisible();
-
-        builder2.sendKeys(Keys.ENTER);
+        builder2.sendKeys(textField, "third line", Keys.ENTER);
         builder2.perform();
         waitUntilLoadingIndicatorNotVisible();
 
+        String text = textField.getValue();
+        assertEquals("Unexpected text field content,", "third line", text);
         assertEquals("1. Enter button pressed", getLogRow(0));
     }
 }
index 8969928ce8366164af296ca096b1b45203f6ee7d..4902a27deeec280235d26945a1ade651294394c2 100644 (file)
@@ -1,5 +1,9 @@
 package com.vaadin.tests.elements.menubar;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import java.util.List;
 
 import org.junit.Before;
@@ -11,10 +15,6 @@ import org.openqa.selenium.WebElement;
 import com.vaadin.testbench.elements.MenuBarElement;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
 public class MenuBarUITest extends MultiBrowserTest {
 
     @Override
@@ -33,12 +33,15 @@ public class MenuBarUITest extends MultiBrowserTest {
         MenuBarElement menuBar = $(MenuBarElement.class).first();
 
         menuBar.clickItem("File");
+        waitForElementPresent(By.className("v-menubar-popup"));
         assertTrue(isItemVisible("Export.."));
 
         menuBar.clickItem("Export..");
+        sleep(100);
         assertTrue(isItemVisible("As PDF..."));
 
         menuBar.clickItem("File");
+        sleep(100);
         assertFalse(isItemVisible("Export.."));
     }
 
@@ -50,34 +53,41 @@ public class MenuBarUITest extends MultiBrowserTest {
         MenuBarElement menuBar = $(MenuBarElement.class).first();
 
         menuBar.clickItem("File");
+        waitForElementPresent(By.className("v-menubar-popup"));
         assertTrue(isItemVisible("Save As.."));
 
         menuBar.clickItem("Export..");
+        sleep(100);
         assertTrue(isItemVisible("As PDF..."));
 
         // The Edit menu will be opened by moving the mouse over the item (done
         // by clickItem). The first click then actually closes the menu.
         menuBar.clickItem("Edit");
-        sleep(100);
+        waitForElementNotPresent(By.className("v-menubar-popup"));
         menuBar.clickItem("Edit");
+        waitForElementPresent(By.className("v-menubar-popup"));
         assertFalse(isItemVisible("Save As.."));
         assertTrue(isItemVisible("Paste"));
 
         menuBar.clickItem("Edit");
+        sleep(100);
         assertFalse(isItemVisible("Save As.."));
         assertFalse(isItemVisible("Paste"));
 
         menuBar.clickItem("Edit");
+        sleep(100);
         assertFalse(isItemVisible("Save As.."));
         assertTrue(isItemVisible("Paste"));
 
         // Menu does not contain a submenu, no need to click twice.
         menuBar.clickItem("Help");
+        sleep(100);
         assertFalse(isItemVisible("Save As.."));
         assertFalse(isItemVisible("Paste"));
 
         // No submenu is open, so click only once to open the File menu.
         menuBar.clickItem("File");
+        sleep(100);
         assertTrue(isItemVisible("Save As.."));
     }
 
@@ -88,6 +98,7 @@ public class MenuBarUITest extends MultiBrowserTest {
     public void testMenuBarClickPath() {
         MenuBarElement menuBar = $(MenuBarElement.class).first();
         menuBar.clickItem("File", "Export..");
+        waitForElementPresent(By.className("v-menubar-popup"));
         assertTrue(isItemVisible("As Doc..."));
     }
 
@@ -99,17 +110,22 @@ public class MenuBarUITest extends MultiBrowserTest {
         MenuBarElement menuBar = $(MenuBarElement.class).get(2);
 
         menuBar.clickItem("File");
+        waitForElementPresent(By.className("v-menubar-popup"));
         assertTrue(isItemVisible("Open2"));
         // Close the menu item
         menuBar.clickItem("File");
+        waitForElementNotPresent(By.className("v-menubar-popup"));
 
         menuBar = $(MenuBarElement.class).get(1);
         menuBar.clickItem("Edit2");
+        waitForElementPresent(By.className("v-menubar-popup"));
         assertTrue(isItemVisible("Cut"));
         menuBar.clickItem("Edit2");
+        waitForElementNotPresent(By.className("v-menubar-popup"));
 
         menuBar = $(MenuBarElement.class).first();
         menuBar.clickItem("File");
+        waitForElementPresent(By.className("v-menubar-popup"));
         assertTrue(isItemVisible("Open"));
     }
 
@@ -117,6 +133,7 @@ public class MenuBarUITest extends MultiBrowserTest {
     public void testMenuItemTooltips() {
         MenuBarElement first = $(MenuBarElement.class).first();
         first.clickItem("File");
+        waitForElementPresent(By.className("v-menubar-popup"));
         assertTooltip("Open", "<b>Preformatted</b>\ndescription");
         assertTooltip("Save", "plain description, <b>HTML</b> is visible");
         assertTooltip("Exit", "HTML\ndescription");
index d818db5cb47b09955ba9be55dac67f5168fd0634..3e53fab2e941bedf8f8e76714cb1fa36a6d890e8 100644 (file)
@@ -49,7 +49,7 @@ public class GridClientRenderers extends MultiBrowserTest {
         return path;
     }
 
-    @ServerClass("com.vaadin.tests.widgetset.server.grid.GridClientColumnRenderers.GridController")
+    @ServerClass("com.vaadin.tests.widgetset.server.v7.grid.GridClientColumnRenderers.GridController")
     public static class MyClientGridElement extends GridElement {
     }
 
index 0fe4a7f911c6c187038561bdb41f29c36dd9d157..ad86fb72329d7c076dad541143b157cc645e0ee6 100644 (file)
@@ -1,5 +1,6 @@
 package com.vaadin.v7.tests.components.grid;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.util.List;
@@ -8,6 +9,7 @@ import org.junit.Test;
 import org.openqa.selenium.By;
 import org.openqa.selenium.WebElement;
 
+import com.vaadin.testbench.elements.ButtonElement;
 import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.SingleBrowserTest;
 
@@ -17,13 +19,18 @@ public class GridWithoutRendererTest extends SingleBrowserTest {
     @Test
     public void ensureNoError() {
         openTestURL();
-        // WebElement errorIndicator = findElement(By
-        // .cssSelector("v-error-indicator"));
-        // System.out.println(errorIndicator);
+        waitForElementPresent(By.className("v-grid"));
         List<WebElement> errorIndicator = findElements(
-                By.xpath("//span[@class='v-errorindicator']"));
+                By.className("v-errorindicator"));
         assertTrue("There should not be an error indicator",
                 errorIndicator.isEmpty());
+
+        // add an error to ensure that the check is correct
+        $(ButtonElement.class).first().click();
+
+        errorIndicator = findElements(By.className("v-errorindicator"));
+        assertFalse("There should be an error indicator",
+                errorIndicator.isEmpty());
     }
 
 }
index fb2abe8ca02aa6b1f96ab3fb0ab9ac1e17ca17a1..4b3a48c47fe7c54145b98fd13da7a21018bf4a7b 100644 (file)
@@ -17,13 +17,25 @@ public class TreeItemDoubleClickTest extends MultiBrowserTest {
         openTestURL();
         String caption = "Tree Item 2";
         doubleClick(getTreeNodeByCaption(caption));
-        assertLogText("Double Click " + caption);
+        try {
+            assertLogText("Double Click " + caption);
+        } catch (AssertionError e) {
+            // double click is flaky, try again
+            doubleClick(getTreeNodeByCaption(caption));
+            assertLogText("Double Click " + caption);
+        }
 
         changeImmediate();
 
         caption = "Tree Item 3";
         doubleClick(getTreeNodeByCaption(caption));
-        assertLogText("Double Click " + caption);
+        try {
+            assertLogText("Double Click " + caption);
+        } catch (AssertionError e) {
+            // double click is flaky, try again
+            doubleClick(getTreeNodeByCaption(caption));
+            assertLogText("Double Click " + caption);
+        }
     }
 
     private void changeImmediate() {
@@ -38,7 +50,7 @@ public class TreeItemDoubleClickTest extends MultiBrowserTest {
 
     private void doubleClick(WebElement element) {
         new Actions(getDriver()).doubleClick(element).build().perform();
-
+        sleep(100);
     }
 
     private void assertLogText(String text) {