Skip to content

Commit

Permalink
Collapse grid buttons as space is available (#1597)
Browse files Browse the repository at this point in the history
Fix usages of grid menu buttons to expect the button first, and check more menu second
  • Loading branch information
labkey-alan authored Aug 8, 2023
1 parent f910950 commit 80e38b8
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions src/org/labkey/test/components/ui/grids/TabbedGridPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -115,39 +114,22 @@ protected ElementCache newElementCache()
return new ElementCache();
}

public Optional<MultiMenu> 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<MultiMenu> 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);
Expand Down

0 comments on commit 80e38b8

Please sign in to comment.