Class UiTestUtils

java.lang.Object
io.jmix.tabbedmode.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 active view. Usage example:
       @Test
       public void openUserListView() {
           viewBuilders.view(UiTestUtils.getCurrentView(), UserListView.class)
               .open();
      
           UserListView userListView = UiTestUtils.getCurrentView();
       }
       
      Type Parameters:
      T - type of navigated view
      Returns:
      instance of the currently active 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 an empty object will be returned
    • getOpenedNotifications

      public static List<NotificationInfo> getOpenedNotifications()
      Returns an immutable list of NotificationInfo objects in the order they were opened.

      Example of the order in which notifications are stored:

      • first opened notification has index 0
      • second 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()
      Returns an immutable list of DialogInfo objects in the order they were opened.

      Example of the order in which dialogs are stored:

      • first opened dialog has index 0
      • second 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