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();
}
}
Aggregations