Class NotificationTester<T extends Notification>
java.lang.Object
com.vaadin.testbench.unit.ComponentTester<T>
com.vaadin.flow.component.notification.NotificationTester<T>
- Type Parameters:
T
- component type
Tester for Notification components.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Simulates auto-close of the notification, because of show duration timeout.getText()
Gets the text of the notification.boolean
isUsable()
Validate that component can be interacted with and should be visible in the UI.protected void
notUsableReasons
(Consumer<String> collector) Provides messages explaining why the component is actually not usable.Methods inherited from class com.vaadin.testbench.unit.ComponentTester
ensureComponentIsUsable, ensureVisible, find, findAllByQuery, findByQuery, fireDomEvent, fireDomEvent, fireDomEvent, getComponent, getField, getField, getMethod, getMethod, roundTrip, setModal
-
Constructor Details
-
NotificationTester
Wrap given component for testing.- Parameters:
component
- target component
-
-
Method Details
-
getText
Gets the text of the notification. If the notification is not displayed an IllegalStateException will be thrown as the end user would not be able to see the contents.- Returns:
- the text of the notification
- Throws:
IllegalStateException
- is notification is not displayed
-
autoClose
public void autoClose()Simulates auto-close of the notification, because of show duration timeout. If notification is not displayed or auto-close is disabled setting duration to 0 or negative, anIllegalStateException
is thrown.- Throws:
IllegalStateException
- if the notification is not displayed or has auto-close disabled.
-
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 overrideComponentTester.notUsableReasons(Consumer)
to provide additional details to the potential exception thrown byComponentTester.ensureComponentIsUsable()
.- Overrides:
isUsable
in classComponentTester<T extends Notification>
- Returns:
true
if component can be interacted with by the user- See Also:
-
notUsableReasons
Description copied from class:ComponentTester
Provides 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:
notUsableReasons
in classComponentTester<T extends Notification>
- See Also:
-