Skip to content

Commit

Permalink
FilterSelectionDialog: handle non-removable fields
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-nicka committed Dec 12, 2024
1 parent 75d9e34 commit 64a43ee
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/org/labkey/test/components/ui/grids/FieldSelectionDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -386,20 +386,25 @@ public FieldSelectionDialog removeFieldFromSelected(String field, int index)
public FieldSelectionDialog removeAllSelectedFields()
{
List<WebElement> 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;
}
Expand Down

0 comments on commit 64a43ee

Please sign in to comment.