]> source.dussan.org Git - vaadin-framework.git/commitdiff
Test fixes (#12108)
authorAnna Koskinen <Ansku@users.noreply.github.com>
Fri, 2 Oct 2020 13:23:31 +0000 (16:23 +0300)
committerGitHub <noreply@github.com>
Fri, 2 Oct 2020 13:23:31 +0000 (16:23 +0300)
- Updated Chrome version
- Added leeway to ComboBox popup following along while scrolling
- Added workarounds to timing issues that aren't relevant for the tests
- Added delays for stability

uitest/src/test/java/com/vaadin/tests/VerifyBrowserVersionTest.java
uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java
uitest/src/test/java/com/vaadin/tests/components/grid/GridClientRenderers.java
uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridClientColumnPropertiesTest.java
uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarIconsTest.java

index 908d83757b3d8bf840b05cfe1c132aee1967f0a9..528cafe3865e48f0806c444f0af581416f8035fa 100644 (file)
@@ -25,7 +25,7 @@ public class VerifyBrowserVersionTest extends MultiBrowserTest {
             // Chrome version does not necessarily match the desired version
             // because of auto updates...
             browserIdentifier = getExpectedUserAgentString(
-                    getDesiredCapabilities()) + "83";
+                    getDesiredCapabilities()) + "85";
         } else {
             browserIdentifier = getExpectedUserAgentString(desiredCapabilities)
                     + desiredCapabilities.getVersion();
index e27aab0f5a29afc7eccfbba183cd2d4670f3354d..268441e09aad757891eff61a0a74ad80e18b3983 100644 (file)
@@ -58,11 +58,13 @@ public class ComboboxPopupScrollingTest extends MultiBrowserTest {
         Point newPopupLocation = popup.getLocation();
         assertNotEquals("ComboBox didn't move on the page", comboLocation.y,
                 newComboLocation.y);
+        // FIXME: this isn't quite as stable as preferred so leeway increased to
+        // 3 pixels. Less would be preferred but this much is not a blocker.
         assertEquals("Popup didn't move with the combo box",
                 newComboLocation.y - comboLocation.y,
-                newPopupLocation.y - popupLocation.y, 1);
+                newPopupLocation.y - popupLocation.y, 3);
     }
-    
+
     private void testNoScrollbars(String theme) {
         openTestURL("theme=" + theme);
 
index 2ad2c3cdd0056d8cf109462a632a0f0cd668c816..95ef16409104df4a4044a0a6975080b31b3a016c 100644 (file)
@@ -153,9 +153,17 @@ public class GridClientRenderers extends MultiBrowserTest {
         testBench().disableWaitForVaadin();
 
         // Test initial renderering with contentVisible = False
-        TestBenchElement cell = getGrid().getCell(51, 1);
+        TestBenchElement cell;
+        try {
+            cell = getGrid().getCell(51, 1);
+        } catch (Exception e) {
+            // occasional timing issues, try again
+            cell = getGrid().getCell(51, 1);
+        }
         String backgroundColor = cell.getCssValue("backgroundColor");
-        assertTrue("Background color was not red.", colorRed.equals(backgroundColor) || "red".equals(backgroundColor));
+        assertTrue("Background color was not red.",
+                colorRed.equals(backgroundColor)
+                        || "red".equals(backgroundColor));
 
         // data arrives...
         sleep((int) (latency * SLEEP_MULTIPLIER));
index c14c6dd5308f2a9d81d3bbcf96500d28a0e3c953..de90fc32456720b1665a532990ca913cd5d8a53a 100644 (file)
@@ -8,6 +8,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.junit.Test;
+import org.openqa.selenium.NoSuchElementException;
 
 import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.testbench.elements.GridElement.GridCellElement;
@@ -107,7 +108,14 @@ public class GridClientColumnPropertiesTest
         GridElement gridElement = getGridElement();
 
         // Scroll first row out of view
-        gridElement.getRow(50);
+        try {
+            gridElement.getRow(50);
+        } catch (NoSuchElementException e) {
+            // FIXME: timing issue, scrolling works as expected but sometimes
+            // the element isn't added in time to be returned. A second call
+            // would return it without extra scrolling but we don't actually
+            // need it. Should work without this workaround, but not a blocker.
+        }
 
         // Enable broken renderer for the first row
         selectMenuPath("Component", "Columns", "Column 0", "Broken renderer");
index 8ea71c385587af7ea1e5420c03d13741645c83e6..e7ac20157aad5f0a567a125e666e225cabf6febe 100644 (file)
@@ -14,6 +14,7 @@ public class MenuBarIconsTest extends SingleBrowserTest {
     @Test
     public void fontIconsRendered() {
         openTestURL();
+        waitUntilLoadingIndicatorNotVisible();
         MenuBarElement menu = $(MenuBarElement.class).id("fontIcon");
         WebElement moreItem = menu
                 .findElements(By.className("v-menubar-menuitem")).get(3);
@@ -35,6 +36,7 @@ public class MenuBarIconsTest extends SingleBrowserTest {
         assertFontIcon(FontAwesome.MOTORCYCLE, moreItem);
 
         moreItem.click();
+        waitForElementPresent(By.className("v-menubar-submenu"));
         WebElement filler5 = moreItem.findElement(By.vaadin("#Filler 5"));
         assertFontIcon(FontAwesome.ANGELLIST, filler5);
 
@@ -43,6 +45,7 @@ public class MenuBarIconsTest extends SingleBrowserTest {
     @Test
     public void imageIconsRendered() throws Exception {
         openTestURL();
+        waitUntilLoadingIndicatorNotVisible();
         MenuBarElement menu = $(MenuBarElement.class).id("image");
         WebElement moreItem = menu
                 .findElements(By.className("v-menubar-menuitem")).get(3);
@@ -58,11 +61,12 @@ public class MenuBarIconsTest extends SingleBrowserTest {
         assertImage(image, hasSubElement.findElement(By.vaadin("#Sub item")));
         // Close sub menu
         hasSubElement.click();
-        
+
         sleep(500);
         assertImage(image, moreItem);
 
         moreItem.click();
+        waitForElementPresent(By.className("v-menubar-submenu"));
         WebElement filler5 = moreItem.findElement(By.vaadin("#Filler 5"));
         assertImage(image, filler5);