Browse Source

Test fixes & split failsafe integration test runs into smaller batches (#12103)

tags/7.7.22
Anna Koskinen 3 years ago
parent
commit
a944032771
No account linked to committer's email address
36 changed files with 289 additions and 51 deletions
  1. 4
    0
      compatibility-themes/src/main/themes/VAADIN/themes/runo/select/select.scss
  2. 40
    3
      uitest/pom.xml
  3. BIN
      uitest/reference-screenshots/chrome/GridEditorFrozenColumnsUITest-testEditorWithFrozenColumns_ANY_Chrome__noscroll.png
  4. BIN
      uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__all-left.png
  5. BIN
      uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-button-right.png
  6. BIN
      uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-button-textfield-right.png
  7. BIN
      uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-right.png
  8. BIN
      uitest/reference-screenshots/chrome/GridLayoutWidthChangeTest-layoutIsReduced_ANY_Chrome__buttonMoved.png
  9. BIN
      uitest/reference-screenshots/chrome/GridLayoutWidthChangeTest-layoutIsReduced_ANY_Chrome__initial.png
  10. BIN
      uitest/reference-screenshots/chrome/HComponentSizingTest-ComponentSizing_ANY_Chrome__setSize_-1px.png
  11. BIN
      uitest/reference-screenshots/chrome/HLayoutSizingTest-LayoutSizing_ANY_Chrome__setSize_-1px.png
  12. BIN
      uitest/reference-screenshots/chrome/ResponsiveStylesTest-testValoMenuResponsiveParentSize_ANY_Chrome__defaultMenuWidths.png
  13. BIN
      uitest/reference-screenshots/chrome/VAddReplaceMoveTest-LayoutAlignment_ANY_Chrome__move.png
  14. BIN
      uitest/reference-screenshots/chrome/VAddReplaceMoveTest-LayoutAlignment_ANY_Chrome__remove.png
  15. 5
    2
      uitest/src/main/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdate.java
  16. 11
    1
      uitest/src/main/java/com/vaadin/tests/widgetset/client/LayoutDuringStateUpdateConnector.java
  17. 43
    6
      uitest/src/test/java/com/vaadin/tests/components/MenuBarDownloadBrowserOpenerUITest.java
  18. 4
    4
      uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFocusTest.java
  19. 5
    2
      uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoardTest.java
  20. 2
    1
      uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java
  21. 2
    0
      uitest/src/test/java/com/vaadin/tests/components/grid/GridInWindowResizeTest.java
  22. 6
    5
      uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeHiddenColumnTest.java
  23. 4
    0
      uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorRemoveAndAddRowsTest.java
  24. 11
    0
      uitest/src/test/java/com/vaadin/tests/components/tabsheet/ScrolledTabSheetResizeTest.java
  25. 27
    3
      uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationTest.java
  26. 3
    6
      uitest/src/test/java/com/vaadin/tests/components/window/WindowHeaderButtonKeyboardActionsTest.java
  27. 4
    3
      uitest/src/test/java/com/vaadin/tests/components/window/WindowTwinColSelectTest.java
  28. 3
    0
      uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveUITest.java
  29. 1
    0
      uitest/src/test/java/com/vaadin/tests/fonticon/FontIconsTest.java
  30. 7
    1
      uitest/src/test/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdateTest.java
  31. 14
    9
      uitest/src/test/java/com/vaadin/tests/serialization/NoLayoutTest.java
  32. 0
    4
      uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java
  33. 30
    0
      uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsComponentsGridOnly.java
  34. 31
    0
      uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsComponentsNoGrid.java
  35. 31
    0
      uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsNonComponent.java
  36. 1
    1
      uitest/src/test/java/com/vaadin/tests/themes/valo/ResponsiveStylesTest.java

+ 4
- 0
compatibility-themes/src/main/themes/VAADIN/themes/runo/select/select.scss View File

@@ -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;

+ 40
- 3
uitest/pom.xml View File

@@ -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>

BIN
uitest/reference-screenshots/chrome/GridEditorFrozenColumnsUITest-testEditorWithFrozenColumns_ANY_Chrome__noscroll.png View File


BIN
uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__all-left.png View File


BIN
uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-button-right.png View File


BIN
uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-button-textfield-right.png View File


BIN
uitest/reference-screenshots/chrome/GridLayoutMoveComponentTest-componentsShouldMoveRight_ANY_Chrome__label-right.png View File


BIN
uitest/reference-screenshots/chrome/GridLayoutWidthChangeTest-layoutIsReduced_ANY_Chrome__buttonMoved.png View File


BIN
uitest/reference-screenshots/chrome/GridLayoutWidthChangeTest-layoutIsReduced_ANY_Chrome__initial.png View File


BIN
uitest/reference-screenshots/chrome/HComponentSizingTest-ComponentSizing_ANY_Chrome__setSize_-1px.png View File


BIN
uitest/reference-screenshots/chrome/HLayoutSizingTest-LayoutSizing_ANY_Chrome__setSize_-1px.png View File


BIN
uitest/reference-screenshots/chrome/ResponsiveStylesTest-testValoMenuResponsiveParentSize_ANY_Chrome__defaultMenuWidths.png View File


BIN
uitest/reference-screenshots/chrome/VAddReplaceMoveTest-LayoutAlignment_ANY_Chrome__move.png View File


BIN
uitest/reference-screenshots/chrome/VAddReplaceMoveTest-LayoutAlignment_ANY_Chrome__remove.png View File


+ 5
- 2
uitest/src/main/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdate.java View File

@@ -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())));
}

}

