From 3be61ec3722ced548c5c7a9d6be53b6487eae1e5 Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Thu, 11 Jan 2024 10:24:27 -0800 Subject: [PATCH] provide optional assert if selection does not appear --- .../test/components/ui/grids/DetailTableEdit.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/org/labkey/test/components/ui/grids/DetailTableEdit.java b/src/org/labkey/test/components/ui/grids/DetailTableEdit.java index 5dd47bf202..2b1a209ef1 100644 --- a/src/org/labkey/test/components/ui/grids/DetailTableEdit.java +++ b/src/org/labkey/test/components/ui/grids/DetailTableEdit.java @@ -324,23 +324,28 @@ public DetailTableEdit setSelectValue(String fieldCaption, List 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;