diff --git a/src/org/labkey/test/components/ui/entities/ParentEntityEditPanel.java b/src/org/labkey/test/components/ui/entities/ParentEntityEditPanel.java index a789bb8ba1..24a81b7030 100644 --- a/src/org/labkey/test/components/ui/entities/ParentEntityEditPanel.java +++ b/src/org/labkey/test/components/ui/entities/ParentEntityEditPanel.java @@ -6,6 +6,7 @@ import org.labkey.test.WebDriverWrapper; import org.labkey.test.components.Component; import org.labkey.test.components.WebDriverComponent; +import org.labkey.test.components.react.BaseReactSelect; import org.labkey.test.components.react.FilteringReactSelect; import org.labkey.test.components.react.ReactSelect; import org.openqa.selenium.NoSuchElementException; @@ -303,6 +304,11 @@ public List getAllEntityTypes() .findAll(elementCache()); } + private BaseReactSelect.BaseReactSelectFinder getParentFinder(String typeName) + { + return FilteringReactSelect.finder(getDriver()).withNamedInput(String.format("parentEntityValue_%s", typeName)); + } + /** * Get a select for a given parent entity type. * @@ -311,8 +317,7 @@ public List getAllEntityTypes() */ public FilteringReactSelect getParent(String typeName) { - return FilteringReactSelect.finder(getDriver()).withNamedInput(String.format("parentEntityValue_%s", typeName)) - .find(elementCache()); + return getParentFinder(typeName).find(elementCache()); } /** @@ -353,7 +358,7 @@ public ParentEntityEditPanel addParents(String typeName, List parentIds) if (getEntityType(typeName) == null) getAddNewEntityTypeSelect().select(typeName); - var selectParent = getParent(typeName); + var selectParent = getParentFinder(typeName).waitFor(elementCache()); // Adding for debugging (trying to understand why save button is not enabled after setting). getWrapper().log(String.format("Selections before adding: %s", selectParent.getSelections())); @@ -496,7 +501,7 @@ protected ElementCache newElementCache() protected class ElementCache extends Component.ElementCache { final WebElement saveButton = Locator.byClass("btn-success").withText("Save").findWhenNeeded(this); - final WebElement cancelButton = Locator.byClass("btn-default").withText("Cancel").findWhenNeeded(this); + final WebElement cancelButton = Locator.byClass("btn-default").withText("Cancel").refindWhenNeeded(this); // This is the 'Add' button that is contained inside the panel. final WebElement addButton = Locator