From f97130af2a226d536e97c3f37aeb8d5d9e1fb292 Mon Sep 17 00:00:00 2001 From: Alan Vezina Date: Thu, 3 Aug 2023 15:41:34 -0500 Subject: [PATCH] Fix usages of grid menu buttons --- .../components/ui/grids/TabbedGridPanel.java | 32 ++++--------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/src/org/labkey/test/components/ui/grids/TabbedGridPanel.java b/src/org/labkey/test/components/ui/grids/TabbedGridPanel.java index d105568128..ad8c355e09 100644 --- a/src/org/labkey/test/components/ui/grids/TabbedGridPanel.java +++ b/src/org/labkey/test/components/ui/grids/TabbedGridPanel.java @@ -12,7 +12,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.stream.Collectors; import static org.labkey.test.WebDriverWrapper.WAIT_FOR_JAVASCRIPT; @@ -115,39 +114,22 @@ protected ElementCache newElementCache() return new ElementCache(); } - public Optional optionalMoreMenu() - { - return elementCache().gridMoreMenu(); - } - public MultiMenu clickAssayMenu() { - MultiMenu menu; - if (optionalMoreMenu().isPresent()) - { - menu = optionalMoreMenu().get(); - optionalMoreMenu().get().openMenuTo("Import Assay Data"); - } - else - menu = elementCache().gridAssayMenu; + if (elementCache().gridAssayMenuFinder.findOptional().isPresent()) + return elementCache().gridAssayMenu; + MultiMenu menu = elementCache().gridMoreMenu; + menu.openMenuTo("Import Assay Data"); return menu; } - public void clickAssay(String assayName) - { - MultiMenu menu = clickAssayMenu(); - menu.clickSubMenu(getWrapper().defaultWaitForPage, assayName); - } protected class ElementCache extends Component.ElementCache { - MultiMenu.MultiMenuFinder gridMoreMenuFinder = new MultiMenu.MultiMenuFinder(getDriver()).withText("More"); - Optional gridMoreMenu() - { - return gridMoreMenuFinder.findOptional(this); - } + MultiMenu gridMoreMenu = new MultiMenu.MultiMenuFinder(getDriver()).withText("More").findWhenNeeded(); - MultiMenu gridAssayMenu = new MultiMenu.MultiMenuFinder(getDriver()).withText("Assay").findWhenNeeded(this); + MultiMenu.MultiMenuFinder gridAssayMenuFinder = new MultiMenu.MultiMenuFinder(getDriver()).withText("Assay"); + MultiMenu gridAssayMenu = gridAssayMenuFinder.findWhenNeeded(this); final WebElement body = Locator.tagWithClass("div", "tabbed-grid-panel__body") .findWhenNeeded(this).withTimeout(WAIT_FOR_JAVASCRIPT);