diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2018-06-21 13:31:33 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2018-07-04 11:41:36 +0300 |
commit | d69d6862dce3e4801067362d9b453de92c254abc (patch) | |
tree | 98a0e291d2dda8173d1a47c315356d2dee553588 | |
parent | 82ca9f43d1697aefd9986594afe83f4d831f6e6c (diff) | |
download | vaadin-framework-d69d6862dce3e4801067362d9b453de92c254abc.tar.gz vaadin-framework-d69d6862dce3e4801067362d9b453de92c254abc.zip |
Fix Grid Editor in TabSheet test for Firefox (#10991)
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/grid/GridInTabSheetTest.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridInTabSheetTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridInTabSheetTest.java index 5b277f729f..53680699b6 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridInTabSheetTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridInTabSheetTest.java @@ -10,8 +10,10 @@ import org.openqa.selenium.Keys; import com.vaadin.testbench.By; import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.GridElement; +import com.vaadin.testbench.elements.GridElement.GridCellElement; import com.vaadin.testbench.elements.NotificationElement; import com.vaadin.testbench.elements.TabSheetElement; +import com.vaadin.testbench.parallel.BrowserUtil; import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -93,7 +95,7 @@ public class GridInTabSheetTest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); - grid.getCell(0, 1).doubleClick(); + editRow(grid, 0); assertEquals("Editor should be open", "0", grid.getEditor().getField(1).getAttribute("value")); @@ -105,20 +107,30 @@ public class GridInTabSheetTest extends MultiBrowserTest { assertFalse("Editor should be closed.", grid.isElementPresent(By.vaadin("#editor"))); - grid.getCell(1, 1).doubleClick(); + editRow(grid, 1); assertEquals("Editor should open after tab switch", "1", grid.getEditor().getField(1).getAttribute("value")); // Close the current editor and reopen on a different row grid.sendKeys(Keys.ESCAPE); - grid.getCell(0, 1).doubleClick(); + editRow(grid, 0); assertEquals("Editor should move", "0", grid.getEditor().getField(1).getAttribute("value")); assertNoErrorNotifications(); } + protected void editRow(GridElement grid, int row) { + GridCellElement cell = grid.getCell(row, 1); + if (BrowserUtil.isFirefox(getDesiredCapabilities())) { + cell.click(); + grid.sendKeys(Keys.RETURN); + } else { + cell.doubleClick(); + } + } + private void removeGridRow() { $(ButtonElement.class).caption("Remove row from Grid").first().click(); } |