Annotation Interface UiTest


@Target(TYPE) @Retention(RUNTIME) @ExtendWith({org.springframework.test.context.junit.jupiter.SpringExtension.class,JmixUiTestExtension.class}) @Documented @Inherited public @interface UiTest
The annotation is used for testing Flow UI views on JUnit.

Base example:

 @UiTest
 @SpringBootTest(classes = {DemoApplication.class, FlowuiTestAssistConfiguration.class})
 public class UserViewsTest {
     @Autowired
     private ViewNavigators viewNavigators;

     @Test
     public void navigateToUserListView() {
         viewNavigators.view(UserListView.class)
                 .navigate();

         UserListView view = UiTestUtils.getCurrentView();

         CollectionContainer<User> usersDc = ViewControllerUtils.getViewData(view)
                 .getContainer("usersDc");

         Assertions.assertTrue(usersDc.getItems().size() > 0);
     }
 }
 
See Also:
  • Element Details

    • viewBasePackages

      String[] viewBasePackages
      Views under these packages will be available in test.

      Note that depending on the test's configuration all application views may be available.

      Returns:
      array of view packages should be registered
      Default:
      {}
    • authenticator

      Class<? extends UiTestAuthenticator> authenticator
      Class providing authentication management in tests.

      By default, SystemAuthenticator is used for authentication.

      Returns:
      class that implements UiTestAuthenticator
      Default:
      io.jmix.flowui.testassist.UiTest.DefaultUiTestAuthenticator.class