From 2fcf4369aa355ea99ae98de09b03105e91faf5bf Mon Sep 17 00:00:00 2001 From: labkey-nicka Date: Mon, 8 Apr 2024 16:40:52 -0700 Subject: [PATCH] ProductMenu: test updates --- .../components/ui/navigation/ProductMenu.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/org/labkey/test/components/ui/navigation/ProductMenu.java b/src/org/labkey/test/components/ui/navigation/ProductMenu.java index f85e1c3a62..ac2f915727 100644 --- a/src/org/labkey/test/components/ui/navigation/ProductMenu.java +++ b/src/org/labkey/test/components/ui/navigation/ProductMenu.java @@ -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 { @@ -79,8 +78,7 @@ public void collapse() public List 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 getMenuSectionHeaderLinks() @@ -114,7 +112,7 @@ public List 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) @@ -136,7 +134,8 @@ public List 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) @@ -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)