Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.labkey.test.components.Component;
import org.labkey.test.components.WebDriverComponent;
import org.labkey.test.components.ui.pipeline.ImportsPage;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
Expand Down Expand Up @@ -157,10 +158,19 @@ public void clickMarkAll()

public ImportsPage clickViewAll()
{
expand();
WebDriverWrapper.waitFor(elementCache().viewAllLink()::isDisplayed,
"View all link did not become visible.", 2_500);
elementCache().viewAllLink().click();
// Retry for clicking 'View all activity' link because of stale element.
WebDriverWrapper.waitFor(() -> {
try
{
expand();
elementCache().viewAllLink().click();
return true;
}
catch (StaleElementReferenceException | NoSuchElementException retry)
{
return false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this do a collapse() before retrying?

I also wonder if part of the issue might be:
public final WebElement menuContent = Locator.byClass("navbar-menu__content").refindWhenNeeded(this);
in the element cache. Maybe this should be a locator, or put in a method so it is found everytime it is referenced.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Switched toggle to refindWhenNeeded so it recovers on re-render, and kept the retry for the transient not-yet-rendered case.

}
}, "View all link did not become clickable.", 5_000);
return new ImportsPage(getWrapper());
}

Expand Down Expand Up @@ -259,7 +269,7 @@ protected class ElementCache extends Component<?>.ElementCache
{
public final WebElement menuContent = Locator.byClass("navbar-menu__content").refindWhenNeeded(this);

public final WebElement toggle = Locator.byClass("navbar-menu-button").findWhenNeeded(this);
public final WebElement toggle = Locator.byClass("navbar-menu-button").refindWhenNeeded(this);

public final WebElement statusIcon()
{
Expand Down