+ * Showing or hiding the selection column makes the grid re-render the column tree, which
+ * invalidates the row and its slots. The lookup is retried while that happens, so that a stale
+ * element or a cell whose slot is not rendered yet is not reported as an absent child.
+ */
+ private TestBenchElement getSlottedCellChild(int rowIndex, String tagName) {
+ try {
+ return new FluentWait<>(getDriver())
+ .withTimeout(Duration.ofSeconds(2))
+ .pollingEvery(Duration.ofMillis(50))
+ .ignoring(org.openqa.selenium.NoSuchElementException.class,
+ StaleElementReferenceException.class)
+ .until(driver -> {
+ TestBenchElement cell = getSlottedCell(getRow(rowIndex));
+ return cell.findElements(By.tagName(tagName)).stream().findFirst()
+ .map(TestBenchElement.class::cast).orElse(null);
+ });
+ } catch (TimeoutException e) {
+ return null;
+ }
}
-
private TestBenchElement getSlottedCell(WebElement e) {
String slot = e.findElement(By.tagName("slot")).getAttribute("name");
return findElement(By.cssSelector(String.format("[slot='%s']", slot)));
diff --git a/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/test/GridHelperTest.java b/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/test/GridHelperTest.java
index 9dc31cc..5bf4819 100644
--- a/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/test/GridHelperTest.java
+++ b/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/test/GridHelperTest.java
@@ -2,7 +2,7 @@
* #%L
* Grid Helpers Add-on
* %%
- * Copyright (C) 2022 - 2024 Flowing Code
+ * Copyright (C) 2022 - 2026 Flowing Code
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -184,11 +184,11 @@ public void testSelectOnClick() {
}
@Test
- public void testMenuToggleColumn() {
+ public void testMenuToggleSlot() {
grid.setColumnToggleVisible(true);
- Column