Search in sources :

Example 6 with Pet

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);
}
Also used : Pet(io.jmix.petclinic.entity.pet.Pet)

Example 7 with Pet

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();
}
Also used : VisitEdit(io.jmix.petclinic.screen.visit.VisitEdit) Visit(io.jmix.petclinic.entity.visit.Visit) OperationResult(io.jmix.ui.util.OperationResult) Pet(io.jmix.petclinic.entity.pet.Pet) VisitBrowse(io.jmix.petclinic.screen.visit.VisitBrowse) SneferuUiTest(de.diedavids.sneferu.SneferuUiTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 8 with Pet

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);
}
Also used : Pet(io.jmix.petclinic.entity.pet.Pet)

Example 9 with Pet

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);
}
Also used : Pet(io.jmix.petclinic.entity.pet.Pet) PetType(io.jmix.petclinic.entity.pet.PetType) SneferuUiTest(de.diedavids.sneferu.SneferuUiTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

Pet (io.jmix.petclinic.entity.pet.Pet)9 SneferuUiTest (de.diedavids.sneferu.SneferuUiTest)4 Test (org.junit.jupiter.api.Test)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 OperationResult (io.jmix.ui.util.OperationResult)3 InputDialogTestAPI (de.diedavids.sneferu.screen.InputDialogTestAPI)2 PetType (io.jmix.petclinic.entity.pet.PetType)2 PetEdit (io.jmix.petclinic.screen.pet.pet.PetEdit)2 DataManager (io.jmix.core.DataManager)1 Id (io.jmix.core.Id)1 Owner (io.jmix.petclinic.entity.owner.Owner)1 Visit (io.jmix.petclinic.entity.visit.Visit)1 VisitBrowse (io.jmix.petclinic.screen.visit.VisitBrowse)1 VisitEdit (io.jmix.petclinic.screen.visit.VisitEdit)1 Dialogs (io.jmix.ui.Dialogs)1 Notifications (io.jmix.ui.Notifications)1 ScreenBuilders (io.jmix.ui.ScreenBuilders)1 Action (io.jmix.ui.action.Action)1 DialogOutcome (io.jmix.ui.app.inputdialog.DialogOutcome)1 InputDialog (io.jmix.ui.app.inputdialog.InputDialog)1