Skip to content

Commit d8904a6

Browse files
authored
Fix for notification menu 'View all activity' (#3080)
#### Rationale Dropdown menu click isn't working sometimes because of re-rendering. #### Related Pull Requests - <!-- list of links to related pull requests (replace this comment) --> #### Changes - added retry <!-- list of standard tasks (remove this comment to enable) #### Tasks 📍 - [ ] Claude Code Review - [ ] TeamCity verification -->
1 parent db7879c commit d8904a6

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

‎src/org/labkey/test/components/ui/notifications/ServerNotificationMenu.java‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.labkey.test.components.Component;
66
import org.labkey.test.components.WebDriverComponent;
77
import org.labkey.test.components.ui.pipeline.ImportsPage;
8+
import org.openqa.selenium.NoSuchElementException;
89
import org.openqa.selenium.StaleElementReferenceException;
910
import org.openqa.selenium.WebDriver;
1011
import org.openqa.selenium.WebElement;
@@ -157,10 +158,19 @@ public void clickMarkAll()
157158

158159
public ImportsPage clickViewAll()
159160
{
160-
expand();
161-
WebDriverWrapper.waitFor(elementCache().viewAllLink()::isDisplayed,
162-
"View all link did not become visible.", 2_500);
163-
elementCache().viewAllLink().click();
161+
// Retry for clicking 'View all activity' link because of stale element.
162+
WebDriverWrapper.waitFor(() -> {
163+
try
164+
{
165+
expand();
166+
elementCache().viewAllLink().click();
167+
return true;
168+
}
169+
catch (StaleElementReferenceException | NoSuchElementException retry)
170+
{
171+
return false;
172+
}
173+
}, "View all link did not become clickable.", 5_000);
164174
return new ImportsPage(getWrapper());
165175
}
166176

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

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

264274
public final WebElement statusIcon()
265275
{

0 commit comments

Comments
 (0)