Browse Source

Test fixes (#12108)

- 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
tags/7.7.24
Anna Koskinen 3 years ago
parent
commit
56899b9551
No account linked to committer's email address

+ 1
- 1
uitest/src/test/java/com/vaadin/tests/VerifyBrowserVersionTest.java View 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();

+ 4
- 2
uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java View 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);


+ 10
- 2
uitest/src/test/java/com/vaadin/tests/components/grid/GridClientRenderers.java View 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));

+ 9
- 1
uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridClientColumnPropertiesTest.java View 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");

+ 5
- 1
uitest/src/test/java/com/vaadin/tests/components/menubar/MenuBarIconsTest.java View 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);


Loading…
Cancel
Save