Class TabSheetLocator
- All Implemented Interfaces:
Clickable<TabSheet>,HasThemeFilter<TabSheet,TabSheetLocator>
TabSheet, derived from
TabSheetTester. Filter steps are inherited from
Locator; action methods delegate to a fresh tester
around the resolved component, so behavioral changes belong on the
tester, not here.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a locator that searches for aTabSheet.TabSheetLocator(TabSheet component) Creates a locator already bound to the given component, so that the action methods run against it instead of against a lookup. -
Method Summary
Modifier and TypeMethodDescriptionvoidEnsures the component is in a usable state before interaction.Gets the component being tested.Gets the label of the selected tab.getTab(int index) Gets the visible tab at given index.Gets the visible tab with the given label.<E extends Component>
EgetTabContent(int index) Gets the content of the visible tab at given index.<E extends Component>
EgetTabContent(String label) Gets the content of the visible tab with the given label.Gets the labels of the visible tabs, in the order the user sees them.booleanisSelected(int index) Checks if the visible tab at the given index is currently selected.booleanisSelected(String label) Checks if the tab with the given label is currently selected.voidselect(int index) Selects a visible tab based on its zero-based index.voidSelects the tab with the given label.Methods inherited from class com.vaadin.browserless.locator.Locator
atIndex, component, components, exists, inside, inside, invalidate, self, with, withAttribute, withAttribute, withClassName, withCondition, withCondition, withId, withinSlot, withoutAttribute, withoutAttribute, withoutClassName, withTestIdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.browserless.Clickable
click, click, click, middleClick, middleClick, rightClick, rightClickMethods inherited from interface com.vaadin.browserless.locator.HasThemeFilter
withoutTheme, withoutTheme, withTheme, withTheme
-
Constructor Details
-
TabSheetLocator
public TabSheetLocator()Creates a locator that searches for aTabSheet. -
TabSheetLocator
Creates a locator already bound to the given component, so that the action methods run against it instead of against a lookup.- Parameters:
component- the component the locator resolves to
-
-
Method Details
-
getComponent
Description copied from interface:ClickableGets the component being tested.- Specified by:
getComponentin interfaceClickable<TabSheet>- Returns:
- the component under test
-
ensureComponentIsUsable
public void ensureComponentIsUsable()Description copied from interface:ClickableEnsures the component is in a usable state before interaction.- Specified by:
ensureComponentIsUsablein interfaceClickable<TabSheet>
-
select
Selects the tab with the given label. Javadoc copied fromTabSheetTester.select(java.lang.String).- Parameters:
label- the tab label- Throws:
IllegalArgumentException- if the tab with givenlabelis not visible.IllegalStateException- if tab is not usable in the browser
-
select
public void select(int index) Selects a visible tab based on its zero-based index.The
indexrefers to the zero-base position of the currently visible tabs. For example, if there are three tabs A (position 0), B (position 1) and C (position 2), but tab 'B' is hidden, then to select tab 'C' the call must beselect(1)and notselect(2). Javadoc copied fromTabSheetTester.select(int).- Parameters:
index- the zero-based index of the selected tab, negative value to unselect- Throws:
IllegalStateException- if tab at give index is not usable in the browser
-
isSelected
Checks if the tab with the given label is currently selected. Javadoc copied fromTabSheetTester.isSelected(java.lang.String).- Parameters:
label- the tab label- Returns:
- true if the tab is selected, false otherwise.
- Throws:
IllegalArgumentException- if the tab with givenlabelis not visible.
-
isSelected
public boolean isSelected(int index) Checks if the visible tab at the given index is currently selected.The
indexrefers to the zero-base position of the currently visible tabs. For example, if there are three tabs A (position 0), B (position 1) and C (position 2), but tab 'B' is hidden, then to check if tab 'C' is selected the call must beisSelected(1)and notisSelected(2). Javadoc copied fromTabSheetTester.isSelected(int).- Parameters:
index- the zero-based index of the tab- Returns:
- true if the tab is selected, false otherwise.
- Throws:
IllegalStateException- if tab at given index is not visible in the browser
-
getTab
Gets the visible tab with the given label. Javadoc copied fromTabSheetTester.getTab(java.lang.String).- Parameters:
label- the tab label- Returns:
- the visible tab with the given label
- Throws:
IllegalStateException- if tab is not visible
-
getTab
Gets the visible tab at given index.The
indexrefers to the zero-base position of the currently visible tabs. For example, if there are three tabs A (position 0), B (position 1) and C (position 2), but tab 'B' is hidden, then to get tab 'C', the call must begetTab(1)and notgetTab(2). Javadoc copied fromTabSheetTester.getTab(int).- Parameters:
index- the zero-based index of the selected tab, negative value to unselect- Returns:
- the tab at the given index
- Throws:
IllegalStateException- if tab at given index is not visible in the browserIllegalArgumentException- if theindexis less than zero or greater than the number of visible tabs.
-
getTabContent
Gets the content of the visible tab with the given label. Javadoc copied fromTabSheetTester.getTabContent(java.lang.String).- Type Parameters:
E- the event type- Parameters:
label- the tab label- Returns:
- the content of the tab with the given label
- Throws:
IllegalStateException- if tab is not visible
-
getTabContent
Gets the content of the visible tab at given index.The
indexrefers to the zero-base position of the currently visible tabs. For example, if there are three tabs A (position 0), B (position 1) and C (position 2), but tab 'B' is hidden, then to get the content of tab 'C', the call must begetTabContent(1)and notgetTabContent(2). Javadoc copied fromTabSheetTester.getTabContent(int).- Type Parameters:
E- the event type- Parameters:
index- the zero-based index of the selected tab, negative value to unselect- Returns:
- the content of the tab at the given index
- Throws:
IllegalStateException- if tab is not visibleIllegalArgumentException- if theindexis less than zero or greater than the number of visible tabs.
-
getTabLabels
Gets the labels of the visible tabs, in the order the user sees them.Hidden tabs are left out, so the position of a label in the returned list is the index that
TabSheetTester.select(int)andTabSheetTester.getTab(int)accept.Each entry is the tab's
label, the same text thatTabSheetTester.select(java.lang.String)andTabSheetTester.getTab(java.lang.String)match. A tab whose caption is made of components, such as an icon and aSpan, has no label of its own and is listed as an empty string.This only reads the tabs, so it also works when the component is disabled. Javadoc copied from
TabSheetTester.getTabLabels().- Returns:
- the labels of the visible tabs, never
null - Throws:
IllegalStateException- if the component is not visible
-
getSelectedTabLabel
Gets the label of the selected tab.This only reads the selection, so it also works when the component is disabled. A selected tab that is hidden is still reported, the same way
TabSheetTester.isSelected(java.lang.String)reports it. Javadoc copied fromTabSheetTester.getSelectedTabLabel().- Returns:
- the label of the selected tab, or
nullif no tab is selected - Throws:
IllegalStateException- if the component is not visible
-