+ 11
- 1
uitest/src/main/java/com/vaadin/tests/widgetset/client/LayoutDuringStateUpdateConnector.java View File

@@ -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

+ 43
- 6
uitest/src/test/java/com/vaadin/tests/components/MenuBarDownloadBrowserOpenerUITest.java View File

@@ -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());

+ 4
- 4
uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldFocusTest.java View File

@@ -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();

+ 5
- 2
uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoardTest.java View File

@@ -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"));

+ 2
- 1
uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java View File

@@ -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");
}


+ 2
- 0
uitest/src/test/java/com/vaadin/tests/components/grid/GridInWindowResizeTest.java View File

@@ -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();

+ 6
- 5
uitest/src/test/java/com/vaadin/tests/components/grid/GridResizeHiddenColumnTest.java View File

@@ -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();
}
}

+ 4
- 0
uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/escalator/EscalatorRemoveAndAddRowsTest.java View File

@@ -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']")));
}

+ 11
- 0
uitest/src/test/java/com/vaadin/tests/components/tabsheet/ScrolledTabSheetResizeTest.java View File

@@ -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);
}

+ 27
- 3
uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationTest.java View File

@@ -25,8 +25,17 @@ 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
@@ -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));
}

+ 3
- 6
uitest/src/test/java/com/vaadin/tests/components/window/WindowHeaderButtonKeyboardActionsTest.java View File

@@ -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

+ 4
- 3
uitest/src/test/java/com/vaadin/tests/components/window/WindowTwinColSelectTest.java View File

@@ -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();

+ 3
- 0
uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveUITest.java View File

@@ -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"));

+ 1
- 0
uitest/src/test/java/com/vaadin/tests/fonticon/FontIconsTest.java View File

@@ -15,6 +15,7 @@ public class FontIconsTest extends MultiBrowserTest {
@Test
public void checkScreenshot() throws IOException {
openTestURL();
waitUntilLoadingIndicatorNotVisible();
compareScreen("allVaadinIcons");
}


+ 7
- 1
uitest/src/test/java/com/vaadin/tests/layoutmanager/LayoutDuringStateUpdateTest.java View File

@@ -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());
}


+ 14
- 9
uitest/src/test/java/com/vaadin/tests/serialization/NoLayoutTest.java View File

@@ -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) {

+ 0
- 4
uitest/src/test/java/com/vaadin/tests/tb3/AbstractTB3Test.java View File

@@ -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...

+ 30
- 0
uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsComponentsGridOnly.java View File

@@ -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[] {});
}

}

}

+ 31
- 0
uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsComponentsNoGrid.java View File

@@ -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" });
}

}

}

+ 31
- 0
uitest/src/test/java/com/vaadin/tests/tb3/LimitedTB3TestsNonComponent.java View File

@@ -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" });
}

}

}

+ 1
- 1
uitest/src/test/java/com/vaadin/tests/themes/valo/ResponsiveStylesTest.java View File

@@ -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");
}

Loading…
Cancel
Save