From b871528b82faece0070eef6646d09133b6487a4e Mon Sep 17 00:00:00 2001 From: XingY Date: Sun, 8 Nov 2026 22:04:10 -0800 Subject: [PATCH 1/2] CC review --- .../components/ui/grids/GridFilterModal.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/org/labkey/test/components/ui/grids/GridFilterModal.java b/src/org/labkey/test/components/ui/grids/GridFilterModal.java index 6a2c09ac8e..d546b013f5 100644 --- a/src/org/labkey/test/components/ui/grids/GridFilterModal.java +++ b/src/org/labkey/test/components/ui/grids/GridFilterModal.java @@ -16,6 +16,7 @@ package org.labkey.test.components.ui.grids; import org.labkey.test.Locator; +import org.labkey.test.WebDriverWrapper; import org.labkey.test.components.UpdatingComponent; import org.labkey.test.components.bootstrap.ModalDialog; import org.labkey.test.components.html.Checkbox; @@ -131,7 +132,7 @@ public List getFilteredFieldLabels() */ public FilterExpressionPanel selectExpressionTab() { - elementCache().filterTabs.selectTab("Filter"); + filterTabs().selectTab("Filter"); return elementCache().filterExpressionPanel(); } @@ -147,7 +148,7 @@ public GridFilterModal setFilter(FilterExpressionPanel.Expression expression) */ public FilterFacetedPanel selectFacetTab() { - elementCache().filterTabs.selectTab("Choose values"); + filterTabs().selectTab("Choose values"); return elementCache().filterFacetedPanel(); } @@ -158,7 +159,18 @@ public FilterFacetedPanel selectFacetTab() */ public List getTabText() { - return elementCache().filterTabs.getTabText(); + return filterTabs().getTabText(); + } + + /** + * The tabs for the selected field, once they are shown. Kanban 2177: the dialog shows a spinner in their + * place until the server reports what it knows about the column, which decides which tab opens. + */ + private Tabs filterTabs() + { + WebDriverWrapper.waitFor(() -> Locator.byClass("nav-tabs").existsIn(elementCache().filterPanel), + "Filter tabs never appeared for the selected field", 10_000); + return elementCache().filterTabs; } public String getActiveTab() @@ -167,7 +179,7 @@ public String getActiveTab() for(String tabText : getTabText()) { - if(elementCache().filterTabs.isTabSelected(tabText)) + if(filterTabs().isTabSelected(tabText)) { activeTab = tabText; break; From 12b24f000ecd0fcf7dd9f86237ff77fc8d86de73 Mon Sep 17 00:00:00 2001 From: XingY Date: Fri, 13 Nov 2026 13:11:37 -0800 Subject: [PATCH 2/2] fix test --- .../components/ui/grids/GridFilterModal.java | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/org/labkey/test/components/ui/grids/GridFilterModal.java b/src/org/labkey/test/components/ui/grids/GridFilterModal.java index d546b013f5..003ff5ea43 100644 --- a/src/org/labkey/test/components/ui/grids/GridFilterModal.java +++ b/src/org/labkey/test/components/ui/grids/GridFilterModal.java @@ -26,6 +26,7 @@ import org.labkey.test.params.WrapsFieldKey; import org.labkey.test.util.selenium.WebElementUtils; import org.openqa.selenium.NoSuchElementException; +import org.openqa.selenium.StaleElementReferenceException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; @@ -168,25 +169,26 @@ public List getTabText() */ private Tabs filterTabs() { - WebDriverWrapper.waitFor(() -> Locator.byClass("nav-tabs").existsIn(elementCache().filterPanel), - "Filter tabs never appeared for the selected field", 10_000); + WebDriverWrapper.waitFor(() -> { + try + { + return Locator.byClass("nav-tabs").existsIn(elementCache().filterPanel); + } + catch (NoSuchElementException | StaleElementReferenceException retry) + { + // The values column is re-rendered around the spinner, so its elements come and go + return false; + } + }, "Filter tabs never appeared for the selected field", 10_000); return elementCache().filterTabs; } + /** + * @return key of the selected tab ('Filter' or 'ChooseValues'), which is independent of the tab's label + */ public String getActiveTab() { - String activeTab = ""; - - for(String tabText : getTabText()) - { - if(filterTabs().isTabSelected(tabText)) - { - activeTab = tabText; - break; - } - } - - return activeTab; + return filterTabs().getSelectedTabKey(); } /**