Package io.jmix.tabbedmode.testassist
Class UiTestUtils
java.lang.Object
io.jmix.tabbedmode.testassist.UiTestUtils
Class provides helper methods for testing.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TgetComponent(View<?> view, String componentId) Returns a component defined in the view by the component id.static <T extends View<?>>
TReturns instance of currently active view.static @Nullable DialogInfoReturns the most recently opened component dialog (VaadinDialog).static @Nullable NotificationInfostatic <T extends View<?>>
@Nullable TReturns the most recently openedViewshown as a dialog, i.e.static List<DialogInfo> Returns an immutable list ofDialogInfoobjects in the order they were opened.static List<NotificationInfo> Returns an immutable list ofNotificationInfoobjects in the order they were opened.Returns an immutable list ofViews shown as dialogs (i.e.static ValidationErrorsvalidateView(StandardDetailView<?> view) Validates providedViewby callingStandardDetailView#validateView()method from it.
-
Method Details
-
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
Returns a component defined in the view by the component id.- Throws:
IllegalArgumentException- if not found
-
validateView
Validates providedViewby callingStandardDetailView#validateView()method from it.- Parameters:
view- detail view to validate- Returns:
- errors if validation failed, otherwise an empty object will be returned
-
getOpenedNotifications
Returns an immutable list ofNotificationInfoobjects 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
NotificationInfoin order of opening
- first opened notification has index
-
getLastOpenedNotification
- Returns:
- the most recent opened
NotificationInfoornullif no opened notifications
-
getOpenedDialogs
Returns an immutable list ofDialogInfoobjects in the order they were opened.This method covers component dialogs (Vaadin
Dialogs: message, option, background-task and side dialogs). Views shown as dialogs (e.g.InputDialogor any view opened inOpenMode.DIALOG) are not included here — usegetOpenedViewDialogs().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
- first opened dialog has index
-
getLastOpenedDialog
Returns the most recently opened component dialog (VaadinDialog). For views shown as dialogs (e.g.InputDialog) usegetLastOpenedViewDialog().- Returns:
- the most recent opened
DialogInfoornullif no opened dialogs
-
getOpenedViewDialogs
Returns an immutable list ofViews shown as dialogs (i.e. opened inOpenMode.DIALOG), in the order they were opened. This includes any lookup or detail view opened as a dialog, as well as the frameworkInputDialog.Example of the order in which view dialogs are stored:
- first opened view dialog has index
0 - second opened view dialog has index
1 - last opened view dialog has index
openedViewDialogs.size() - 1
For component dialogs (message, option, background-task and side dialogs) use
getOpenedDialogs()instead.- Returns:
- immutable list of
Views shown as dialogs, in order of opening
- first opened view dialog has index
-
getLastOpenedViewDialog
Returns the most recently openedViewshown as a dialog, i.e. the topmost view opened inOpenMode.DIALOG(a lookup or detail view, a custom view, etc.). Usage example:// open a view as a dialog (e.g. via DialogWindows or OpenMode.DIALOG), then: CustomerDetailView view = UiTestUtils.getLastOpenedViewDialog();
Note: the framework
InputDialogis also a view dialog and can be obtained the same way.- Type Parameters:
T- expected type of the view- Returns:
- the most recently opened view dialog, or
nullif there are no opened view dialogs
-