Class UiTestUtils

java.lang.Object
io.jmix.flowui.testassist.UiTestUtils

public final class UiTestUtils extends Object
Class provides helper methods for testing.
  • Method Details

    • getCurrentView

      public static <T extends View<?>> T getCurrentView()
      Returns instance of currently navigated view. Usage example:
       @Test
       public void navigateToUserListView() {
           viewNavigators.view(UserListView.class)
                   .navigate();
      
           UserListView view = UiTestUtils.getCurrentView();
       }
       
      Type Parameters:
      T - type of navigated view
      Returns:
      instance of currently navigated view
    • getComponent

      public static <T> T getComponent(View<?> view, String componentId)
      Returns a component defined in the view by the component id.
      Throws:
      IllegalArgumentException - if not found
    • validateView

      public static ValidationErrors validateView(StandardDetailView<?> view)
      Validates provided View by calling StandardDetailView#validateView() method from it.
      Parameters:
      view - detail view to validate
      Returns:
      errors if validation failed, otherwise empty object will be returned
    • getOpenedNotifications

      public static List<NotificationInfo> getOpenedNotifications()
      Gets immutable list of NotificationInfo in order of opening.

      Example of the storage order of notifications:

      • first opened notification has index 0
      • seconds opened notification has index 1
      • last opened notification has index openedNotifications.size() - 1
      Returns:
      immutable list of NotificationInfo in order of opening
    • getLastOpenedNotification

      @Nullable public static NotificationInfo getLastOpenedNotification()
      Returns:
      the most recent opened NotificationInfo or null if no opened notifications
    • getOpenedDialogs

      public static List<DialogInfo> getOpenedDialogs()
      Gets immutable list of DialogInfos in order of opening.

      Example of the storage order of dialogs:

      • first opened dialog has index 0
      • seconds opened dialog has index 1
      • last opened dialog has index openedDialogs.size() - 1
      Returns:
      immutable list of DialogInfos in order of opening
    • getLastOpenedDialog

      @Nullable public static DialogInfo getLastOpenedDialog()
      Returns:
      the most recent opened DialogInfo or null if no opened dialogs