diff options
36 files changed, 289 insertions, 51 deletions
diff --git a/compatibility-themes/src/main/themes/VAADIN/themes/runo/select/select.scss b/compatibility-themes/src/main/themes/VAADIN/themes/runo/select/select.scss index ac8e22b429..a3d51e938f 100644 --- a/compatibility-themes/src/main/themes/VAADIN/themes/runo/select/select.scss +++ b/compatibility-themes/src/main/themes/VAADIN/themes/runo/select/select.scss @@ -49,6 +49,10 @@ $select-button-negative-width: -25px; outline: 5px auto -webkit-focus-ring-color; outline-offset: -4px; } +.v-ch & .#{$primaryStyleName}-focus { + /* remove safari focus outline offset for chrome (evaluates also as safari) */ + outline-offset: 0; +} .#{$primaryStyleName}-button { width: $select-button-width; margin-right: $select-button-negative-width; diff --git a/uitest/pom.xml b/uitest/pom.xml index c777a3e577..0dcac0326e 100644 --- a/uitest/pom.xml +++ b/uitest/pom.xml @@ -314,14 +314,51 @@ <categories.exclude>${categories.exclude}</categories.exclude> <browserstack.identifier>${browserstack.identifier}</browserstack.identifier> </systemPropertyVariables> - <includes> - <include>**/AllTB3Tests.java</include> - </includes> </configuration> <executions> <execution> + <id>no-components</id> + <configuration> + <includes> + <include>**/LimitedTB3TestsNonComponent.java</include> + </includes> + </configuration> + <goals> + <goal>integration-test</goal> + </goals> + </execution> + <execution> + <id>components-no-grid</id> + <configuration> + <includes> + <include>**/LimitedTB3TestsComponentsNoGrid.java</include> + </includes> + </configuration> + <goals> + <goal>integration-test</goal> + </goals> + </execution> + <execution> + <id>grid-only</id> + <configuration> + <includes> + <include>**/LimitedTB3TestsComponentsGridOnly.java</include> + </includes> + </configuration> <goals> <goal>integration-test</goal> + </goals> + </execution> + <execution> + <id>verify</id> + <configuration> + <includes> + <include>**/LimitedTB3TestsNonComponent.java</include> + <include>**/LimitedTB3TestsComponentsNoGrid.java</include> + <include>**/LimitedTB3TestsComponentsGridOnly.java</include> + </includes> + </configuration> + <goals> <goal>verify</goal> </goals> </execution> diff --git a/uitest/reference-screenshots/chrome/GridEditorFrozenColumnsUITest-testEditorWithFrozenColumns_ANY_Chrome__noscroll.png b/uitest/reference-screenshots/chrome/GridEditorFrozenColumnsUITest-testEditorWithFrozenColumns_ANY_Chrome__noscroll.png Binary files differindex d88da45c36..cd676d0a14 100755 --- a/uitest/reference-screenshots/chrome/GridEditorFrozenColumnsUITest-testEditorWithFrozenColumns_ANY_Chrome__noscroll.png +++ b/uitest/reference-screenshots/chrome/GridEditorFrozenColumnsUITest-testEditorWithFrozenColumns_ANY_Chrome__noscroll.png diff --git a/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__all-left.png b/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__all-left.png Binary files differindex a8a7f9bb55..6b56c424f1 100755 --- a/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__all-left.png +++ b/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__all-left.png diff --git a/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-button-right.png b/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-button-right.png Binary files differindex 429de6e9d3..66927c2ace 100755 --- a/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-button-right.png +++ b/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-button-right.png diff --git a/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-button-textfield-right.png b/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-button-textfield-right.png Binary files differindex fc810e5a6a..86511ef326 100755 --- a/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-button-textfield-right.png +++ b/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-button-textfield-right.png diff --git a/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-right.png b/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-right.png Binary files differindex 74658bdd24..e356916476 100755 --- a/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-right.png +++ b/uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-right.png diff --git a/uitest/reference-screenshots/chrome/GridLayoutWidthChangeTest-layoutIsReduced_ANY_Chrome__buttonMoved.png b/uitest/reference-screenshots/chrome/GridLayoutWidthChangeTest-layoutIsReduced_ANY_Chrome__buttonMoved.png Binary files differindex 2b6aa56641..5bbcae708a 100755 --- a/uitest/reference-screenshots/chrome/GridLayoutWidthChangeTest-layoutIsReduced_ANY_Chrome__buttonMoved.png +++ b/uitest/reference-screenshots/chrome/GridLayoutWidthChangeTest-layoutIsReduced_ANY_Chrome__buttonMoved.png diff --git a/uitest/reference-screenshots/chrome/GridLayoutWidthChangeTest-layoutIsReduced_ANY_Chrome__initial.png b/uitest/reference-screenshots/chrome/GridLayoutWidthChangeTest-layoutIsReduced_ANY_Chrome__initial.png Binary files differindex 4de80aa88f..56661d728d 100755 --- a/uitest/reference-screenshots/chrome/GridLayoutWidthChangeTest-layoutIsReduced_ANY_Chrome__initial.png +++ b/uitest/reference-screenshots/chrome/GridLayoutWidthChangeTest-layoutIsReduced_ANY_Chrome__initial.png diff --git a/uitest/reference-screenshots/chrome/HComponentSizingTest-ComponentSizing_ANY_Chrome__setSize_-1px.png b/uitest/reference-screenshots/chrome/HComponentSizingTest-ComponentSizing_ANY_Chrome__setSize_-1px.png Binary files differindex 9f266e3edb..15e8c42cfb 100755 --- a/uitest/reference-screenshots/chrome/HComponentSizingTest-ComponentSizing_ANY_Chrome__setSize_-1px.png +++ b/uitest/reference-screenshots/chrome/HComponentSizingTest-ComponentSizing_ANY_Chrome__setSize_-1px.png diff --git a/uitest/reference-screenshots/chrome/HLayoutSizingTest-LayoutSizing_ANY_Chrome__setSize_-1px.png b/uitest/reference-screenshots/chrome/HLayoutSizingTest-LayoutSizing_ANY_Chrome__setSize_-1px.png Binary files differindex 2f34a2b88b..aa2cbb4ac3 100755 --- a/uitest/reference-screenshots/chrome/HLayoutSizingTest-LayoutSizing_ANY_Chrome__setSize_-1px.png +++ b/uitest/reference-screenshots/chrome/HLayoutSizingTest-LayoutSizing_ANY_Chrome__setSize_-1px.png diff --git a/uitest/reference-screenshots/chrome/ResponsiveStylesTest-testValoMenuResponsiveParentSize_ANY_Chrome__defaultMenuWidths.png b/uitest/reference-screenshots/chrome/ResponsiveStylesTest-testValoMenuResponsiveParentSize_ANY_Chrome__defaultMenuWidths.png Binary files differindex 1e566798ab..91edc2d9bc 100755 --- a/uitest/reference-screenshots/chrome/ResponsiveStylesTest-testValoMenuResponsiveParentSize_ANY_Chrome__defaultMenuWidths.png +++ b/uitest/reference-screenshots/chrome/ResponsiveStylesTest-testValoMenuResponsiveParentSize_ANY_Chrome__defaultMenuWidths.png diff --git a/uitest/reference-screenshots/chrome/VAddReplaceMoveTest-LayoutAlignment_ANY_Chrome__move.png b/uitest/reference-screenshots/chrome/VAddReplaceMoveTest-LayoutAlignment_ANY_Chrome__move.png Binary files differindex 2355afba57..8a0755b895 100755 --- a/uitest/reference-screenshots/chrome/VAddReplaceMoveTest-LayoutAlignment_ANY_Chrome__move.png +++ b/uitest/reference-screenshots/chrome/VAddReplaceMoveTest-LayoutAlignment_ANY_Chrome__move.png diff --git a/uitest/reference-screenshots/chrome/VAddReplaceMoveTest-LayoutAlignment_ANY_Chrome__remove.png b/uitest/reference-screenshots/chrome/VAddReplaceMoveTest-LayoutAlignment_ANY_Chrome__remove.png Binary files differindex 5f8b4c3d49..35b7c2be80 100755 --- a/uitest/reference-screenshots/chrome/VAddReplaceMoveTest-LayoutAlignment_ANY_Chrome__remove.png +++ b/uitest/reference-screenshots/chrome/VAddReplaceMoveTest-LayoutAlignment_ANY_Chrome__remove.png diff --git a/uitest/src/main/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdate.java b/uitest/src/main/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdate.java index b4dc972d89..6b114176a0 100644 --- a/uitest/src/main/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdate.java +++ b/uitest/src/main/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdate.java @@ -5,13 +5,16 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.tests.widgetset.TestingWidgetSet; import com.vaadin.tests.widgetset.server.LayoutDuringStateUpdateComponent; +import com.vaadin.ui.Button; @Widgetset(TestingWidgetSet.NAME) public class LayoutDuringStateUpdate extends AbstractReindeerTestUI { @Override protected void setup(VaadinRequest request) { - addComponent(new LayoutDuringStateUpdateComponent()); + // delay adding of the component to ensure unrelated layouting calls + // don't interfere with the test + addComponent(new Button("Add component", + e -> addComponent(new LayoutDuringStateUpdateComponent()))); } - } diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/LayoutDuringStateUpdateConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/LayoutDuringStateUpdateConnector.java index 6ccb8d6175..1859362015 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/LayoutDuringStateUpdateConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/LayoutDuringStateUpdateConnector.java @@ -11,6 +11,7 @@ import com.vaadin.tests.widgetset.server.LayoutDuringStateUpdateComponent; public class LayoutDuringStateUpdateConnector extends AbstractComponentConnector implements PostLayoutListener { private int layoutCount = 0; + private String changeLog = ""; @Override protected void init() { @@ -29,13 +30,22 @@ public class LayoutDuringStateUpdateConnector extends AbstractComponentConnector try { getLayoutManager().layoutNow(); + + // these should never be reached + if (changeLog.isEmpty()) { + changeLog += " properties: "; + } + for (String property : stateChangeEvent.getChangedProperties()) { + changeLog += property + ", "; + } } catch (AssertionError e) { // Ignore } } private void updateLabelText() { - getWidget().setText("Layout phase count: " + layoutCount); + getWidget().setText("Layout phase count: " + layoutCount + changeLog); + changeLog = ""; } @Override diff --git a/uitest/src/test/java/com/vaadin/tests/components/MenuBarDownloadBrowserOpenerUITest.java b/uitest/src/test/java/com/vaadin/tests/components/MenuBarDownloadBrowserOpenerUITest.java index 2f2dd91ea8..7ac7ceaf86 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/MenuBarDownloadBrowserOpenerUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/MenuBarDownloadBrowserOpenerUITest.java @@ -5,7 +5,12 @@ import java.util.List; import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.Alert; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebDriverException; +import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.support.ui.ExpectedCondition; import com.vaadin.testbench.elements.MenuBarElement; import com.vaadin.testbench.parallel.Browser; @@ -21,21 +26,53 @@ public class MenuBarDownloadBrowserOpenerUITest extends MultiBrowserTest { @Test public void testTriggerExtension() { openTestURL(); - MenuBarElement first = $(MenuBarElement.class).first(); - first.clickItem("TestExtension", "RunMe"); + MenuBarElement menu = $(MenuBarElement.class).first(); + clickItem(menu, "TestExtension", "RunMe"); checkAndCloseAlert(); - first.clickItem("TestExtension", "AddTrigger"); - first.clickItem("TestExtension", "RunMe"); + clickItem(menu, "TestExtension", "AddTrigger"); + clickItem(menu, "TestExtension", "RunMe"); checkAndCloseAlert(); checkAndCloseAlert(); sleep(500); - first.clickItem("TestExtension", "RemoveTrigger"); - first.clickItem("TestExtension", "RunMe"); + clickItem(menu, "TestExtension", "RemoveTrigger"); + clickItem(menu, "TestExtension", "RunMe"); checkAndCloseAlert(); } + private void clickItem(MenuBarElement menu, String... captions) { + // click each given menu item in turn + for (String caption : captions) { + // wait for the menu item to become available + waitUntil(new ExpectedCondition<Boolean>() { + @Override + public Boolean apply(WebDriver arg0) { + List<WebElement> captionElements = findElements( + By.className("v-menubar-menuitem-caption")); + for (WebElement captionElement : captionElements) { + try { + if (captionElement.getText().equals(caption)) { + return true; + } + } catch (WebDriverException e) { + // stale, detached element is not visible + } + } + return false; + } + + @Override + public String toString() { + // Expected condition failed: waiting for ... + return caption + " to be available"; + } + }); + // menu item was found, click it + menu.clickItem(caption); + } + } + private void checkAndCloseAlert() { Alert alert = getDriver().switchTo().alert(); Assert.assertEquals("Trigger", alert.getText()); diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFocusTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFocusTest.java index 49e8312295..4e05f66c08 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFocusTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFocusTest.java @@ -1,5 +1,7 @@ package com.vaadin.tests.components.datefield; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.openqa.selenium.By; @@ -7,8 +9,6 @@ import com.vaadin.testbench.elements.DateFieldElement; import com.vaadin.testbench.elements.TextFieldElement; import com.vaadin.tests.tb3.MultiBrowserTest; -import static org.junit.Assert.assertEquals; - public class DateFieldFocusTest extends MultiBrowserTest { @Test @@ -22,10 +22,10 @@ public class DateFieldFocusTest extends MultiBrowserTest { // open DateField popup dateField.findElement(By.className("v-datefield-button")).click(); - sleep(100); + waitUntilLoadingIndicatorNotVisible(); // close DateField popup dateField.findElement(By.className("v-datefield-button")).click(); - sleep(100); + waitUntilLoadingIndicatorNotVisible(); assertEquals("1. focused", getLogRow(0)); textField.focus(); diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoardTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoardTest.java index 1b9d88957a..d92b3ac2dc 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoardTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoardTest.java @@ -1,12 +1,13 @@ package com.vaadin.tests.components.datefield; -import com.vaadin.tests.tb3.MultiBrowserTest; +import static org.junit.Assert.assertNotEquals; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; -import static org.junit.Assert.assertNotEquals; +import com.vaadin.tests.tb3.MultiBrowserTest; public class DateFieldNavigationKeyBoardTest extends MultiBrowserTest { @Test @@ -15,6 +16,8 @@ public class DateFieldNavigationKeyBoardTest extends MultiBrowserTest { // Opening pop-up findElement(By.className("v-datefield-button")).click(); waitForElementVisible(By.className("v-datefield-calendarpanel")); + waitForElementPresent( + By.className("v-datefield-calendarpanel-day-focused")); // Focused element in the calendarPanel WebElement focused = findElement( By.className("v-datefield-calendarpanel-day-focused")); diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java index 23a747c4ea..57d5405ed5 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java @@ -22,11 +22,12 @@ public class GridEditorFrozenColumnsUITest extends MultiBrowserTest { openTestURL(); openEditor(10); + waitUntilLoadingIndicatorNotVisible(); waitForElementPresent(By.className("v-grid-editor")); compareScreen("noscroll"); scrollGridHorizontallyTo(100); - sleep(500); + waitUntilLoadingIndicatorNotVisible(); compareScreen("scrolled"); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridInWindowResizeTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridInWindowResizeTest.java index 5efcdba1aa..ccb99cec63 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridInWindowResizeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridInWindowResizeTest.java @@ -13,6 +13,8 @@ public class GridInWindowResizeTest extends SingleBrowserTest { @Test public void resizeWindow() { openTestURL(); + waitUntilLoadingIndicatorNotVisible(); + GridElement grid = $(GridElement.class).first(); int col1WidthBefore = grid.getCell(0, 0).getSize().getWidth(); $(ButtonElement.class).caption("resize").first().click(); diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeHiddenColumnTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeHiddenColumnTest.java index 8c2529a509..dfe2158519 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeHiddenColumnTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeHiddenColumnTest.java @@ -1,5 +1,9 @@ package com.vaadin.tests.components.grid; +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; @@ -14,10 +18,6 @@ import com.vaadin.testbench.elements.GridElement.GridCellElement; import com.vaadin.testbench.parallel.BrowserUtil; 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 GridResizeHiddenColumnTest extends MultiBrowserTest { @Before @@ -61,6 +61,7 @@ public class GridResizeHiddenColumnTest extends MultiBrowserTest { sidebarPopup.findElements(By.className("gwt-MenuItem"))); // Click on "Last Name" menu item action.click(visibilityToggle).perform(); + waitUntilLoadingIndicatorNotVisible(); // Check if column "Last Name" is visible headerCells = grid.getHeaderCells(0); @@ -74,7 +75,6 @@ public class GridResizeHiddenColumnTest extends MultiBrowserTest { for (GridCellElement e : headerCells) { widthSum += e.getSize().getWidth(); } - sleep(100); assertEquals("'Last Name' column should take up the remaining space", grid.getHeader().getSize().getWidth(), widthSum, 1d); } @@ -102,5 +102,6 @@ public class GridResizeHiddenColumnTest extends MultiBrowserTest { getXOffset(headerCell, size.getWidth() + posX), getYOffset(headerCell, size.getHeight() / 2)) .clickAndHold().moveByOffset(offset, 0).release().perform(); + waitUntilLoadingIndicatorNotVisible(); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorRemoveAndAddRowsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorRemoveAndAddRowsTest.java index 82c7fda3cb..0430e7530a 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorRemoveAndAddRowsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorRemoveAndAddRowsTest.java @@ -27,12 +27,16 @@ public class EscalatorRemoveAndAddRowsTest selectMenuPath(GENERAL, POPULATE_COLUMN_ROW); scrollVerticallyTo(99999); + waitUntilLoadingIndicatorNotVisible(); + assertTrue("Escalator is not scrolled to bottom.", isElementPresent(By.xpath("//td[text() = 'Row 99: 0,99']"))); selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, REMOVE_ALL_INSERT_SCROLL); scrollVerticallyTo(99999); + waitUntilLoadingIndicatorNotVisible(); + assertTrue("Escalator is not scrolled to bottom.", isElementPresent(By.xpath("//td[text() = 'Row 29: 0,129']"))); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/ScrolledTabSheetResizeTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/ScrolledTabSheetResizeTest.java index f40c07823f..0390c52509 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/ScrolledTabSheetResizeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/ScrolledTabSheetResizeTest.java @@ -42,6 +42,10 @@ public class ScrolledTabSheetResizeTest extends MultiBrowserTest { } failed = true; exceptions.append(i + ": " + e.getMessage()); + if (e.getCause() != null && e.getCause().getMessage() != null + && !e.getCause().getMessage().trim().isEmpty()) { + exceptions.append(" - " + e.getCause().getMessage()); + } } catch (AssertionError e) { if (failed) { exceptions.append(" --- "); @@ -70,6 +74,10 @@ public class ScrolledTabSheetResizeTest extends MultiBrowserTest { } failed = true; exceptions.append(i + ": " + e.getMessage()); + if (e.getCause() != null && e.getCause().getMessage() != null + && !e.getCause().getMessage().trim().isEmpty()) { + exceptions.append(" - " + e.getCause().getMessage()); + } } catch (AssertionError e) { if (failed) { exceptions.append(" --- "); @@ -86,9 +94,11 @@ public class ScrolledTabSheetResizeTest extends MultiBrowserTest { private void testResize(int start) throws IOException, InterruptedException { testBench().resizeViewPortTo(start, 600); + waitUntilLoadingIndicatorNotVisible(); int iterations = 0; while (scrollRight() && iterations < 50) { + waitUntilLoadingIndicatorNotVisible(); ++iterations; } @@ -108,6 +118,7 @@ public class ScrolledTabSheetResizeTest extends MultiBrowserTest { // assertNoExtraRoom(start); testBench().resizeViewPortTo(start + 150, 600); + waitUntilLoadingIndicatorNotVisible(); assertNoExtraRoom(start + 150); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationTest.java index 2ba5cfa28f..ea33122541 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationTest.java @@ -25,9 +25,18 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest { Actions builder = new Actions(driver); builder.click(textArea); builder.sendKeys(textArea, "first line asdf"); + builder.perform(); + waitUntilLoadingIndicatorNotVisible(); + builder.sendKeys(Keys.ENTER); + builder.perform(); + waitUntilLoadingIndicatorNotVisible(); + builder.sendKeys(textArea, "second line jkl;"); builder.perform(); + waitUntilLoadingIndicatorNotVisible(); + + builder.perform(); // Should not have triggered shortcut assertEquals(" ", getLogRow(0)); @@ -41,9 +50,16 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest { 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.perform(); + waitUntilLoadingIndicatorNotVisible(); assertEquals("1. Escape button pressed", getLogRow(0)); } @@ -56,11 +72,16 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest { builder2.click(textField); builder2.sendKeys("third line"); - sleep(100); + builder2.perform(); + waitUntilLoadingIndicatorNotVisible(); + builder2.sendKeys(Keys.ENTER); - sleep(100); + builder2.perform(); + waitUntilLoadingIndicatorNotVisible(); + builder2.sendKeys(Keys.ESCAPE); builder2.perform(); + waitUntilLoadingIndicatorNotVisible(); assertEquals("1. Enter button pressed", getLogRow(1)); assertEquals("2. Escape button pressed", getLogRow(0)); @@ -74,9 +95,12 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest { builder2.click(textField); builder2.sendKeys("third line"); - builder2.sendKeys(Keys.ENTER); + builder2.perform(); + waitUntilLoadingIndicatorNotVisible(); + builder2.sendKeys(Keys.ENTER); builder2.perform(); + waitUntilLoadingIndicatorNotVisible(); assertEquals("1. Enter button pressed", getLogRow(0)); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/WindowHeaderButtonKeyboardActionsTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/WindowHeaderButtonKeyboardActionsTest.java index 93986f487e..9e7d647e9c 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/WindowHeaderButtonKeyboardActionsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/WindowHeaderButtonKeyboardActionsTest.java @@ -1,5 +1,7 @@ package com.vaadin.tests.components.window; +import static org.junit.Assert.assertTrue; + import java.io.IOException; import org.junit.Test; @@ -12,8 +14,6 @@ import com.vaadin.testbench.By; import com.vaadin.testbench.elements.WindowElement; import com.vaadin.tests.tb3.SingleBrowserTest; -import static org.junit.Assert.assertTrue; - public class WindowHeaderButtonKeyboardActionsTest extends SingleBrowserTest { private static final String HEADER_CLASS = "v-window-header"; @@ -191,10 +191,7 @@ public class WindowHeaderButtonKeyboardActionsTest extends SingleBrowserTest { // click button with mouse and wait closeButton.click(); - sleep(200); - - assertTrue("Window is not closed when focused element is clicked", - findElements(By.className("v-window")).size() == 0); + waitForElementNotPresent(By.className("v-window")); } // Tests for maximize-restore button diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/WindowTwinColSelectTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/WindowTwinColSelectTest.java index 23635b1004..47d42e7941 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/WindowTwinColSelectTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/WindowTwinColSelectTest.java @@ -1,5 +1,8 @@ package com.vaadin.tests.components.window; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Test; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; @@ -8,14 +11,12 @@ import com.vaadin.testbench.By; import com.vaadin.testbench.elements.TwinColSelectElement; import com.vaadin.tests.tb3.MultiBrowserTest; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - public class WindowTwinColSelectTest extends MultiBrowserTest { @Test public void testBothVisibleInitially() { openTestURL(); + waitUntilLoadingIndicatorNotVisible(); TwinColSelectElement twinColSelect = $(TwinColSelectElement.class) .first(); WebElement optionsElement = twinColSelect.getOptionsElement(); diff --git a/uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveUITest.java b/uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveUITest.java index 7287372adb..8e0faa31d6 100644 --- a/uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveUITest.java @@ -71,6 +71,7 @@ public class ResponsiveUITest extends MultiBrowserTest { @Test public void testResizingWindowReflowsLayout() throws Exception { openTestURL(); + waitUntilLoadingIndicatorNotVisible(); assertEquals("401px-600px", $(".v-csslayout-grid.first").getAttribute("width-range")); @@ -78,6 +79,7 @@ public class ResponsiveUITest extends MultiBrowserTest { $(".v-csslayout-grid.second").getAttribute("width-range")); testBench().resizeViewPortTo(1224, 768); + waitUntilLoadingIndicatorNotVisible(); assertEquals("601-800", $(".v-csslayout-grid.first").getAttribute("width-range")); @@ -85,6 +87,7 @@ public class ResponsiveUITest extends MultiBrowserTest { $(".v-csslayout-grid.second").getAttribute("width-range")); testBench().resizeViewPortTo(674, 768); + waitUntilLoadingIndicatorNotVisible(); assertEquals("201px-400px", $(".v-csslayout-grid.first").getAttribute("width-range")); diff --git a/uitest/src/test/java/com/vaadin/tests/fonticon/FontIconsTest.java b/uitest/src/test/java/com/vaadin/tests/fonticon/FontIconsTest.java index 532277059b..e59b5d59a1 100644 --- a/uitest/src/test/java/com/vaadin/tests/fonticon/FontIconsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fonticon/FontIconsTest.java @@ -15,6 +15,7 @@ public class FontIconsTest extends MultiBrowserTest { @Test public void checkScreenshot() throws IOException { openTestURL(); + waitUntilLoadingIndicatorNotVisible(); compareScreen("allVaadinIcons"); } diff --git a/uitest/src/test/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdateTest.java b/uitest/src/test/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdateTest.java index 6f33b5bb6e..607e089d20 100644 --- a/uitest/src/test/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdateTest.java +++ b/uitest/src/test/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdateTest.java @@ -6,6 +6,7 @@ import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; +import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.tests.tb3.SingleBrowserTest; public class LayoutDuringStateUpdateTest extends SingleBrowserTest { @@ -13,9 +14,14 @@ public class LayoutDuringStateUpdateTest extends SingleBrowserTest { @Test public void layoutDuringStateUpdate() { openTestURL(); + waitUntilLoadingIndicatorNotVisible(); - WebElement label = findElement(By.className("gwt-Label")); + // add the custom component + $(ButtonElement.class).first().click(); + waitUntilLoadingIndicatorNotVisible(); + // ensure the layouting failed to be triggered during the state update + WebElement label = findElement(By.className("gwt-Label")); assertEquals("Layout phase count: 1", label.getText()); } diff --git a/uitest/src/test/java/com/vaadin/tests/serialization/NoLayoutTest.java b/uitest/src/test/java/com/vaadin/tests/serialization/NoLayoutTest.java index 4746939241..545d2412f8 100644 --- a/uitest/src/test/java/com/vaadin/tests/serialization/NoLayoutTest.java +++ b/uitest/src/test/java/com/vaadin/tests/serialization/NoLayoutTest.java @@ -13,13 +13,18 @@ public class NoLayoutTest extends MultiBrowserTest { @Test public void testNoLayout() { openTestURL(); - assertCounts(1, 0); + // In some situations initial layouting is done in batches. That is OK, + // the point of this test is to ensure each subsequent action only + // causes expected amount of layouting rounds. + int offset = getCount("layoutCount") - 1; + + assertCounts(1 + offset, 0); $(CheckBoxElement.class).caption("UI polling enabled").first() .findElement(By.tagName("input")).click(); // Toggling check box requires layout - assertCounts(2, 0); + assertCounts(2 + offset, 0); try { Thread.sleep(2000); @@ -27,34 +32,34 @@ public class NoLayoutTest extends MultiBrowserTest { e.printStackTrace(); } // Count should not change even with polling enabled - assertCounts(2, 0); + assertCounts(2 + offset, 0); // Disable polling $(CheckBoxElement.class).caption("UI polling enabled").first() .findElement(By.tagName("input")).click(); // Toggling checkbox layotus again - assertCounts(3, 0); + assertCounts(3 + offset, 0); $(ButtonElement.class).caption("Change regular state").first().click(); // Updating normal state layouts - assertCounts(4, 0); + assertCounts(4 + offset, 0); $(ButtonElement.class).caption("Change @NoLayout state").first(); // Updating @NoLayout state does not layout - assertCounts(4, 0); + assertCounts(4 + offset, 0); $(ButtonElement.class).caption("Do regular RPC").first().click(); // Doing normal RPC layouts - assertCounts(5, 0); + assertCounts(5 + offset, 0); $(ButtonElement.class).caption("Do @NoLayout RPC").first().click(); // Doing @NoLayout RPC does not layout, but updates the RPC count - assertCounts(5, 1); + assertCounts(5 + offset, 1); $(ButtonElement.class).caption("Update LegacyComponent").first() .click(); // Painting LegacyComponent layouts - assertCounts(6, 1); + assertCounts(6 + offset, 1); } private void assertCounts(int layoutCount, int rpcCount) { diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java index cd5eb5d17e..c822901b1f 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -136,10 +136,6 @@ public abstract class AbstractTB3Test extends ParallelTest { int h = SCREENSHOT_HEIGHT; try { - if (BrowserUtil.isChrome(getDesiredCapabilities())) { - // Chrome 85 keeps failing in this task... - sleep(200); - } testBench().resizeViewPortTo(w, h); } catch (UnsupportedOperationException e) { // Opera does not support this... diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsComponentsGridOnly.java b/uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsComponentsGridOnly.java new file mode 100644 index 0000000000..9c071401f6 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsComponentsGridOnly.java @@ -0,0 +1,30 @@ +package com.vaadin.tests.tb3; + +import java.io.IOException; + +import org.junit.runner.RunWith; +import org.junit.runners.model.InitializationError; + +import com.vaadin.tests.tb3.LimitedTB3TestsComponentsGridOnly.LimitedTB3TestsComponentsGridOnlySuite; + +/** + * Test consisting of all TB3 tests within package + * com.vaadin.tests.components.grid (classes extending AbstractTB3Test). + * + * @author Vaadin Ltd + */ +@RunWith(LimitedTB3TestsComponentsGridOnlySuite.class) +public class LimitedTB3TestsComponentsGridOnly { + + public static class LimitedTB3TestsComponentsGridOnlySuite + extends TB3TestSuite { + + public LimitedTB3TestsComponentsGridOnlySuite(Class<?> klass) + throws InitializationError, IOException { + super(klass, AbstractTB3Test.class, + "com.vaadin.tests.components.grid", new String[] {}); + } + + } + +} diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsComponentsNoGrid.java b/uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsComponentsNoGrid.java new file mode 100644 index 0000000000..e719c5ea03 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsComponentsNoGrid.java @@ -0,0 +1,31 @@ +package com.vaadin.tests.tb3; + +import java.io.IOException; + +import org.junit.runner.RunWith; +import org.junit.runners.model.InitializationError; + +import com.vaadin.tests.tb3.LimitedTB3TestsComponentsNoGrid.LimitedTB3TestsComponentsNoGridSuite; + +/** + * Test consisting of all TB3 tests within package com.vaadin.tests.components + * except those within package com.vaadin.tests.components.grid (classes + * extending AbstractTB3Test). + * + * @author Vaadin Ltd + */ +@RunWith(LimitedTB3TestsComponentsNoGridSuite.class) +public class LimitedTB3TestsComponentsNoGrid { + + public static class LimitedTB3TestsComponentsNoGridSuite + extends TB3TestSuite { + + public LimitedTB3TestsComponentsNoGridSuite(Class<?> klass) + throws InitializationError, IOException { + super(klass, AbstractTB3Test.class, "com.vaadin.tests.components", + new String[] { "com.vaadin.tests.components.grid" }); + } + + } + +} diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsNonComponent.java b/uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsNonComponent.java new file mode 100644 index 0000000000..2537389354 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsNonComponent.java @@ -0,0 +1,31 @@ +package com.vaadin.tests.tb3; + +import java.io.IOException; + +import org.junit.runner.RunWith; +import org.junit.runners.model.InitializationError; + +import com.vaadin.tests.tb3.LimitedTB3TestsNonComponent.LimitedTB3TestsNonComponentSuite; + +/** + * Test consisting of all TB3 tests except integration tests and component tests + * (classes extending AbstractTB3Test, excludes packages + * com.vaadin.test.integration and com.vaadin.tests.components). + * + * @author Vaadin Ltd + */ +@RunWith(LimitedTB3TestsNonComponentSuite.class) +public class LimitedTB3TestsNonComponent { + + public static class LimitedTB3TestsNonComponentSuite extends TB3TestSuite { + + public LimitedTB3TestsNonComponentSuite(Class<?> klass) + throws InitializationError, IOException { + super(klass, AbstractTB3Test.class, "com.vaadin.tests", + new String[] { "com.vaadin.tests.integration", + "com.vaadin.tests.components" }); + } + + } + +} diff --git a/uitest/src/test/java/com/vaadin/tests/themes/valo/ResponsiveStylesTest.java b/uitest/src/test/java/com/vaadin/tests/themes/valo/ResponsiveStylesTest.java index a243c25a58..b8b376cff4 100644 --- a/uitest/src/test/java/com/vaadin/tests/themes/valo/ResponsiveStylesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/themes/valo/ResponsiveStylesTest.java @@ -52,7 +52,7 @@ public class ResponsiveStylesTest extends MultiBrowserTest { WebElement wideMenu = menus.get(WIDE_ELEMENT_INDEX); int wideWidth = wideMenu.getSize().width; assertThat(wideWidth, equalTo(WIDE_WIDTH)); - sleep(200); + sleep(300); compareScreen("defaultMenuWidths"); } |