Class Tester<T extends com.vaadin.ui.AbstractComponent>
java.lang.Object
com.vaadin.testbench.uiunittest.testers.Tester<T>
- Direct Known Subclasses:
AbstractFieldTester,AbstractMultiSelectTester,AbstractSingleSelectTester,ButtonTester,ComponentTester,GridTester,MenuBarTester,TabSheetTester
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the component error message if there is one.protected voidfireSimulatedEvent(EventObject event) Utility method to fire a fabricated event.voidfocus()Attempt to focus the component as a user.protected TbooleanTest if the component is focused according to UI.booleanChecks if the component is interactable by user, i.e.booleanChecks if the component has an error, typically this can mean with a field component that Binder has validation error and has set component invalid.voidshortcut(int key) Trigger keyshortcut listener hooked to the component.voidshortcut(int key, int... modifierKeys) Trigger keyshortcut listener hooked to the component.
-
Constructor Details
-
Tester
-
-
Method Details
-
isInteractable
public boolean isInteractable()Checks if the component is interactable by user, i.e. it is enabled and it is visible.- Returns:
- boolean value
-
isInvalid
public boolean isInvalid()Checks if the component has an error, typically this can mean with a field component that Binder has validation error and has set component invalid.- Returns:
- boolean value.
-
errorMessage
Returns the component error message if there is one. Otherwise null.- Returns:
- String value.
-
fireSimulatedEvent
Utility method to fire a fabricated event.- Parameters:
event- The event to be fired
-
focus
public void focus()Attempt to focus the component as a user. If the component is not Focusable this does nothing. If component is the current focused item in the UI, does nothing. If the UI had a previous component focused, it will be blurred.Note: There is a limitation. Programmatic call to focus() in application logic will not fire focus and blur events, as it requires client roundtrip.
-
isFocused
public boolean isFocused()Test if the component is focused according to UI. If the component is not Focusable returns false.- Returns:
- boolean value.
-
shortcut
public void shortcut(int key) Trigger keyshortcut listener hooked to the component.- Parameters:
key- the key code of the shortcut, Use e.g.ShortcutAction.KeyCode
-
shortcut
public void shortcut(int key, int... modifierKeys) Trigger keyshortcut listener hooked to the component.- Parameters:
key- the key code of the shortcut, Use e.g.ShortcutAction.KeyCodemodifierKeys- the modifier keys required for the shortcut, Use e.g.ShortcutAction.ModifierKey
-
getComponent
-