use of io.jmix.petclinic.screen.visit.VisitEdit in project jmix-sneferu by mariodavid.
the class GetOpenedEditorScreenTest method given_editorScreenIsOpen_when_getOpenedScreen_then_screenIsReturned.
@Test
void given_editorScreenIsOpen_when_getOpenedScreen_then_screenIsReturned(Screens screens, UiTestAPI uiTestAPI) {
// given:
final VisitEdit screen = screens.create(VisitEdit.class);
screen.setEntityToEdit(dataManager.create(Visit.class));
// and:
screen.show();
// when:
final StandardEditorTestAPI<Visit, VisitEdit> openedScreen = uiTestAPI.getOpenedEditorScreen(VisitEdit.class);
// then:
assertThat(openedScreen.screen()).isEqualTo(screen);
}
use of io.jmix.petclinic.screen.visit.VisitEdit in project jmix-sneferu by mariodavid.
the class GetOpenedEditorScreenTest method given_noEditorScreenIsOpen_when_getOpenedScreen_then_exceptionIsThrown.
@Test
void given_noEditorScreenIsOpen_when_getOpenedScreen_then_exceptionIsThrown(Screens screens, UiTestAPI uiTestAPI) {
// given:
screens.removeAll();
// when:
final ScreenNotOpenException exception = Assertions.assertThrows(ScreenNotOpenException.class, () -> uiTestAPI.getOpenedEditorScreen(VisitEdit.class));
// 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 InteractionsTest method when_verifyIsPerformed_then_resultOfTheInteractionIsReturned.
@Test
void when_verifyIsPerformed_then_resultOfTheInteractionIsReturned(UiTestAPI uiTestAPI) {
// given:
final StandardEditorTestAPI<Visit, VisitEdit> openedScreen = uiTestAPI.openStandardEditor(Visit.class, VisitEdit.class);
// and:
assertThat(openedScreen.component(dateField("visitStartField"))).isNotNull();
// and:
final LocalDateTime startDate = LocalDateTime.of(2022, 1, 15, 6, 0);
// and:
openedScreen.interact(enter(dateField("visitStartField"), startDate));
// when:
final LocalDateTime enteredVisitStart = openedScreen.verify(entityValue("visitStart", LocalDateTime.class));
// then:
assertThat(enteredVisitStart).isEqualTo(startDate);
}
use of io.jmix.petclinic.screen.visit.VisitEdit in project jmix-sneferu by mariodavid.
the class EditedEntityInteractionTest method when_interactionIsPerformed_then_editedEntityIsReturned.
@Test
void when_interactionIsPerformed_then_editedEntityIsReturned(UiTestAPI uiTestAPI) {
// given:
final Visit expectedVisit = dataManager.create(Visit.class);
// and:
StandardEditorTestAPI<Visit, VisitEdit> visitEdit = uiTestAPI.openStandardEditor(Visit.class, VisitEdit.class, expectedVisit);
// when:
final Visit actualVisitEntity = visitEdit.andThenGet(editedEntity());
// then:
assertThat(actualVisitEntity).isEqualTo(expectedVisit);
}
use of io.jmix.petclinic.screen.visit.VisitEdit in project jmix-sneferu by mariodavid.
the class VisitEditTest method aVisitCanBeCreated_whenAllFieldsAreFilled.
@Test
void aVisitCanBeCreated_whenAllFieldsAreFilled(UiTestAPI uiTestAPI) {
StandardEditorTestAPI<Visit, VisitEdit> visitEdit = uiTestAPI.openStandardEditor(Visit.class, VisitEdit.class);
// when:
OperationResult outcome = (OperationResult) visitEdit.interact(enter(dateField("visitStartField"), LocalDateTime.now())).interact(enter(textField("descriptionField"), "Regular Visit")).interact(select(comboBox("typeField"), VisitType.RECHARGE)).interact(select(entityComboBox("petField"), pet)).andThenGet(closeEditor());
// then:
assertThat(outcome).isEqualTo(OperationResult.success());
}
Aggregations