Class NotificationTester<T extends Notification>
java.lang.Object
com.vaadin.browserless.ComponentTester<T>
com.vaadin.flow.component.notification.NotificationTester<T>
- Type Parameters:
T- component type
- All Implemented Interfaces:
Clickable<T>
Tester for Notification components.
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSimulates auto-close of the notification, because of show duration timeout.getText()Gets the text the user sees in the notification.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.Methods inherited from class com.vaadin.browserless.ComponentTester
blur, canSetValueAsUser, clearAsUser, clickClearButtonAsUser, ensureComponentIsUsable, ensureComponentIsUsable, ensureComponentIsUsableOrDetach, ensureVisible, ensureVisible, find, findAllByQuery, findByQuery, fireDomEvent, fireDomEvent, fireDomEvent, focus, getComponent, getField, getField, getMethod, getMethod, isComponentReadOnly, isFocused, isUsable, notUsableReasons, roundTrip, setModal, setPropertyAsUser, setValueAsUser, 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
-
NotificationTester
Wrap given component for testing.- Parameters:
component- target component
-
-
Method Details
-
getText
Gets the text the user sees in the notification. This is the text set withNotification.setText(String), or, when the notification shows components instead, the text content of those components. Text from nested elements is concatenated without space separators, so it can differ from the rendered layout. 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, or an empty string if it shows
neither text nor text content; never
null - 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, anIllegalStateExceptionis thrown.- Throws:
IllegalStateException- if the notification is not displayed or has auto-close disabled.
-
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<T extends Notification>- 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<T extends Notification>- See Also:
-