Skip to content

Commit

Permalink
test: make integration tests work with new headless mode (#6870)
Browse files Browse the repository at this point in the history
  • Loading branch information
sissbruecker authored Nov 27, 2024
1 parent 8832587 commit 5deb5b2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>().getPageSize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
*/
package com.vaadin.tests;

import java.util.List;

import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;

public abstract class AbstractComponentIT
extends com.vaadin.flow.testutil.AbstractComponentIT {

Expand All @@ -28,22 +23,10 @@ protected int getDeploymentPort() {
}

@Override
protected List<DesiredCapabilities> customizeCapabilities(
List<DesiredCapabilities> capabilities) {
// This method is overridden to force the legacy Chrome headless mode
// for the time being. The new `--headless=new` mode has an issue
// that doesn't allow tests to adjust the browser window size with
// `getDriver().manage().window().setSize(...)`, see more:
// https://github.com/SeleniumHQ/selenium/issues/11706
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless", "--disable-gpu");
public void setup() throws Exception {
super.setup();

capabilities.stream()
.filter(cap -> "chrome".equalsIgnoreCase(cap.getBrowserName()))
.forEach(cap -> cap.setCapability(ChromeOptions.CAPABILITY,
chromeOptions));

return capabilities;
// Set a default window size
testBench().resizeViewPortTo(1024, 800);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5deb5b2

Please sign in to comment.