Skip to content

Commit

Permalink
AppsMenu: Fix LKS usages
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-alan committed Feb 13, 2024
1 parent 1efb64b commit b392bfc
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/org/labkey/test/components/ui/navigation/apps/AppsMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,9 @@ public void navigateTo(ProductsNavContainer.Product product, String node)
.clickItem(node);
}

public void navigateToLabKey(String project)
{
showProductsPanel()
.clickLabkey()
.clickProject(project);
}
public static Locator rootLocator = Locator.XPathLocator.union(
Locator.byClass("product-navigation-menu"), // Bio/FM/SM
Locator.id("headerProductDropdown")); // LKS

@Override
protected AppsMenu.ElementCache newElementCache()
Expand All @@ -104,19 +101,26 @@ protected AppsMenu.ElementCache newElementCache()

protected class ElementCache extends Component<?>.ElementCache
{
public final WebElement rootElement = Locator.byClass("product-navigation-menu").findWhenNeeded(getDriver());
public final WebElement toggle = Locator.byClass("navbar-menu-button").findWhenNeeded(rootElement);
public final WebElement rootElement = rootLocator.findWhenNeeded(getDriver());

private final Locator _toggleLocator = Locator.XPathLocator.union(
Locator.byClass("navbar-menu-button"), // Bio/FM/SM
Locator.byClass("dropdown-toggle") // LKS
);
public final WebElement toggle = _toggleLocator.findWhenNeeded(rootElement);

public Optional<WebElement> getList()
{
return Locator.byClass("product-navigation-listing").findOptionalElement(rootElement);
}
}


public static class AppsMenuFinder extends WebDriverComponent.WebDriverComponentFinder<AppsMenu, AppsMenuFinder>
{
private Locator _locator = Locator.byClass("product-navigation-menu");
private final Locator _locator = Locator.XPathLocator.union(
Locator.byClass("product-navigation-menu"), // Bio/FM/SM
Locator.id("headerProductDropdown") // LKS
);

public AppsMenuFinder(WebDriver driver)
{
Expand All @@ -126,7 +130,7 @@ public AppsMenuFinder(WebDriver driver)
@Override
protected Locator locator()
{
return _locator;
return AppsMenu.rootLocator;
}

@Override
Expand Down

0 comments on commit b392bfc

Please sign in to comment.