use of io.jmix.petclinic.screen.visit.VisitEdit in project jmix-sneferu by mariodavid.
the class VisitEditTest method aVisitCannotBeCreated_whenPetIsMissing.
@Test
void aVisitCannotBeCreated_whenPetIsMissing(UiTestAPI uiTestAPI) {
StandardEditorTestAPI<Visit, VisitEdit> visitEdit = uiTestAPI.openStandardEditor(Visit.class, VisitEdit.class);
// when:
visitEdit.interact(enter(entityComboBox("petField"), null));
// and:
OperationResult outcome = (OperationResult) visitEdit.interact(enter(textField("descriptionField"), "Regular Visit")).interact(select(comboBox("typeField"), VisitType.RECHARGE)).andThenGet(closeEditor());
// then:
assertThat(outcome).isEqualTo(OperationResult.fail());
// and:
assertThat(visitEdit.screen().getWindow().validateAll()).isFalse();
}
use of io.jmix.petclinic.screen.visit.VisitEdit in project jmix-sneferu by mariodavid.
the class GetValueInteractionTest method when_interactionIsPerformed_then_valueIsReturnedFromTheComponent.
@Test
void when_interactionIsPerformed_then_valueIsReturnedFromTheComponent(UiTestAPI uiTestAPI) {
// given:
StandardEditorTestAPI<Visit, VisitEdit> visitEdit = uiTestAPI.openStandardEditor(Visit.class, VisitEdit.class);
// and:
visitEdit.interact(enter(VISIT_START_FIELD, VISIT_START_VALUE));
// when:
final LocalDateTime actualVisitStart = (LocalDateTime) visitEdit.andThenGet(getValue(VISIT_START_FIELD));
// then:
assertThat(actualVisitStart).isEqualTo(VISIT_START_VALUE);
}
use of io.jmix.petclinic.screen.visit.VisitEdit in project jmix-sneferu by mariodavid.
the class GetLazyOpenedEditorScreenTest method given_screenIsOpenedAfterRetrievingTheLazyReference_when_accessingScreen_then_screenIsReturned.
@Test
void given_screenIsOpenedAfterRetrievingTheLazyReference_when_accessingScreen_then_screenIsReturned(Screens screens, UiTestAPI uiTestAPI) {
// given:
final StandardEditorTestAPI<Visit, VisitEdit> lazyOpenedScreen = uiTestAPI.getLazyOpenedEditorScreen(VisitEdit.class);
// and: screen is opened through the application (or test in this case)
final VisitEdit screen = showVisitEditor(screens);
// expect: the previous retrieved lazy reference will return the correct reference to the screen
assertThat(lazyOpenedScreen.screen()).isEqualTo(screen);
}
use of io.jmix.petclinic.screen.visit.VisitEdit in project jmix-sneferu by mariodavid.
the class GetLazyOpenedEditorScreenTest method given_lazyTestApiIsReturned_when_accessingScreen_then_ScreenNotFoundExceptionIsThrown.
@Test
void given_lazyTestApiIsReturned_when_accessingScreen_then_ScreenNotFoundExceptionIsThrown(Screens screens, UiTestAPI uiTestAPI) {
// given:
screens.removeAll();
// when:
final StandardEditorTestAPI<Visit, VisitEdit> lazyOpenedScreen = uiTestAPI.getLazyOpenedEditorScreen(VisitEdit.class);
// then:
final ScreenNotOpenException exception = Assertions.assertThrows(ScreenNotOpenException.class, lazyOpenedScreen::screen);
// then:
assertThat(exception.getMessage()).isEqualTo("No Screen of class VisitEdit found");
}
use of io.jmix.petclinic.screen.visit.VisitEdit in project jmix-sneferu by mariodavid.
the class GetLazyOpenedEditorScreenTest method showVisitEditor.
@NotNull
private VisitEdit showVisitEditor(Screens screens) {
final VisitEdit screen = screens.create(VisitEdit.class);
screen.setEntityToEdit(dataManager.create(Visit.class));
screen.show();
return screen;
}
Aggregations