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

outline: 5px auto -webkit-focus-ring-color; outline: 5px auto -webkit-focus-ring-color;
outline-offset: -4px; outline-offset: -4px;
} }
.v-ch & .#{$primaryStyleName}-focus {
/* remove safari focus outline offset for chrome (evaluates also as safari) */
outline-offset: 0;
}
.#{$primaryStyleName}-button { .#{$primaryStyleName}-button {
width: $select-button-width; width: $select-button-width;
margin-right: $select-button-negative-width; margin-right: $select-button-negative-width;

+ 40
- 3
uitest/pom.xml View File

<categories.exclude>${categories.exclude}</categories.exclude> <categories.exclude>${categories.exclude}</categories.exclude>
<browserstack.identifier>${browserstack.identifier}</browserstack.identifier> <browserstack.identifier>${browserstack.identifier}</browserstack.identifier>
</systemPropertyVariables> </systemPropertyVariables>
<includes>
<include>**/AllTB3Tests.java</include>
</includes>
</configuration> </configuration>
<executions> <executions>
<execution> <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> <goals>
<goal>integration-test</goal> <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> <goal>verify</goal>
</goals> </goals>
</execution> </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

import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.tests.widgetset.TestingWidgetSet; import com.vaadin.tests.widgetset.TestingWidgetSet;
import com.vaadin.tests.widgetset.server.LayoutDuringStateUpdateComponent; import com.vaadin.tests.widgetset.server.LayoutDuringStateUpdateComponent;
import com.vaadin.ui.Button;


