Class LocatorKt
-
- All Implemented Interfaces:
public final class LocatorKt
-
-
Field Summary
Fields Modifier and Type Field Description private final static StringcurrentPath
-
Method Summary
Modifier and Type Method Description final StringgetCurrentPath()final static List<String>filterNotBlank(Iterable<String> $self)final static <T extends Component> T_get(Component $self, Function1<SearchSpec<T>, Unit> block)Finds a VISIBLE component of given type which matches given block. final static <T extends Component> T_get(Component $self, Class<T> clazz, Function1<SearchSpec<T>, Unit> block)Finds a VISIBLE component of given clazz which matches given block. final static <T extends Component> T_get(Function1<SearchSpec<T>, Unit> block)Finds a VISIBLE component in the current UI of given type which matches given block. final static <T extends Component> T_get(Class<T> clazz, Function1<SearchSpec<T>, Unit> block)Finds a VISIBLE component in the current UI of given clazz which matches given block. final static <T extends Component> List<T>_find(Component $self, Class<T> clazz, Function1<SearchSpec<T>, Unit> block)Finds a list of VISIBLE components of given clazz which matches block. final static <T extends Component> List<T>_find(Component $self, Function1<SearchSpec<T>, Unit> block)Finds a list of VISIBLE components of given type which matches block. final static <T extends Component> List<T>_find(Function1<SearchSpec<T>, Unit> block)Finds a list of VISIBLE components in the current UI of given type which matches given block. final static <T extends Component> List<T>_find(Class<T> clazz, Function1<SearchSpec<T>, Unit> block)Finds a list of VISIBLE components of given clazz which matches block. final static Iterable<Component>_walkAll(Component $self)Walks the component child/descendant tree, depth-first: first the component, then its descendants, then its next sibling. final static <T extends Component> Unit_expectNone(Component $self, Function1<SearchSpec<T>, Unit> block)Expects that there are no VISIBLE components of given type which matches block. final static <T extends Component> Unit_expectNone(Component $self, Class<T> clazz, Function1<SearchSpec<T>, Unit> block)Expects that there are no VISIBLE components of given clazz which matches block. final static <T extends Component> Unit_expectNone(Function1<SearchSpec<T>, Unit> block)Expects that there are no VISIBLE components in the current UI of given type which matches block. final static <T extends Component> Unit_expectNone(Class<T> clazz, Function1<SearchSpec<T>, Unit> block)Expects that there are no VISIBLE components in the current UI of given clazz which matches block. final static Unit_expectNoDialogs()Expects that there are no dialogs shown. final static <T extends Component> Unit_expectOne(Component $self, Function1<SearchSpec<T>, Unit> block)Expects that there is exactly one VISIBLE components of given type which matches block. final static <T extends Component> Unit_expectOne(Component $self, Class<T> clazz, Function1<SearchSpec<T>, Unit> block)Expects that there is exactly one VISIBLE components of given clazz which matches block. final static <T extends Component> Unit_expectOne(Function1<SearchSpec<T>, Unit> block)Expects that there is exactly one VISIBLE components in the current UI of given type which matches block. final static <T extends Component> Unit_expectOne(Class<T> clazz, Function1<SearchSpec<T>, Unit> block)Expects that there is exactly one VISIBLE components in the current UI of given clazz which matches block. final static <T extends Component> Unit_expect(Component $self, Integer count, Function1<SearchSpec<T>, Unit> block)Expects that there are exactly count VISIBLE components matching block. final static <T extends Component> Unit_expect(Component $self, Class<T> clazz, Integer count, Function1<SearchSpec<T>, Unit> block)Expects that there are exactly count VISIBLE components of given clazz match block. final static <T extends Component> Unit_expect(Integer count, Function1<SearchSpec<T>, Unit> block)Expects that there are exactly count VISIBLE components in the current UI match block. final static <T extends Component> Unit_expect(Class<T> clazz, Integer count, Function1<SearchSpec<T>, Unit> block)Expects that there are exactly count VISIBLE components in the current UI with given clazz match block. final static Unit_expectInternalServerError(String expectedErrorMessage)Asserts that the InternalServerError page is currently being shown, optionally with given expectedErrorMessage. -
-
Method Detail
-
getCurrentPath
final String getCurrentPath()
-
filterNotBlank
final static List<String> filterNotBlank(Iterable<String> $self)
-
_get
final static <T extends Component> T _get(Component $self, Function1<SearchSpec<T>, Unit> block)
Finds a VISIBLE component of given type which matches given block. This component and all of its descendants are searched.
- Parameters:
block- the search specification- Returns:
the only matching component, never null.
-
_get
final static <T extends Component> T _get(Component $self, Class<T> clazz, Function1<SearchSpec<T>, Unit> block)
Finds a VISIBLE component of given clazz which matches given block. This component and all of its descendants are searched.
- Parameters:
clazz- the component must be of this class.block- the search specification- Returns:
the only matching component, never null.
-
_get
final static <T extends Component> T _get(Function1<SearchSpec<T>, Unit> block)
Finds a VISIBLE component in the current UI of given type which matches given block. The currentUI and all of its descendants are searched.
- Returns:
the only matching component, never null.
-
_get
final static <T extends Component> T _get(Class<T> clazz, Function1<SearchSpec<T>, Unit> block)
Finds a VISIBLE component in the current UI of given clazz which matches given block. The currentUI and all of its descendants are searched.
- Parameters:
clazz- the component must be of this class.block- the search specification- Returns:
the only matching component, never null.
-
_find
final static <T extends Component> List<T> _find(Component $self, Class<T> clazz, Function1<SearchSpec<T>, Unit> block)
Finds a list of VISIBLE components of given clazz which matches block. This component and all of its descendants are searched.
- Returns:
the list of matching components, may be empty.
-
_find
final static <T extends Component> List<T> _find(Component $self, Function1<SearchSpec<T>, Unit> block)
Finds a list of VISIBLE components of given type which matches block. This component and all of its descendants are searched.
- Returns:
the list of matching components, may be empty.
-
_find
final static <T extends Component> List<T> _find(Function1<SearchSpec<T>, Unit> block)
Finds a list of VISIBLE components in the current UI of given type which matches given block. The UI.getCurrent and all of its descendants are searched.
- Parameters:
block- the search specification- Returns:
the list of matching components, may be empty.
-
_find
final static <T extends Component> List<T> _find(Class<T> clazz, Function1<SearchSpec<T>, Unit> block)
Finds a list of VISIBLE components of given clazz which matches block. The UI.getCurrent and all of its descendants are searched.
- Returns:
the list of matching components, may be empty.
-
_walkAll
final static Iterable<Component> _walkAll(Component $self)
Walks the component child/descendant tree, depth-first: first the component, then its descendants, then its next sibling.
-
_expectNone
final static <T extends Component> Unit _expectNone(Component $self, Function1<SearchSpec<T>, Unit> block)
Expects that there are no VISIBLE components of given type which matches block. This component and all of its descendants are searched.
-
_expectNone
final static <T extends Component> Unit _expectNone(Component $self, Class<T> clazz, Function1<SearchSpec<T>, Unit> block)
Expects that there are no VISIBLE components of given clazz which matches block. This component and all of its descendants are searched.
-
_expectNone
final static <T extends Component> Unit _expectNone(Function1<SearchSpec<T>, Unit> block)
Expects that there are no VISIBLE components in the current UI of given type which matches block. The currentUI and all of its descendants are searched.
-
_expectNone
final static <T extends Component> Unit _expectNone(Class<T> clazz, Function1<SearchSpec<T>, Unit> block)
Expects that there are no VISIBLE components in the current UI of given clazz which matches block. The currentUI and all of its descendants are searched.
-
_expectNoDialogs
final static Unit _expectNoDialogs()
Expects that there are no dialogs shown.
-
_expectOne
final static <T extends Component> Unit _expectOne(Component $self, Function1<SearchSpec<T>, Unit> block)
Expects that there is exactly one VISIBLE components of given type which matches block. This component and all of its descendants are searched.
-
_expectOne
final static <T extends Component> Unit _expectOne(Component $self, Class<T> clazz, Function1<SearchSpec<T>, Unit> block)
Expects that there is exactly one VISIBLE components of given clazz which matches block. This component and all of its descendants are searched.
-
_expectOne
final static <T extends Component> Unit _expectOne(Function1<SearchSpec<T>, Unit> block)
Expects that there is exactly one VISIBLE components in the current UI of given type which matches block. The currentUI and all of its descendants are searched.
-
_expectOne
final static <T extends Component> Unit _expectOne(Class<T> clazz, Function1<SearchSpec<T>, Unit> block)
Expects that there is exactly one VISIBLE components in the current UI of given clazz which matches block. The currentUI and all of its descendants are searched.
-
_expect
final static <T extends Component> Unit _expect(Component $self, Integer count, Function1<SearchSpec<T>, Unit> block)
Expects that there are exactly count VISIBLE components matching block. This component and all of its descendants are searched. Examples:
// check that there are 5 buttons in a button bar buttonBar._expect<Button>(5..5) // check that there are either 3, 4 or 5 vertical layouts in the UI with given class _expect<VerticalLayout>{ count = 3..5; styles = "menubar" }Special cases: for asserting one component use _expectOne. For asserting no components use _expectNone.
-
_expect
final static <T extends Component> Unit _expect(Component $self, Class<T> clazz, Integer count, Function1<SearchSpec<T>, Unit> block)
Expects that there are exactly count VISIBLE components of given clazz match block. This component and all of its descendants are searched. Examples:
// check that there are 5 buttons in a button bar buttonBar._expect<Button>(5) // check that there are either 3, 4 or 5 vertical layouts in the UI with given class _expect<VerticalLayout>{ count = 3..5; styles = "menubar" }Special cases: for asserting one component use _expectOne. For asserting no components use _expectNone.
-
_expect
final static <T extends Component> Unit _expect(Integer count, Function1<SearchSpec<T>, Unit> block)
Expects that there are exactly count VISIBLE components in the current UI match block. The currentUI and all of its descendants are searched. Examples:
// check that there are 5 buttons in a button bar buttonBar._expect<Button>(5..5) // check that there are either 3, 4 or 5 vertical layouts in the UI with given class _expect<VerticalLayout>{ count = 3..5; styles = "menubar" }Special cases: for asserting one component use _expectOne. For asserting no components use _expectNone.
-
_expect
final static <T extends Component> Unit _expect(Class<T> clazz, Integer count, Function1<SearchSpec<T>, Unit> block)
Expects that there are exactly count VISIBLE components in the current UI with given clazz match block. The currentUI and all of its descendants are searched. Examples:
// check that there are 5 buttons in a button bar buttonBar._expect<Button>(5) // check that there are either 3, 4 or 5 vertical layouts in the UI with given class _expect<VerticalLayout>{ count = 3..5; styles = "menubar" }Special cases: for asserting one component use _expectOne. For asserting no components use _expectNone. They provide a better error message in case of a failure, and also communicate your intent as a test writer better in the test code.
-
_expectInternalServerError
final static Unit _expectInternalServerError(String expectedErrorMessage)
Asserts that the InternalServerError page is currently being shown, optionally with given expectedErrorMessage.
-
-
-
-