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

public abstract class Tester<T extends com.vaadin.ui.AbstractComponent> extends Object
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Tester(T component)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the component error message if there is one.
    protected void
    Utility method to fire a fabricated event.
    void
    Attempt to focus the component as a user.
    protected T
     
    boolean
    Test if the component is focused according to UI.
    boolean
    Checks if the component is interactable by user, i.e.
    boolean
    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.
    void
    shortcut(int key)
    Trigger keyshortcut listener hooked to the component.
    void
    shortcut(int key, int... modifierKeys)
    Trigger keyshortcut listener hooked to the component.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Tester

      protected Tester(T component)
  • 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

      public String errorMessage()
      Returns the component error message if there is one. Otherwise null.
      Returns:
      String value.
    • fireSimulatedEvent

      protected void fireSimulatedEvent(EventObject event)
      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.KeyCode
      modifierKeys - the modifier keys required for the shortcut, Use e.g. ShortcutAction.ModifierKey
    • getComponent

      protected T getComponent()