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
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public boolean isMarkAllVisible()
protected boolean isExpanded()
{
boolean ariaExpanded = "true".equals(elementCache().toggle.getAttribute("aria-expanded"));
boolean menuContentDisplayed = elementCache().menuContent.isDisplayed();
boolean menuContentDisplayed = elementCache().menuContent().isDisplayed();

return ariaExpanded && menuContentDisplayed;
}
Expand Down Expand Up @@ -201,16 +201,14 @@ private WebElement waitForNotificationList()

// Wait for the listing container to show up. The listing container is in the open menu, scope the search to that.
Locator notificationsContainerLocator = Locator.tagWithClass("div", "server-notifications-listing-container");
WebDriverWrapper.waitFor(()-> notificationsContainerLocator.refindWhenNeeded(elementCache().menuContent).isDisplayed(),
WebDriverWrapper.waitFor(()-> notificationsContainerLocator.areAnyVisible(elementCache().menuContent()),
"List container did not render.", 500);

// Find again (lambda requires a final reference to the component).
WebElement listContainer = notificationsContainerLocator.refindWhenNeeded(elementCache().menuContent);
WebElement listContainer = notificationsContainerLocator.refindWhenNeeded(elementCache().menuContent());

// It may be a moment before any notifications show up.
WebDriverWrapper.waitFor(()-> Locator.tagWithClass("ul", "server-notifications-listing")
.refindWhenNeeded(listContainer)
.isDisplayed(),
WebDriverWrapper.waitFor(()-> Locator.tagWithClass("ul", "server-notifications-listing").areAnyVisible(listContainer),
"There are no notifications in the drop down.", 1_000);

// Just wait for a moment in case the list is slow to update with the most recent notification.
Expand All @@ -223,7 +221,7 @@ private WebElement waitForNotificationList()

// Find the container again, don't return listContainer WebElement previously found. If the list was slow to
// update with the most recent notification the old reference will be stale.
return notificationsContainerLocator.refindWhenNeeded((elementCache().menuContent));
return notificationsContainerLocator.refindWhenNeeded((elementCache().menuContent()));
}

/**
Expand Down Expand Up @@ -282,7 +280,10 @@ protected ServerNotificationMenu.ElementCache newElementCache()

protected class ElementCache extends Component<?>.ElementCache
{
public final WebElement menuContent = Locator.byClass("navbar-menu__content").refindWhenNeeded(this);
public final WebElement menuContent()
{
return Locator.byClass("navbar-menu__content").refindWhenNeeded(this);
}

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

Expand All @@ -293,14 +294,14 @@ public final WebElement statusIcon()

public final WebElement noNotificationsElement()
{
return Locator.tagWithClass("div", "server-notifications-footer").refindWhenNeeded(elementCache().menuContent);
return Locator.tagWithClass("div", "server-notifications-footer").refindWhenNeeded(elementCache().menuContent());
}

public final WebElement markAll()
{
return Locator.tagWithClass("h3", "navbar-menu-header")
.child(Locator.byClass("clickable-text"))
.refindWhenNeeded(elementCache().menuContent);
.refindWhenNeeded(elementCache().menuContent());
}

public final WebElement viewAllLink()
Expand Down