Class AvatarGroupElement

java.lang.Object
org.vaadin.addons.dramafinder.element.VaadinElement
org.vaadin.addons.dramafinder.element.AvatarGroupElement
All Implemented Interfaces:
Findable<ComponentQuery<AvatarGroupElement>>, HasLocatorElement, HasStyleElement, HasThemeElement

public class AvatarGroupElement extends VaadinElement implements HasStyleElement, HasThemeElement, Findable<ComponentQuery<AvatarGroupElement>>
PlaywrightElement for <vaadin-avatar-group>.

The group renders one <vaadin-avatar> per visible item as a direct light-DOM child, plus a single overflow avatar carrying slot="overflow" once maxItemsVisible (or the available width) hides some of them. Clicking the overflow avatar opens an overlay holding a <vaadin-avatar-group-menu> whose <vaadin-avatar-group-menu-item> children each wrap the avatar of one hidden item. Those avatars are in the DOM as soon as the group overflows, but are only visible while the overlay is open.

Individual avatars — visible or overflowing — are exposed as AvatarElement instances.

  • Field Details

  • Constructor Details

    • AvatarGroupElement

      public AvatarGroupElement(com.microsoft.playwright.Locator locator)
      Create a new AvatarGroupElement.
      Parameters:
      locator - the locator for the <vaadin-avatar-group> element
  • Method Details

    • get

      public static AvatarGroupElement get(com.microsoft.playwright.Page page)
      Get the first AvatarGroupElement on the page.
      Parameters:
      page - the Playwright page
      Returns:
      the first matching AvatarGroupElement
    • get

      public static AvatarGroupElement get(com.microsoft.playwright.Locator locator)
      Get the first AvatarGroupElement within a scope.
      Parameters:
      locator - the scope containing the group (not the group itself)
      Returns:
      the first matching AvatarGroupElement
    • getAvatarsLocator

      public com.microsoft.playwright.Locator getAvatarsLocator()
      Locator matching every visible avatar, in rendering order. The overflow avatar is not included.
      Returns:
      locator for the visible <vaadin-avatar> children
    • getAvatars

      public List<AvatarElement> getAvatars()
      Get the visible avatars, in rendering order.
      Returns:
      the visible avatars, empty when the group has no items
    • getAvatar

      public AvatarElement getAvatar(int index)
      Get the avatar at the given position among the visible avatars.
      Parameters:
      index - zero-based index
      Returns:
      the avatar at that position
    • getVisibleCount

      public int getVisibleCount()
      Get the number of visible avatars, excluding the overflow avatar.
      Returns:
      the visible avatar count
    • getNames

      public List<String> getNames()
      Get the names of the visible avatars, in rendering order.
      Returns:
      the names; an entry is null when that avatar has no name
    • getMaxItemsVisible

      public Integer getMaxItemsVisible()
      Get the maximum number of avatars the group displays before overflowing.
      Returns:
      the maxItemsVisible property, or null when unset
    • setMaxItemsVisible

      public void setMaxItemsVisible(int maxItemsVisible)
      Set the maximum number of avatars to display before overflowing.
      Parameters:
      maxItemsVisible - the maximum number of visible avatars
    • getOverflowAvatar

      public AvatarElement getOverflowAvatar()
      Get the overflow avatar, the one summarising the hidden items as +N. It is present even when nothing overflows, in which case it is hidden.
      Returns:
      the overflow avatar
    • hasOverflow

      public boolean hasOverflow()
      Whether some avatars are hidden behind the overflow avatar.
      Returns:
      true when the group has an overflow
    • openOverflow

      public void openOverflow()
      Open the overflow overlay by clicking the overflow avatar, and wait until it is open. Does nothing when the overlay is already open — clicking the overflow avatar toggles the overlay, so an unconditional click would close it again.
    • closeOverflow

      public void closeOverflow()
      Close the overflow overlay with the Escape key, and wait until it is closed.
    • isOverflowOpen

      public boolean isOverflowOpen()
      Whether the overflow overlay is currently open.
      Returns:
      true when the overlay is open
    • getOverflowMenuLocator

      public com.microsoft.playwright.Locator getOverflowMenuLocator()
      Locator for the overflow overlay menu, which holds one menu item per hidden avatar.
      Returns:
      locator for <vaadin-avatar-group-menu>
    • getOverflowAvatarsLocator

      public com.microsoft.playwright.Locator getOverflowAvatarsLocator()
      Locator matching every avatar inside the overflow overlay, in rendering order.
      Returns:
      locator for the overflowing <vaadin-avatar> elements
    • getOverflowAvatars

      public List<AvatarElement> getOverflowAvatars()
      Get the avatars hidden behind the overflow avatar, in rendering order. They are in the DOM as soon as the group overflows, but only become visible once openOverflow() has opened the overlay.
      Returns:
      the overflowing avatars, empty when nothing overflows
    • getOverflowNames

      public List<String> getOverflowNames()
      Get the names of the avatars hidden behind the overflow avatar, in rendering order.
      Returns:
      the names; an entry is null when that avatar has no name
    • assertNames

      public void assertNames(String... names)
      Assert the names of the visible avatars, in order.
      Parameters:
      names - the expected names
    • assertOverflowNames

      public void assertOverflowNames(String... names)
      Assert the names of the avatars hidden behind the overflow avatar, in order.
      Parameters:
      names - the expected names
    • assertVisibleCount

      public void assertVisibleCount(int count)
      Assert the number of visible avatars, excluding the overflow avatar.
      Parameters:
      count - the expected visible avatar count
    • assertHasOverflow

      public void assertHasOverflow()
      Assert that some avatars are hidden behind the overflow avatar.
    • assertHasNoOverflow

      public void assertHasNoOverflow()
      Assert that no avatar is hidden behind the overflow avatar.
    • assertOverflowOpen

      public void assertOverflowOpen()
      Assert that the overflow overlay is open.
    • assertOverflowClosed

      public void assertOverflowClosed()
      Assert that the overflow overlay is closed.
    • getById

      public static AvatarGroupElement getById(com.microsoft.playwright.Page page, String id)
      Get an AvatarGroupElement by its id, searching the entire page.

      A fallback for a component without a user-visible name: prefer the label or text lookups when there is one. The id must match in full; two components with that id fail with a strict-mode error.

      Parameters:
      page - the Playwright page
      id - the full id
      Returns:
      the matching AvatarGroupElement
    • getById

      public static AvatarGroupElement getById(com.microsoft.playwright.Locator locator, String id)
      Get an AvatarGroupElement by its id, scoped to the given locator.

      A fallback for a component without a user-visible name. The id must match in full; two components with that id inside the scope fail with a strict-mode error.

      Parameters:
      locator - the locator whose subtree is searched
      id - the full id
      Returns:
      the matching AvatarGroupElement
    • getByTestId

      public static AvatarGroupElement getByTestId(com.microsoft.playwright.Page page, String testId)
      Get an AvatarGroupElement by its test id, searching the entire page.

      The test id is Playwright's test id attribute, data-testid unless reconfigured — the attribute Flow's Component.setTestId(String) sets. A fallback for a component without a user-visible name; it must match in full, and two components with that test id fail with a strict-mode error.

      Parameters:
      page - the Playwright page
      testId - the full test id
      Returns:
      the matching AvatarGroupElement
    • getByTestId

      public static AvatarGroupElement getByTestId(com.microsoft.playwright.Locator locator, String testId)
      Get an AvatarGroupElement by its test id, scoped to the given locator.

      See getByTestId(Page, String); only components inside the scope are considered.

      Parameters:
      locator - the locator whose subtree is searched
      testId - the full test id
      Returns:
      the matching AvatarGroupElement