@Widgetset(TestingWidgetSet.NAME) @Widgetset(TestingWidgetSet.NAME)
public class LayoutDuringStateUpdate extends AbstractReindeerTestUI { public class LayoutDuringStateUpdate extends AbstractReindeerTestUI {


@Override @Override
protected void setup(VaadinRequest request) { 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

public class LayoutDuringStateUpdateConnector extends AbstractComponentConnector public class LayoutDuringStateUpdateConnector extends AbstractComponentConnector
implements PostLayoutListener { implements PostLayoutListener {
private int layoutCount = 0; private int layoutCount = 0;
private String changeLog = "";


@Override @Override
protected void init() { protected void init() {


try { try {
getLayoutManager().layoutNow(); getLayoutManager().layoutNow();

// these should never be reached
if (changeLog.isEmpty()) {
changeLog += " properties: ";
}
for (String property : stateChangeEvent.getChangedProperties()) {
changeLog += property + ", ";
}
} catch (AssertionError e) { } catch (AssertionError e) {
// Ignore // Ignore
} }
} }


private void updateLabelText() { private void updateLabelText() {
getWidget().setText("Layout phase count: " + layoutCount);
getWidget().setText("Layout phase count: " + layoutCount + changeLog);
changeLog = "";
} }


@Override @Override

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

import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.openqa.selenium.Alert; 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.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedCondition;


import com.vaadin.testbench.elements.MenuBarElement; import com.vaadin.testbench.elements.MenuBarElement;
import com.vaadin.testbench.parallel.Browser; import com.vaadin.testbench.parallel.Browser;
@Test @Test
public void testTriggerExtension() { public void testTriggerExtension() {
openTestURL(); openTestURL();
MenuBarElement first = $(MenuBarElement.class).first();
first.clickItem("TestExtension", "RunMe");
MenuBarElement menu = $(MenuBarElement.class).first();
clickItem(menu, "TestExtension", "RunMe");
checkAndCloseAlert(); checkAndCloseAlert();


first.clickItem("TestExtension", "AddTrigger");
first.clickItem("TestExtension", "RunMe");
clickItem(menu, "TestExtension", "AddTrigger");
clickItem(menu, "TestExtension", "RunMe");
checkAndCloseAlert(); checkAndCloseAlert();
checkAndCloseAlert(); checkAndCloseAlert();


sleep(500); sleep(500);
first.clickItem("TestExtension", "RemoveTrigger");
first.clickItem("TestExtension", "RunMe");
clickItem(menu, "TestExtension", "RemoveTrigger");
clickItem(menu, "TestExtension", "RunMe");
checkAndCloseAlert(); 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() { private void checkAndCloseAlert() {
Alert alert = getDriver().switchTo().alert(); Alert alert = getDriver().switchTo().alert();
Assert.assertEquals("Trigger", alert.getText()); Assert.assertEquals("Trigger", alert.getText());

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

package com.vaadin.tests.components.datefield; package com.vaadin.tests.components.datefield;


import static org.junit.Assert.assertEquals;

import org.junit.Test; import org.junit.Test;
import org.openqa.selenium.By; import org.openqa.selenium.By;


import com.vaadin.testbench.elements.TextFieldElement; import com.vaadin.testbench.elements.TextFieldElement;
import com.vaadin.tests.tb3.MultiBrowserTest; import com.vaadin.tests.tb3.MultiBrowserTest;


import static org.junit.Assert.assertEquals;

public class DateFieldFocusTest extends MultiBrowserTest { public class DateFieldFocusTest extends MultiBrowserTest {


@Test @Test


// open DateField popup // open DateField popup
dateField.findElement(By.className("v-datefield-button")).click(); dateField.findElement(By.className("v-datefield-button")).click();
sleep(100);
waitUntilLoadingIndicatorNotVisible();
// close DateField popup // close DateField popup
dateField.findElement(By.className("v-datefield-button")).click(); dateField.findElement(By.className("v-datefield-button")).click();
sleep(100);
waitUntilLoadingIndicatorNotVisible();


assertEquals("1. focused", getLogRow(0)); assertEquals("1. focused", getLogRow(0));
textField.focus(); textField.focus();

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

package com.vaadin.tests.components.datefield; package com.vaadin.tests.components.datefield;


import com.vaadin.tests.tb3.MultiBrowserTest;
import static org.junit.Assert.assertNotEquals;

import org.junit.Test; import org.junit.Test;
import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.Keys; import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;


import static org.junit.Assert.assertNotEquals;
import com.vaadin.tests.tb3.MultiBrowserTest;


public class DateFieldNavigationKeyBoardTest extends MultiBrowserTest { public class DateFieldNavigationKeyBoardTest extends MultiBrowserTest {
@Test @Test
// Opening pop-up // Opening pop-up
findElement(By.className("v-datefield-button")).click(); findElement(By.className("v-datefield-button")).click();
waitForElementVisible(By.className("v-datefield-calendarpanel")); waitForElementVisible(By.className("v-datefield-calendarpanel"));
waitForElementPresent(
By.className("v-datefield-calendarpanel-day-focused"));
// Focused element in the calendarPanel // Focused element in the calendarPanel
WebElement focused = findElement( WebElement focused = findElement(
By.className("v-datefield-calendarpanel-day-focused")); By.className("v-datefield-calendarpanel-day-focused"));

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

openTestURL(); openTestURL();


openEditor(10); openEditor(10);
waitUntilLoadingIndicatorNotVisible();
waitForElementPresent(By.className("v-grid-editor")); waitForElementPresent(By.className("v-grid-editor"));
compareScreen("noscroll"); compareScreen("noscroll");


scrollGridHorizontallyTo(100); scrollGridHorizontallyTo(100);
sleep(500);
waitUntilLoadingIndicatorNotVisible();
compareScreen("scrolled"); compareScreen("scrolled");
} }



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

@Test @Test
public void resizeWindow() { public void resizeWindow() {
openTestURL(); openTestURL();
waitUntilLoadingIndicatorNotVisible();

GridElement grid = $(GridElement.class).first(); GridElement grid = $(GridElement.class).first();
int col1WidthBefore = grid.getCell(0, 0).getSize().getWidth(); int col1WidthBefore = grid.getCell(0, 0).getSize().getWidth();
$(ButtonElement.class).caption("resize").first().click(); $(ButtonElement.class).caption("resize").first().click();

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

package com.vaadin.tests.components.grid; 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 java.util.List;


import org.junit.Before; import org.junit.Before;
import com.vaadin.testbench.parallel.BrowserUtil; import com.vaadin.testbench.parallel.BrowserUtil;
import com.vaadin.tests.tb3.MultiBrowserTest; 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 { public class GridResizeHiddenColumnTest extends MultiBrowserTest {


@Before @Before
sidebarPopup.findElements(By.className("gwt-MenuItem"))); sidebarPopup.findElements(By.className("gwt-MenuItem")));
// Click on "Last Name" menu item // Click on "Last Name" menu item
action.click(visibilityToggle).perform(); action.click(visibilityToggle).perform();
waitUntilLoadingIndicatorNotVisible();


// Check if column "Last Name" is visible // Check if column "Last Name" is visible
headerCells = grid.getHeaderCells(0); headerCells = grid.getHeaderCells(0);
for (GridCellElement e : headerCells) { for (GridCellElement e : headerCells) {
widthSum += e.getSize().getWidth(); widthSum += e.getSize().getWidth();
} }
sleep(100);
assertEquals("'Last Name' column should take up the remaining space", assertEquals("'Last Name' column should take up the remaining space",
grid.getHeader().getSize().getWidth(), widthSum, 1d); grid.getHeader().getSize().getWidth(), widthSum, 1d);
} }
getXOffset(headerCell, size.getWidth() + posX), getXOffset(headerCell, size.getWidth() + posX),
getYOffset(headerCell, size.getHeight() / 2)) getYOffset(headerCell, size.getHeight() / 2))
.clickAndHold().moveByOffset(offset, 0).release().perform(); .clickAndHold().moveByOffset(offset, 0).release().perform();
waitUntilLoadingIndicatorNotVisible();
} }
} }

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

selectMenuPath(GENERAL, POPULATE_COLUMN_ROW); selectMenuPath(GENERAL, POPULATE_COLUMN_ROW);


scrollVerticallyTo(99999); scrollVerticallyTo(99999);
waitUntilLoadingIndicatorNotVisible();

assertTrue("Escalator is not scrolled to bottom.", assertTrue("Escalator is not scrolled to bottom.",
isElementPresent(By.xpath("//td[text() = 'Row 99: 0,99']"))); isElementPresent(By.xpath("//td[text() = 'Row 99: 0,99']")));


selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, REMOVE_ALL_INSERT_SCROLL); selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, REMOVE_ALL_INSERT_SCROLL);


scrollVerticallyTo(99999); scrollVerticallyTo(99999);
waitUntilLoadingIndicatorNotVisible();

assertTrue("Escalator is not scrolled to bottom.", assertTrue("Escalator is not scrolled to bottom.",
isElementPresent(By.xpath("//td[text() = 'Row 29: 0,129']"))); isElementPresent(By.xpath("//td[text() = 'Row 29: 0,129']")));
} }

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

} }
failed = true; failed = true;
exceptions.append(i + ": " + e.getMessage()); 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) { } catch (AssertionError e) {
if (failed) { if (failed) {
exceptions.append(" --- "); exceptions.append(" --- ");
} }
failed = true; failed = true;
exceptions.append(i + ": " + e.getMessage()); 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) { } catch (AssertionError e) {
if (failed) { if (failed) {
exceptions.append(" --- "); exceptions.append(" --- ");
private void testResize(int start) private void testResize(int start)
throws IOException, InterruptedException { throws IOException, InterruptedException {
testBench().resizeViewPortTo(start, 600); testBench().resizeViewPortTo(start, 600);
waitUntilLoadingIndicatorNotVisible();


int iterations = 0; int iterations = 0;
while (scrollRight() && iterations < 50) { while (scrollRight() && iterations < 50) {
waitUntilLoadingIndicatorNotVisible();
++iterations; ++iterations;
} }


// assertNoExtraRoom(start); // assertNoExtraRoom(start);


testBench().resizeViewPortTo(start + 150, 600); testBench().resizeViewPortTo(start + 150, 600);
waitUntilLoadingIndicatorNotVisible();


assertNoExtraRoom(start + 150); assertNoExtraRoom(start + 150);
} }

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

Actions builder = new Actions(driver); Actions builder = new Actions(driver);
builder.click(textArea); builder.click(textArea);
builder.sendKeys(textArea, "first line asdf"); builder.sendKeys(textArea, "first line asdf");
builder.perform();
waitUntilLoadingIndicatorNotVisible();

builder.sendKeys(Keys.ENTER); builder.sendKeys(Keys.ENTER);
builder.perform();
waitUntilLoadingIndicatorNotVisible();

builder.sendKeys(textArea, "second line jkl;"); builder.sendKeys(textArea, "second line jkl;");
builder.perform();
waitUntilLoadingIndicatorNotVisible();

builder.perform(); builder.perform();


// Should not have triggered shortcut // Should not have triggered shortcut
Actions builder = new Actions(driver); Actions builder = new Actions(driver);
builder.click(textArea); builder.click(textArea);
builder.sendKeys(textArea, "first line asdf"); builder.sendKeys(textArea, "first line asdf");
builder.perform();
waitUntilLoadingIndicatorNotVisible();

builder.sendKeys(Keys.ESCAPE); builder.sendKeys(Keys.ESCAPE);
builder.perform();
waitUntilLoadingIndicatorNotVisible();

builder.sendKeys(textArea, "second line jkl;"); builder.sendKeys(textArea, "second line jkl;");
builder.perform(); builder.perform();
waitUntilLoadingIndicatorNotVisible();


assertEquals("1. Escape button pressed", getLogRow(0)); assertEquals("1. Escape button pressed", getLogRow(0));
} }
builder2.click(textField); builder2.click(textField);


builder2.sendKeys("third line"); builder2.sendKeys("third line");
sleep(100);
builder2.perform();
waitUntilLoadingIndicatorNotVisible();

builder2.sendKeys(Keys.ENTER); builder2.sendKeys(Keys.ENTER);
sleep(100);
builder2.perform();
waitUntilLoadingIndicatorNotVisible();

builder2.sendKeys(Keys.ESCAPE); builder2.sendKeys(Keys.ESCAPE);
builder2.perform(); builder2.perform();
waitUntilLoadingIndicatorNotVisible();


assertEquals("1. Enter button pressed", getLogRow(1)); assertEquals("1. Enter button pressed", getLogRow(1));
assertEquals("2. Escape button pressed", getLogRow(0)); assertEquals("2. Escape button pressed", getLogRow(0));
builder2.click(textField); builder2.click(textField);


builder2.sendKeys("third line"); builder2.sendKeys("third line");
builder2.sendKeys(Keys.ENTER);
builder2.perform();
waitUntilLoadingIndicatorNotVisible();


builder2.sendKeys(Keys.ENTER);
builder2.perform(); builder2.perform();
waitUntilLoadingIndicatorNotVisible();


assertEquals("1. Enter button pressed", getLogRow(0)); assertEquals("1. Enter button pressed", getLogRow(0));
} }

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

