Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product Menu: Flex layout #1888

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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