use of io.jmix.petclinic.entity.veterinarian.Veterinarian in project jmix-sneferu by mariodavid.
the class SelectInListInteractionTest method storeVet.
private Veterinarian storeVet(String name) {
Veterinarian entity = dataManager.create(Veterinarian.class);
entity.setFirstName("Professor");
entity.setLastName(name);
return dataManager.save(entity);
}
use of io.jmix.petclinic.entity.veterinarian.Veterinarian in project jmix-sneferu by mariodavid.
the class CloseEditorInteractionTest method given_invalidForm_when_interactionIsPerformedWith_then_screenIsClosedAndFailIsReturned.
@Test
void given_invalidForm_when_interactionIsPerformedWith_then_screenIsClosedAndFailIsReturned(UiTestAPI uiTestAPI) {
// given:
StandardEditorTestAPI<Veterinarian, VeterinarianEdit> visitEdit = uiTestAPI.openStandardEditor(Veterinarian.class, VeterinarianEdit.class);
// and:
visitEdit.interact(enter(textInputField("firstNameField"), null));
// when:
final OperationResult operationResult = visitEdit.andThenGet(closeEditor());
// then:
assertThat(operationResult).isEqualTo(OperationResult.fail());
}
use of io.jmix.petclinic.entity.veterinarian.Veterinarian in project jmix-sneferu by mariodavid.
the class SelectInListInteractionTest method when_multipleSelectionIsTriedWithSingleSelectionTable_then_exceptionIsThrown.
@Test
void when_multipleSelectionIsTriedWithSingleSelectionTable_then_exceptionIsThrown(UiTestAPI uiTestAPI) {
// given:
storeVet("Elm");
storeVet("Rowan");
storeVet("Sycamore");
// and:
final Veterinarian oak = storeVet("Oak");
final Veterinarian juniper = storeVet("Juniper");
final Veterinarian birch = storeVet("Birch");
// and:
final StandardLookupTestAPI<Veterinarian, VeterinarianBrowse> openedScreen = uiTestAPI.openStandardLookup(Veterinarian.class, VeterinarianBrowse.class);
final DataGridComponentDescriptor dataGrid = dataGrid("veterinariansTable");
assertThat(openedScreen.rawComponent(dataGrid).isMultiSelect()).isFalse();
// when:
final IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> openedScreen.interact(selectInList(dataGrid, Lists.list(birch, oak, juniper))));
// then:
assertThat(exception.getMessage()).isEqualTo("Cannot select multiple values for component with multiselect='false'");
}
use of io.jmix.petclinic.entity.veterinarian.Veterinarian in project jmix-sneferu by mariodavid.
the class SelectInListInteractionTest method when_interactionIsPerformedWithSingleSelection_then_valueIsSet.
@Test
void when_interactionIsPerformedWithSingleSelection_then_valueIsSet(UiTestAPI uiTestAPI) {
// given:
storeVet("Oak");
storeVet("Elm");
storeVet("Juniper");
storeVet("Rowan");
storeVet("Sycamore");
// and:
final Veterinarian birch = storeVet("Birch");
// and:
final StandardLookupTestAPI<Veterinarian, VeterinarianBrowse> openedScreen = uiTestAPI.openStandardLookup(Veterinarian.class, VeterinarianBrowse.class);
final DataGridComponentDescriptor dataGrid = dataGrid("veterinariansTable");
assertThat(openedScreen.rawComponent(dataGrid).isMultiSelect()).isFalse();
// when:
openedScreen.interact(selectInList(dataGrid, birch));
// then:
final Veterinarian selectedVetInTable = (Veterinarian) openedScreen.rawComponent(dataGrid).getSingleSelected();
// and:
assertThat(selectedVetInTable).isEqualTo(birch);
}
use of io.jmix.petclinic.entity.veterinarian.Veterinarian in project jmix-sneferu by mariodavid.
the class CancelEditorInteractionTest method when_interactionIsPerformed_then_screenIsCanceledAndNothingIsCommitted.
@Test
void when_interactionIsPerformed_then_screenIsCanceledAndNothingIsCommitted(UiTestAPI uiTestAPI) {
// given:
StandardEditorTestAPI<Veterinarian, VeterinarianEdit> visitEdit = uiTestAPI.openStandardEditor(Veterinarian.class, VeterinarianEdit.class);
// and:
visitEdit.interact(enter(textInputField("firstNameField"), "Oak"));
// when:
final OperationResult operationResult = visitEdit.andThenGet(cancelEditor());
// then:
assertThat(operationResult).isEqualTo(OperationResult.success());
// and:
assertThat(dataManager.load(Veterinarian.class).all().list()).isEmpty();
}
Aggregations