Skip to content

Commit

Permalink
ProductMenu: test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-nicka committed Apr 9, 2024
1 parent c6c4cdf commit a30b2a5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/org/labkey/test/components/ui/navigation/ProductMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class ProductMenu extends WebDriverComponent<ProductMenu.ElementCache>
{
Expand Down Expand Up @@ -79,8 +78,7 @@ public void collapse()
public List<String> getMenuSectionHeaders()
{
expand();
return elementCache().menuSectionHeaderElements().stream().map(el -> el.getText().trim())
.collect(Collectors.toList());
return elementCache().menuSectionHeaderElements().stream().map(el -> el.getText().trim()).toList();
}

public Map<String, String> getMenuSectionHeaderLinks()
Expand Down Expand Up @@ -114,7 +112,7 @@ public List<String> getMenuSectionLinks(String headerText)
return Locator.tag("li").childTag("a").findElements(elementCache().menuSectionBody(headerText))
.stream()
.map(element -> element.getAttribute("href"))
.collect(Collectors.toList());
.toList();
}

public void clickMenuItem(String headerText, String menuText)
Expand All @@ -136,7 +134,8 @@ public List<String> getFolderList()
// Use .collect(Collectors.toList()) to allow the returned list to be manipulated if needed.
return elementCache().folderMenuItems()
.stream()
.map(WebElement::getText).collect(Collectors.toList());
.map(WebElement::getText)
.toList();
}

public ProductMenu clickFolderItem(String folderName)
Expand Down Expand Up @@ -223,7 +222,12 @@ WebElement menuSectionHeader(String headerText)

WebElement menuSectionBody(String headerText)
{
return menuSectionHeaderLoc(headerText).parent("ul").findElement(sectionContent);
return menuSectionHeaderLoc(headerText)
.parent("ul")
.parent("div") // .product-menu-section-header
.followingSibling("div") // .product-menu-section-body
.childTag("ul")
.findElement(sectionContent);
}

WebElement menuSectionLink(String headerText, String linkText)
Expand Down

0 comments on commit a30b2a5

Please sign in to comment.