package com.vaadin.tests.components.window; package com.vaadin.tests.components.window;


import static org.junit.Assert.assertTrue;

import java.io.IOException; import java.io.IOException;


import org.junit.Test; import org.junit.Test;
import com.vaadin.testbench.elements.WindowElement; import com.vaadin.testbench.elements.WindowElement;
import com.vaadin.tests.tb3.SingleBrowserTest; import com.vaadin.tests.tb3.SingleBrowserTest;


import static org.junit.Assert.assertTrue;

public class WindowHeaderButtonKeyboardActionsTest extends SingleBrowserTest { public class WindowHeaderButtonKeyboardActionsTest extends SingleBrowserTest {


private static final String HEADER_CLASS = "v-window-header"; private static final String HEADER_CLASS = "v-window-header";


// click button with mouse and wait // click button with mouse and wait
closeButton.click(); 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 // Tests for maximize-restore button

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

package com.vaadin.tests.components.window; package com.vaadin.tests.components.window;


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.junit.Test; import org.junit.Test;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.interactions.Actions;
import com.vaadin.testbench.elements.TwinColSelectElement; import com.vaadin.testbench.elements.TwinColSelectElement;
import com.vaadin.tests.tb3.MultiBrowserTest; import com.vaadin.tests.tb3.MultiBrowserTest;


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class WindowTwinColSelectTest extends MultiBrowserTest { public class WindowTwinColSelectTest extends MultiBrowserTest {


@Test @Test
public void testBothVisibleInitially() { public void testBothVisibleInitially() {
openTestURL(); openTestURL();
waitUntilLoadingIndicatorNotVisible();
TwinColSelectElement twinColSelect = $(TwinColSelectElement.class) TwinColSelectElement twinColSelect = $(TwinColSelectElement.class)
.first(); .first();
WebElement optionsElement = twinColSelect.getOptionsElement(); WebElement optionsElement = twinColSelect.getOptionsElement();

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

@Test @Test
public void testResizingWindowReflowsLayout() throws Exception { public void testResizingWindowReflowsLayout() throws Exception {
openTestURL(); openTestURL();
waitUntilLoadingIndicatorNotVisible();


assertEquals("401px-600px", assertEquals("401px-600px",
$(".v-csslayout-grid.first").getAttribute("width-range")); $(".v-csslayout-grid.first").getAttribute("width-range"));
$(".v-csslayout-grid.second").getAttribute("width-range")); $(".v-csslayout-grid.second").getAttribute("width-range"));


testBench().resizeViewPortTo(1224, 768); testBench().resizeViewPortTo(1224, 768);
waitUntilLoadingIndicatorNotVisible();


assertEquals("601-800", assertEquals("601-800",
$(".v-csslayout-grid.first").getAttribute("width-range")); $(".v-csslayout-grid.first").getAttribute("width-range"));
$(".v-csslayout-grid.second").getAttribute("width-range")); $(".v-csslayout-grid.second").getAttribute("width-range"));


testBench().resizeViewPortTo(674, 768); testBench().resizeViewPortTo(674, 768);
waitUntilLoadingIndicatorNotVisible();


assertEquals("201px-400px", assertEquals("201px-400px",
$(".v-csslayout-grid.first").getAttribute("width-range")); $(".v-csslayout-grid.first").getAttribute("width-range"));

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

@Test @Test
public void checkScreenshot() throws IOException { public void checkScreenshot() throws IOException {
openTestURL(); openTestURL();
waitUntilLoadingIndicatorNotVisible();
compareScreen("allVaadinIcons"); compareScreen("allVaadinIcons");
} }



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

import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;


import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.tests.tb3.SingleBrowserTest; import com.vaadin.tests.tb3.SingleBrowserTest;


public class LayoutDuringStateUpdateTest extends SingleBrowserTest { public class LayoutDuringStateUpdateTest extends SingleBrowserTest {
@Test @Test
public void layoutDuringStateUpdate() { public void layoutDuringStateUpdate() {
openTestURL(); 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()); assertEquals("Layout phase count: 1", label.getText());
} }



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

@Test @Test
public void testNoLayout() { public void testNoLayout() {
openTestURL(); 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() $(CheckBoxElement.class).caption("UI polling enabled").first()
.findElement(By.tagName("input")).click(); .findElement(By.tagName("input")).click();


// Toggling check box requires layout // Toggling check box requires layout
assertCounts(2, 0);
assertCounts(2 + offset, 0);


try { try {
Thread.sleep(2000); Thread.sleep(2000);
e.printStackTrace(); e.printStackTrace();
} }
// Count should not change even with polling enabled // Count should not change even with polling enabled
assertCounts(2, 0);
assertCounts(2 + offset, 0);


// Disable polling // Disable polling
$(CheckBoxElement.class).caption("UI polling enabled").first() $(CheckBoxElement.class).caption("UI polling enabled").first()
.findElement(By.tagName("input")).click(); .findElement(By.tagName("input")).click();
// Toggling checkbox layotus again // Toggling checkbox layotus again
assertCounts(3, 0);
assertCounts(3 + offset, 0);


$(ButtonElement.class).caption("Change regular state").first().click(); $(ButtonElement.class).caption("Change regular state").first().click();
// Updating normal state layouts // Updating normal state layouts
assertCounts(4, 0);
assertCounts(4 + offset, 0);


$(ButtonElement.class).caption("Change @NoLayout state").first(); $(ButtonElement.class).caption("Change @NoLayout state").first();
// Updating @NoLayout state does not layout // Updating @NoLayout state does not layout
assertCounts(4, 0);
assertCounts(4 + offset, 0);


$(ButtonElement.class).caption("Do regular RPC").first().click(); $(ButtonElement.class).caption("Do regular RPC").first().click();
// Doing normal RPC layouts // Doing normal RPC layouts
assertCounts(5, 0);
assertCounts(5 + offset, 0);


$(ButtonElement.class).caption("Do @NoLayout RPC").first().click(); $(ButtonElement.class).caption("Do @NoLayout RPC").first().click();
// Doing @NoLayout RPC does not layout, but updates the RPC count // Doing @NoLayout RPC does not layout, but updates the RPC count
assertCounts(5, 1);
assertCounts(5 + offset, 1);


$(ButtonElement.class).caption("Update LegacyComponent").first() $(ButtonElement.class).caption("Update LegacyComponent").first()
.click(); .click();
// Painting LegacyComponent layouts // Painting LegacyComponent layouts
assertCounts(6, 1);
assertCounts(6 + offset, 1);
} }


private void assertCounts(int layoutCount, int rpcCount) { private void assertCounts(int layoutCount, int rpcCount) {

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

int h = SCREENSHOT_HEIGHT; int h = SCREENSHOT_HEIGHT;


try { try {
if (BrowserUtil.isChrome(getDesiredCapabilities())) {
// Chrome 85 keeps failing in this task...
sleep(200);
}
testBench().resizeViewPortTo(w, h); testBench().resizeViewPortTo(w, h);
} catch (UnsupportedOperationException e) { } catch (UnsupportedOperationException e) {
// Opera does not support this... // Opera does not support this...

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

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

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

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

WebElement wideMenu = menus.get(WIDE_ELEMENT_INDEX); WebElement wideMenu = menus.get(WIDE_ELEMENT_INDEX);
int wideWidth = wideMenu.getSize().width; int wideWidth = wideMenu.getSize().width;
assertThat(wideWidth, equalTo(WIDE_WIDTH)); assertThat(wideWidth, equalTo(WIDE_WIDTH));
sleep(200);
sleep(300);


compareScreen("defaultMenuWidths"); compareScreen("defaultMenuWidths");
} }

Loading…
Cancel
Save