use of io.jmix.petclinic.screen.visit.VisitEdit in project jmix-sneferu by mariodavid.
the class GetLazyOpenedEditorScreenTest method given_screenIsAlreadyOpened_when_getLazyOpenedEditorScreen_then_lazyTestApiIsReturned.
@Test
void given_screenIsAlreadyOpened_when_getLazyOpenedEditorScreen_then_lazyTestApiIsReturned(Screens screens, UiTestAPI uiTestAPI) {
// given:
final VisitEdit screen = showVisitEditor(screens);
// when:
final StandardEditorTestAPI<Visit, VisitEdit> lazyOpenedScreen = uiTestAPI.getLazyOpenedEditorScreen(VisitEdit.class);
// then:
assertThat(lazyOpenedScreen.screen()).isEqualTo(screen);
}
use of io.jmix.petclinic.screen.visit.VisitEdit in project jmix-sneferu by mariodavid.
the class InteractionsTest method when_interactIsPerformedMultipleTimes_then_allInteractionsArePerformed.
@Test
void when_interactIsPerformedMultipleTimes_then_allInteractionsArePerformed(UiTestAPI uiTestAPI) {
// given:
final StandardEditorTestAPI<Visit, VisitEdit> openedScreen = uiTestAPI.openStandardEditor(Visit.class, VisitEdit.class);
// and:
assertThat(openedScreen.component(dateField("visitStartField"))).isNotNull();
assertThat(openedScreen.component(comboBox("typeField"))).isNotNull();
// and:
final LocalDateTime startDate = LocalDateTime.of(2022, 1, 15, 6, 0);
final VisitType recharge = VisitType.RECHARGE;
// when:
openedScreen.interact(enter(dateField("visitStartField"), startDate)).andThen(select(comboBox("typeField"), recharge));
// then:
assertThat(openedScreen.verify(entityValue("visitStart", LocalDateTime.class))).isEqualTo(startDate);
// and:
assertThat(openedScreen.verify(entityValue("type", VisitType.class))).isEqualTo(recharge);
}
use of io.jmix.petclinic.screen.visit.VisitEdit in project jmix-sneferu by mariodavid.
the class EntityValueInteractionTest method when_interactionIsPerformed_then_valueIsReturnedFromTheEntity.
@Test
void when_interactionIsPerformed_then_valueIsReturnedFromTheEntity(UiTestAPI uiTestAPI) {
// given:
StandardEditorTestAPI<Visit, VisitEdit> visitEdit = uiTestAPI.openStandardEditor(Visit.class, VisitEdit.class);
// and:
final LocalDateTime visitStart = LocalDateTime.now();
visitEdit.interact(enter(dateField("visitStartField"), visitStart));
// when:
final LocalDateTime actualVisitStart = (LocalDateTime) visitEdit.andThenGet(entityValue("visitStart", LocalDateTime.class));
// then:
assertThat(actualVisitStart).isEqualTo(visitStart);
}
use of io.jmix.petclinic.screen.visit.VisitEdit in project jmix-sneferu by mariodavid.
the class CreateVisitTest method aVisitCanBeCreated_whenAllFieldsAreFilled.
@Test
void aVisitCanBeCreated_whenAllFieldsAreFilled(UiTestAPI uiTestAPI) {
// given:
final Pet pikachu = dataManager.create(Pet.class);
pikachu.setName("Pikachu");
pikachu.setIdentificationNumber("025");
final Pet savedPikachu = dataManager.save(pikachu);
// and:
final StandardLookupTestAPI<Visit, VisitBrowse> visitBrowse = uiTestAPI.openStandardLookup(Visit.class, VisitBrowse.class);
visitBrowse.interact(click(button("createBtn")));
// when:
final StandardEditorTestAPI<Visit, VisitEdit> visitEdit = uiTestAPI.getOpenedEditorScreen(VisitEdit.class);
OperationResult outcome = (OperationResult) visitEdit.interact(enter(dateField("visitStartField"), LocalDateTime.now())).interact(enter(textField("descriptionField"), "Regular Visit")).interact(select(comboBox("typeField"), VisitType.REGULAR_CHECKUP)).interact(select(entityComboBox("petField"), savedPikachu)).andThenGet(closeEditor());
// then:
assertThat(outcome).isEqualTo(OperationResult.success());
// and:
assertThat(uiTestAPI.isActive(visitEdit)).isFalse();
}
Aggregations