Class PopoverTester

java.lang.Object
com.vaadin.browserless.ComponentTester<com.vaadin.flow.component.popover.Popover>
com.vaadin.flow.component.popover.PopoverTester
All Implemented Interfaces:
Clickable<com.vaadin.flow.component.popover.Popover>

public class PopoverTester extends ComponentTester<com.vaadin.flow.component.popover.Popover>
Tester for Popover components.
Since:
1.0
  • Constructor Details

    • PopoverTester

      public PopoverTester(com.vaadin.flow.component.popover.Popover component)
      Wrap given component for testing.
      Parameters:
      component - target component
  • Method Details

    • forTarget

      public static PopoverTester forTarget(ComponentQuery<? extends com.vaadin.flow.component.Component> query)
      Creates a PopoverTester for the popover that targets the component matching the given query.
      Parameters:
      query - a query that resolves to the target component
      Returns:
      a tester for the popover targeting the matched component
      Throws:
      NoSuchElementException - if no popover targets the matched component
    • forTarget

      public static PopoverTester forTarget(com.vaadin.flow.component.Component target)
      Creates a PopoverTester for the popover that targets the given component.
      Parameters:
      target - the target component of the popover
      Returns:
      a tester for the popover targeting the given component
      Throws:
      NoSuchElementException - if no popover targets the given component
    • open

      public void open()
      Open the popover.
    • close

      public void close()
      Close the popover.
    • clickTarget

      public void clickTarget()
      Simulates clicking the target component to open the popover.
      Throws:
      IllegalStateException - if no target is set or open-on-click is disabled
    • hoverTarget

      public void hoverTarget()
      Simulates hovering the target component to open the popover.
      Throws:
      IllegalStateException - if no target is set or open-on-hover is disabled
    • focusTarget

      public void focusTarget()
      Simulates focusing the target component to open the popover.
      Throws:
      IllegalStateException - if no target is set or open-on-focus is disabled
    • pressEscape

      public void pressEscape()
      Simulates pressing Escape to close the popover.
      Throws:
      IllegalStateException - if the popover is not open or close-on-Esc is disabled
    • clickOutside

      public void clickOutside()
      Simulates clicking outside the popover to close it.
      Throws:
      IllegalStateException - if the popover is not open or close-on-outside-click is disabled
    • isOpen

      public boolean isOpen()
      Check if the popover is open.
      Returns:
      true if the popover is open
    • isUsable

      public boolean isUsable()
      Description copied from class: ComponentTester
      Validate that component can be interacted with and should be visible in the UI. Subclasses overriding this method should also override ComponentTester.notUsableReasons(Consumer) to provide additional details to the potential exception thrown by ComponentTester.ensureComponentIsUsable().
      Overrides:
      isUsable in class ComponentTester<com.vaadin.flow.component.popover.Popover>
      Returns:
      true if component can be interacted with by the user
      See Also:
    • notUsableReasons

      protected void notUsableReasons(Consumer<String> collector)
      Description copied from class: ComponentTester
      Provides messages explaining why the component is actually not usable. Subclasses overriding ComponentTester.isUsable() should also override this method to provide additional details to the potential exception throw by ComponentTester.ensureComponentIsUsable().
      Overrides:
      notUsableReasons in class ComponentTester<com.vaadin.flow.component.popover.Popover>
      Parameters:
      collector - receives the components the tester walks over
      See Also: