From ca064d5b5924fdec5f51bcbf65d1e9b71400f3c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20I=C3=9Fbr=C3=BCcker?= Date: Wed, 27 Nov 2024 08:08:02 +0100 Subject: [PATCH] test: make integration tests work with new headless mode (23.5) (#6871) * test: make integration tests work with new headless mode * fix time picker IT --- .../test/dataview/AbstractItemCountComboBoxIT.java | 2 +- .../main/java/com/vaadin/tests/AbstractComponentIT.java | 7 +++++++ .../flow/component/spreadsheet/test/ContextMenuIT.java | 5 +++-- .../flow/component/timepicker/tests/TimePickerIT.java | 4 +++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/vaadin-combo-box-flow-parent/vaadin-combo-box-flow-integration-tests/src/test/java/com/vaadin/flow/component/combobox/test/dataview/AbstractItemCountComboBoxIT.java b/vaadin-combo-box-flow-parent/vaadin-combo-box-flow-integration-tests/src/test/java/com/vaadin/flow/component/combobox/test/dataview/AbstractItemCountComboBoxIT.java index 2df2fa9dbf8..510013ce840 100644 --- a/vaadin-combo-box-flow-parent/vaadin-combo-box-flow-integration-tests/src/test/java/com/vaadin/flow/component/combobox/test/dataview/AbstractItemCountComboBoxIT.java +++ b/vaadin-combo-box-flow-parent/vaadin-combo-box-flow-integration-tests/src/test/java/com/vaadin/flow/component/combobox/test/dataview/AbstractItemCountComboBoxIT.java @@ -32,7 +32,7 @@ public abstract class AbstractItemCountComboBoxIT extends AbstractComboBoxIT { // changing the dimension might get combo box change what it fetches and // how many items it shows, so changing this is a bad idea ... - private static final Dimension TARGET_SIZE = new Dimension(1000, 900); + private static final Dimension TARGET_SIZE = new Dimension(1000, 1100); protected ComboBoxElement comboBoxElement; protected int countIncreasePageCount = 4; protected int pageSize = new ComboBox().getPageSize(); diff --git a/vaadin-flow-components-shared-parent/vaadin-flow-components-test-util/src/main/java/com/vaadin/tests/AbstractComponentIT.java b/vaadin-flow-components-shared-parent/vaadin-flow-components-test-util/src/main/java/com/vaadin/tests/AbstractComponentIT.java index a3612bfda35..11bdae98258 100644 --- a/vaadin-flow-components-shared-parent/vaadin-flow-components-test-util/src/main/java/com/vaadin/tests/AbstractComponentIT.java +++ b/vaadin-flow-components-shared-parent/vaadin-flow-components-test-util/src/main/java/com/vaadin/tests/AbstractComponentIT.java @@ -22,4 +22,11 @@ protected int getDeploymentPort() { return 8080; } + @Override + public void setup() throws Exception { + super.setup(); + + // Set a default window size + testBench().resizeViewPortTo(1024, 800); + } } diff --git a/vaadin-spreadsheet-flow-parent/vaadin-spreadsheet-flow-integration-tests/src/test/java/com/vaadin/flow/component/spreadsheet/test/ContextMenuIT.java b/vaadin-spreadsheet-flow-parent/vaadin-spreadsheet-flow-integration-tests/src/test/java/com/vaadin/flow/component/spreadsheet/test/ContextMenuIT.java index 59fa47638ee..354e32c9ba5 100644 --- a/vaadin-spreadsheet-flow-parent/vaadin-spreadsheet-flow-integration-tests/src/test/java/com/vaadin/flow/component/spreadsheet/test/ContextMenuIT.java +++ b/vaadin-spreadsheet-flow-parent/vaadin-spreadsheet-flow-integration-tests/src/test/java/com/vaadin/flow/component/spreadsheet/test/ContextMenuIT.java @@ -34,8 +34,9 @@ public void documentScroll_overlayPosition() { // Make sure to use a small enough viewport so that the document needs // to be scrolled to see the cell getDriver().manage().window().setSize(WINDOW_SIZE_SMALL); - // Scroll the document horizontally - executeScript("document.documentElement.scrollLeft = 100"); + // Scroll the document so the cell is visible + executeScript( + "document.documentElement.scrollLeft = 100;document.documentElement.scrollTop = 200;"); var cell = getSpreadsheet().getCellAt("B2"); // Open context menu for the cell diff --git a/vaadin-time-picker-flow-parent/vaadin-time-picker-flow-integration-tests/src/test/java/com/vaadin/flow/component/timepicker/tests/TimePickerIT.java b/vaadin-time-picker-flow-parent/vaadin-time-picker-flow-integration-tests/src/test/java/com/vaadin/flow/component/timepicker/tests/TimePickerIT.java index de493aac9c2..7c3b22cfcad 100644 --- a/vaadin-time-picker-flow-parent/vaadin-time-picker-flow-integration-tests/src/test/java/com/vaadin/flow/component/timepicker/tests/TimePickerIT.java +++ b/vaadin-time-picker-flow-parent/vaadin-time-picker-flow-integration-tests/src/test/java/com/vaadin/flow/component/timepicker/tests/TimePickerIT.java @@ -115,9 +115,11 @@ public void timePickerWithMinAndMaxSetting() { Assert.assertEquals( "The first item in the dropdown should be the min value", "5:00 AM", picker.getItemText(0)); + // Make sure the item is in the viewport / rendered + picker.scrollToItem(1000); Assert.assertEquals( "The last item in the dropdown should be the max value", - "4:00 PM", picker.getLastItemText()); + "6:00 PM", picker.getLastItemText()); } @Test