Search in sources :

Example 1 with VeterinarianBrowse

use of io.jmix.petclinic.screen.veterinarian.veterinarian.VeterinarianBrowse 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'");
}
Also used : DataGridComponentDescriptor(de.diedavids.sneferu.components.descriptor.DataGridComponentDescriptor) VeterinarianBrowse(io.jmix.petclinic.screen.veterinarian.veterinarian.VeterinarianBrowse) Veterinarian(io.jmix.petclinic.entity.veterinarian.Veterinarian) SneferuUiTest(de.diedavids.sneferu.SneferuUiTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with VeterinarianBrowse

use of io.jmix.petclinic.screen.veterinarian.veterinarian.VeterinarianBrowse 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);
}
Also used : DataGridComponentDescriptor(de.diedavids.sneferu.components.descriptor.DataGridComponentDescriptor) VeterinarianBrowse(io.jmix.petclinic.screen.veterinarian.veterinarian.VeterinarianBrowse) Veterinarian(io.jmix.petclinic.entity.veterinarian.Veterinarian) SneferuUiTest(de.diedavids.sneferu.SneferuUiTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

SneferuUiTest (de.diedavids.sneferu.SneferuUiTest)2 DataGridComponentDescriptor (de.diedavids.sneferu.components.descriptor.DataGridComponentDescriptor)2 Veterinarian (io.jmix.petclinic.entity.veterinarian.Veterinarian)2 VeterinarianBrowse (io.jmix.petclinic.screen.veterinarian.veterinarian.VeterinarianBrowse)2 Test (org.junit.jupiter.api.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2