Skip to content

Commit

Permalink
provide optional assert if selection does not appear
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-chrisj committed Jan 11, 2024
1 parent b344bf1 commit 3be61ec
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/org/labkey/test/components/ui/grids/DetailTableEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,23 +324,28 @@ public DetailTableEdit setSelectValue(String fieldCaption, List<String> selectVa
**/
public DetailTableEdit clearSelectValue(String fieldCaption)
{
return clearSelectValue(fieldCaption, true);
return clearSelectValue(fieldCaption, true, true);
}

/**
* Clear a given select field
* @param fieldCaption The caption/label of the field to clear.
* @param waitForSelection If true, wait for the select to have a selection before clearing it
* and assert if no selection appears
* @param assertSelection If true, assert if no selection appears (note: does nothing if waitForSelection is not true)
* @return
*/
public DetailTableEdit clearSelectValue(String fieldCaption, boolean waitForSelection)
public DetailTableEdit clearSelectValue(String fieldCaption, boolean waitForSelection, boolean assertSelection)
{
var select = elementCache().findSelect(fieldCaption);
if (waitForSelection)
{
WebDriverWrapper.waitFor(() -> select.hasSelection(),
String.format("The %s select did not have any selection in time", fieldCaption), _readyTimeout);
if (assertSelection) {
WebDriverWrapper.waitFor(() -> select.hasSelection(),
String.format("The %s select did not have any selection in time", fieldCaption), _readyTimeout);
}
else {
WebDriverWrapper.waitFor(() -> select.hasSelection(), _readyTimeout);
}
}
select.clearSelection();
return this;
Expand Down

0 comments on commit 3be61ec

Please sign in to comment.