Skip to content
Open
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
21 changes: 19 additions & 2 deletions src/org/labkey/test/components/ui/navigation/ProductMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.labkey.test.components.Component;
import org.labkey.test.components.WebDriverComponent;
import org.labkey.test.util.TestLogger;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
Expand Down Expand Up @@ -174,23 +175,39 @@ public ProductMenu clickFolderItem(String folderName)
public void goToFolderDashboard(String folderName)
{
clickFolderItem(folderName);
getWrapper().mouseOver(elementCache().activeDashboardIcon);
clickNavLink(elementCache().activeDashboardIcon);
}

// Interactions with icon elements on the page to catch GitHub Issue 1146.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment describes that mouseOver, not the whole method. Move it closer to the line where the interaction is happening.

public int getDashboardIconCount()
{
return elementCache().dashboardIconLoc.findElements(elementCache().menuContent).size();
List<WebElement> dashboardIcons = elementCache().dashboardIconLoc.findElements(elementCache().menuContent);
for (WebElement dashboardIcon : dashboardIcons)
{
getWrapper().mouseOver(dashboardIcon.findElement(By.xpath("./ancestor::li[1]")));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not super important for a use like this but we usually prefer to use Locator.xpath().findElement(context) instead of context.findElement(By.xpath). Locator.findElement wraps the resulting WebElement with a decorator that handles click interception (ReclickingWebElement).

Suggested change
getWrapper().mouseOver(dashboardIcon.findElement(By.xpath("./ancestor::li[1]")));
getWrapper().mouseOver(Locator.xpath("./ancestor::li[1]").findElement(dashboardIcon));

getWrapper().mouseOver(dashboardIcon);
}
return dashboardIcons.size();
}

public void goToFolderAdministration(String folderName)
{
clickFolderItem(folderName);
getWrapper().mouseOver(elementCache().activeAdministrationIcon);
clickNavLink(elementCache().activeAdministrationIcon);
}

// Interactions with icon elements on the page to catch GitHub Issue 1146.
public int getAdministrationIconCount()
{
return elementCache().administrationIconLoc.findElements(elementCache().menuContent).size();
List<WebElement> adminIcons = elementCache().administrationIconLoc.findElements(elementCache().menuContent);
for (WebElement adminIcon : adminIcons)
{
getWrapper().mouseOver(adminIcon.findElement(By.xpath("./ancestor::li[1]")));
getWrapper().mouseOver(adminIcon);
}
return adminIcons.size();
}

public String getButtonTitle()
Expand Down