Class PopoverTester
Tester for Popover components.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSimulates clicking outside the popover to close it.voidSimulates clicking the target component to open the popover.voidclose()Close the popover.voidSimulates focusing the target component to open the popover.static PopoverTesterforTarget(ComponentQuery<? extends Component> query) Creates aPopoverTesterfor the popover that targets the component matching the given query.static PopoverTesterCreates aPopoverTesterfor the popover that targets the given component.voidSimulates hovering the target component to open the popover.booleanisOpen()Check if the popover is open.booleanisUsable()Validate that component can be interacted with and should be visible in the UI.protected voidnotUsableReasons(Consumer<String> collector) Provides messages explaining why the component is actually not usable.voidopen()Open the popover.voidSimulates pressing Escape to close the popover.Methods inherited from class com.vaadin.browserless.ComponentTester
ensureComponentIsUsable, ensureComponentIsUsable, ensureVisible, ensureVisible, find, findAllByQuery, findByQuery, fireDomEvent, fireDomEvent, fireDomEvent, getComponent, getField, getField, getMethod, getMethod, isUsable, notUsableReasons, roundTrip, setModal, setValueAsUserMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.browserless.Clickable
click, click, click, middleClick, middleClick, rightClick, rightClick
-
Constructor Details
-
PopoverTester
Wrap given component for testing.- Parameters:
component- target component
-
-
Method Details
-
forTarget
Creates aPopoverTesterfor 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
Creates aPopoverTesterfor 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:ComponentTesterValidate that component can be interacted with and should be visible in the UI. Subclasses overriding this method should also overrideComponentTester.notUsableReasons(Consumer)to provide additional details to the potential exception thrown byComponentTester.ensureComponentIsUsable().- Overrides:
isUsablein classComponentTester<Popover>- Returns:
trueif component can be interacted with by the user- See Also:
-
notUsableReasons
Description copied from class:ComponentTesterProvides messages explaining why the component is actually not usable. Subclasses overridingComponentTester.isUsable()should also override this method to provide additional details to the potential exception throw byComponentTester.ensureComponentIsUsable().- Overrides:
notUsableReasonsin classComponentTester<Popover>- See Also:
-