use of io.jmix.petclinic.entity.pet.Pet in project jmix-sneferu by mariodavid.
the class CloseInputDialogInteractionTest method storePikachu.
private Pet storePikachu(String identificationNumber) {
Pet newPet = dataManager.create(Pet.class);
newPet.setName("Pikachu");
newPet.setIdentificationNumber(identificationNumber);
return dataManager.save(newPet);
}
use of io.jmix.petclinic.entity.pet.Pet 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.pet.Pet in project jmix-sneferu by mariodavid.
the class VisitEditTest method createPet.
private Pet createPet() {
Pet newPet = dataManager.create(Pet.class);
newPet.setName("Pikachu");
newPet.setIdentificationNumber("025");
return dataManager.save(newPet);
}
use of io.jmix.petclinic.entity.pet.Pet in project jmix-sneferu by mariodavid.
the class PetBrowseTest method interactWithPetBrowse_throughPetBrowseScreenObject.
@Test
void interactWithPetBrowse_throughPetBrowseScreenObject(UiTestAPI uiTestAPI) {
// given:
final PetType water = storePetType("Water");
final PetType dragon = storePetType("Dragon");
final Pet waterPet1 = storePetForType(water);
final Pet waterPet2 = storePetForType(water);
final Pet dragonPet1 = storePetForType(dragon);
final Pet dragonPet2 = storePetForType(dragon);
// and:
final PetBrowseScreen petBrowse = PetBrowseScreen.open(uiTestAPI);
assertThat(petBrowse.isActive()).isTrue();
// and:
assertThat(petBrowse.petCount()).isEqualTo(4);
// when:
petBrowse.filterByType(dragon);
// then:
assertThat(petBrowse.petCount()).isEqualTo(2);
// and:
assertThat(petBrowse.pets()).contains(dragonPet1, dragonPet2).doesNotContain(waterPet1, waterPet2);
}
Aggregations