use of io.jmix.petclinic.entity.visit.Visit 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.entity.visit.Visit 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.entity.visit.Visit 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();
}
use of io.jmix.petclinic.entity.visit.Visit in project jmix-sneferu by mariodavid.
the class GetOpenedLookupScreenTest method given_lookupScreenIsOpen_when_getOpenedScreen_then_screenIsReturned.
@Test
void given_lookupScreenIsOpen_when_getOpenedScreen_then_screenIsReturned(Screens screens, UiTestAPI uiTestAPI) {
// given:
final VisitBrowse screen = screens.create(VisitBrowse.class);
// and:
screen.show();
// when:
final StandardLookupTestAPI<Visit, VisitBrowse> openedScreen = uiTestAPI.getOpenedLookupScreen(VisitBrowse.class);
// then:
assertThat(openedScreen.screen()).isEqualTo(screen);
}
use of io.jmix.petclinic.entity.visit.Visit in project jmix-sneferu by mariodavid.
the class GetLazyOpenedLookupScreenTest method given_lazyTestApiIsReturned_when_accessingScreen_then_ScreenNotFoundExceptionIsThrown.
@Test
void given_lazyTestApiIsReturned_when_accessingScreen_then_ScreenNotFoundExceptionIsThrown(Screens screens, UiTestAPI uiTestAPI) {
// given:
screens.removeAll();
// when:
final StandardLookupTestAPI<Visit, VisitBrowse> lazyOpenedScreen = uiTestAPI.getLazyOpenedLookupScreen(VisitBrowse.class);
// then:
final ScreenNotOpenException exception = Assertions.assertThrows(ScreenNotOpenException.class, lazyOpenedScreen::screen);
// then:
assertThat(exception.getMessage()).isEqualTo("No Screen of class VisitBrowse found");
}
Aggregations