Search in sources :

Example 1 with TabsheetComponentDescriptor

use of de.diedavids.sneferu.components.descriptor.TabsheetComponentDescriptor in project jmix-sneferu by mariodavid.

the class OpenTabInteractionTest method when_interactionIsPerformed_then_tabIsSelected.

@Test
void when_interactionIsPerformed_then_tabIsSelected(UiTestAPI uiTestAPI) {
    // given:
    final StandardLookupTestAPI<Visit, VisitBrowse> openedScreen = uiTestAPI.openStandardLookup(Visit.class, VisitBrowse.class);
    final TabsheetComponentDescriptor tabSheet = tabSheet("contentTabSheet");
    assertThat(openedScreen.rawComponent(tabSheet)).isNotNull();
    assertThat(openedScreen.rawComponent(tabSheet).getTab("tableTab")).isNotNull();
    // when:
    openedScreen.interact(openTab(tabSheet, "tableTab"));
    // then:
    final TabSheet.Tab selectedTab = openedScreen.rawComponent(tabSheet).getSelectedTab();
    // and:
    assertThat(selectedTab.getName()).isEqualTo("tableTab");
}
Also used : Visit(io.jmix.petclinic.entity.visit.Visit) TabsheetComponentDescriptor(de.diedavids.sneferu.components.descriptor.TabsheetComponentDescriptor) TabSheet(io.jmix.ui.component.TabSheet) 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 2 with TabsheetComponentDescriptor

use of de.diedavids.sneferu.components.descriptor.TabsheetComponentDescriptor in project jmix-sneferu by mariodavid.

the class OpenTabInteractionTest method when_interactionIsPerformedWithInvalidTab_then_exceptionIsThrown.

@Test
void when_interactionIsPerformedWithInvalidTab_then_exceptionIsThrown(UiTestAPI uiTestAPI) {
    // given:
    final StandardLookupTestAPI<Visit, VisitBrowse> openedScreen = uiTestAPI.openStandardLookup(Visit.class, VisitBrowse.class);
    final TabsheetComponentDescriptor tabSheet = tabSheet("contentTabSheet");
    assertThat(openedScreen.rawComponent(tabSheet)).isNotNull();
    // expect:
    assertThrows(IllegalStateException.class, () -> openedScreen.interact(openTab(tabSheet, "notExistingTab")));
}
Also used : Visit(io.jmix.petclinic.entity.visit.Visit) TabsheetComponentDescriptor(de.diedavids.sneferu.components.descriptor.TabsheetComponentDescriptor) 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)

Aggregations

SneferuUiTest (de.diedavids.sneferu.SneferuUiTest)2 TabsheetComponentDescriptor (de.diedavids.sneferu.components.descriptor.TabsheetComponentDescriptor)2 Visit (io.jmix.petclinic.entity.visit.Visit)2 VisitBrowse (io.jmix.petclinic.screen.visit.VisitBrowse)2 Test (org.junit.jupiter.api.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 TabSheet (io.jmix.ui.component.TabSheet)1