From 64a43eeef4d4a7fff81f9d3acd626324d2a93a9b Mon Sep 17 00:00:00 2001 From: labkey-nicka Date: Thu, 5 Dec 2024 10:25:04 -0800 Subject: [PATCH] FilterSelectionDialog: handle non-removable fields --- .../ui/grids/FieldSelectionDialog.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/org/labkey/test/components/ui/grids/FieldSelectionDialog.java b/src/org/labkey/test/components/ui/grids/FieldSelectionDialog.java index f54e224380..5f4cb0e788 100644 --- a/src/org/labkey/test/components/ui/grids/FieldSelectionDialog.java +++ b/src/org/labkey/test/components/ui/grids/FieldSelectionDialog.java @@ -386,20 +386,25 @@ public FieldSelectionDialog removeFieldFromSelected(String field, int index) public FieldSelectionDialog removeAllSelectedFields() { List allItems = elementCache().getListItemElements(elementCache().selectedFieldsPanel); + boolean removedAll = true; - for(WebElement listItem : allItems) + for (WebElement listItem : allItems) { WebElement removeIcon = Locator.tagWithClass("span", "view-field__action").findWhenNeeded(listItem); - // For the tooltip not all fields can be removed. - if(removeIcon.isDisplayed()) + // In some usages there may be fields that are not removable. + if (!removeIcon.isDisplayed()) { - removeIcon.click(); + removedAll = false; + continue; } + + removeIcon.click(); } - WebDriverWrapper.waitFor(()-> getSelectedFields().isEmpty(), - "Did not remove all of the selected fields.", 500); + // If a non-removable field is encountered, then skip check to see if all fields are removed. + if (removedAll) + WebDriverWrapper.waitFor(()-> getSelectedFields().isEmpty(), "Did not remove all of the selected fields.", 500); return this; }