Search in sources :

Example 1 with JmixUiTestAPI

use of de.diedavids.sneferu.JmixUiTestAPI in project jmix-sneferu by mariodavid.

the class SneferuUiTestExtension method beforeEach.

@Override
public void beforeEach(ExtensionContext context) throws Exception {
    boolean closeAllScreensBeforeRun = false;
    Optional<SneferuUiTest> jmixUiTestAnnotationOpt = AnnotationSupport.findAnnotation(context.getTestClass(), SneferuUiTest.class);
    if (jmixUiTestAnnotationOpt.isPresent()) {
        authenticatedUser = jmixUiTestAnnotationOpt.get().authenticatedUser();
        screenBasePackages = jmixUiTestAnnotationOpt.get().screenBasePackages();
        mainScreenId = jmixUiTestAnnotationOpt.get().mainScreenId();
        closeAllScreensBeforeRun = jmixUiTestAnnotationOpt.get().closeAllScreensBeforeRun();
    }
    super.beforeEach(context);
    ApplicationContext springContext = SpringExtension.getApplicationContext(context);
    uiTestAPI = new JmixUiTestAPI(springContext.getBean(ScreenBuilders.class), getAppUI(context).getScreens());
    if (closeAllScreensBeforeRun) {
        uiTestAPI.closeAllScreens();
    }
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) JmixUiTestAPI(de.diedavids.sneferu.JmixUiTestAPI) SneferuUiTest(de.diedavids.sneferu.SneferuUiTest)

Aggregations

JmixUiTestAPI (de.diedavids.sneferu.JmixUiTestAPI)1 SneferuUiTest (de.diedavids.sneferu.SneferuUiTest)1 ApplicationContext (org.springframework.context.ApplicationContext)1