From d0ce883986dfdfc3f4ffb1e09a00dbf1233a5fa0 Mon Sep 17 00:00:00 2001 From: Anna Koskinen Date: Mon, 22 Nov 2021 17:17:58 +0200 Subject: [PATCH] Compatibility Grid test tweaks (#12483) --- .../tests/components/grid/GridReorderMergedTest.java | 6 ++++-- .../v7/tests/components/grid/GridClientRenderers.java | 9 ++++++++- .../vaadin/v7/tests/components/grid/GridHeightTest.java | 4 ++++ .../v7/tests/components/grid/GridReorderMergedTest.java | 6 ++++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridReorderMergedTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridReorderMergedTest.java index 80be6353c2..5f4b4446eb 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridReorderMergedTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridReorderMergedTest.java @@ -16,8 +16,10 @@ public class GridReorderMergedTest extends MultiBrowserTest { openTestURL(); GridElement grid = $(GridElement.class).first(); GridCellElement headerCell0_0 = grid.getHeaderCell(0, 0); - GridCellElement headerCell0_4 = grid.getHeaderCell(0, 4); - new Actions(driver).dragAndDrop(headerCell0_0, headerCell0_4).perform(); + // dragAndDrop(headerCell0_0, headerCell0_4) isn't enough for Firefox + new Actions(driver).clickAndHold(headerCell0_0) + .moveByOffset(headerCell0_0.getSize().getWidth() + 5, 5) + .release().perform(); // ensure the first merged block got dragged over the entire second // merged block diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridClientRenderers.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridClientRenderers.java index 71ba4c6251..3493d053cb 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridClientRenderers.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridClientRenderers.java @@ -19,6 +19,7 @@ import com.vaadin.testbench.elements.LabelElement; import com.vaadin.testbench.elements.NativeButtonElement; import com.vaadin.testbench.elements.NativeSelectElement; import com.vaadin.testbench.elementsbase.ServerClass; +import com.vaadin.testbench.parallel.BrowserUtil; import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; import com.vaadin.tests.widgetset.client.v7.grid.GridClientColumnRendererConnector.Renderers; @@ -134,11 +135,17 @@ public class GridClientRenderers extends MultiBrowserTest { // Simulate network latency with 2000ms latency = 2000; - // Chrome uses RGB instead of RGBA + // Chrome and IE11 use RGBA instead of RGB String colorRed = "rgba(255, 0, 0, 1)"; String colorWhite = "rgba(255, 255, 255, 1)"; String colorDark = "rgba(245, 245, 245, 1)"; + if (BrowserUtil.isFirefox(desiredCapabilities)) { + colorRed = "rgb(255, 0, 0)"; + colorWhite = "rgb(255, 255, 255)"; + colorDark = "rgb(245, 245, 245)"; + } + openTestURL(); getGrid(); diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeightTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeightTest.java index fd3c0ee16b..dc173a6d2c 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeightTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeightTest.java @@ -92,6 +92,10 @@ public class GridHeightTest extends MultiBrowserTest { detailsRowHeight, "opened" }); } + // Firefox fails to close the details row if the clicks happen + // too close to each other + sleep(500); + grid.getRow(2).click(5, 5); waitForElementNotPresent(By.id("lbl1")); diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridReorderMergedTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridReorderMergedTest.java index 27f5e4711e..5d15881a56 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridReorderMergedTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridReorderMergedTest.java @@ -16,8 +16,10 @@ public class GridReorderMergedTest extends MultiBrowserTest { openTestURL(); GridElement grid = $(GridElement.class).first(); GridCellElement headerCell0_0 = grid.getHeaderCell(0, 0); - GridCellElement headerCell0_4 = grid.getHeaderCell(0, 4); - new Actions(driver).dragAndDrop(headerCell0_0, headerCell0_4).perform(); + // dragAndDrop(headerCell0_0, headerCell0_4) isn't enough for Firefox + new Actions(driver).clickAndHold(headerCell0_0) + .moveByOffset(headerCell0_0.getSize().getWidth() + 5, 5) + .release().perform(); // ensure the first merged block got dragged over the entire second // merged block -- 2.39.5