Search in sources :

Example 1 with PetType

use of io.jmix.petclinic.entity.pet.PetType in project jmix-sneferu by mariodavid.

the class SelectInListInteractionTest method storePetType.

private PetType storePetType(String name) {
    PetType entity = dataManager.create(PetType.class);
    entity.setName(name);
    return dataManager.save(entity);
}
Also used : PetType(io.jmix.petclinic.entity.pet.PetType)

Example 2 with PetType

use of io.jmix.petclinic.entity.pet.PetType in project jmix-sneferu by mariodavid.

the class PetBrowseTest method storePetType.

@NotNull
private PetType storePetType(String name) {
    final PetType petType = dataManager.create(PetType.class);
    petType.setName(name);
    return dataManager.save(petType);
}
Also used : PetType(io.jmix.petclinic.entity.pet.PetType) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with PetType

use of io.jmix.petclinic.entity.pet.PetType in project jmix-sneferu by mariodavid.

the class SelectInListInteractionTest method when_interactionIsPerformedWithMultiSelection_then_allValuesAreSet.

@Test
void when_interactionIsPerformedWithMultiSelection_then_allValuesAreSet(UiTestAPI uiTestAPI) {
    // given:
    final PetType ice = storePetType("Ice");
    final PetType water = storePetType("Water");
    final PetType dragon = storePetType("Dragon");
    // and:
    final StandardLookupTestAPI<PetType, PetTypeBrowse> openedScreen = uiTestAPI.openStandardLookup(PetType.class, PetTypeBrowse.class);
    final TableComponentDescriptor table = table("table");
    assertThat(openedScreen.rawComponent(table).isMultiSelect()).isTrue();
    // when:
    openedScreen.interact(selectInList(table, Lists.list(water, dragon)));
    // then:
    final Set<PetType> selectedPetTypesInTable = openedScreen.rawComponent(table).getSelected();
    // and:
    assertThat(selectedPetTypesInTable).contains(water, dragon);
}
Also used : TableComponentDescriptor(de.diedavids.sneferu.components.descriptor.TableComponentDescriptor) PetTypeBrowse(io.jmix.petclinic.screen.pet.pettype.PetTypeBrowse) 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)

Example 4 with PetType

use of io.jmix.petclinic.entity.pet.PetType 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

PetType (io.jmix.petclinic.entity.pet.PetType)4 SneferuUiTest (de.diedavids.sneferu.SneferuUiTest)2 Test (org.junit.jupiter.api.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 TableComponentDescriptor (de.diedavids.sneferu.components.descriptor.TableComponentDescriptor)1 Pet (io.jmix.petclinic.entity.pet.Pet)1 PetTypeBrowse (io.jmix.petclinic.screen.pet.pettype.PetTypeBrowse)1 NotNull (org.jetbrains.annotations.NotNull)1