Package com.vaadin.browserless.internal
Class SearchSpec<T extends com.vaadin.flow.component.Component>
java.lang.Object
com.vaadin.browserless.internal.SearchSpec<T>
- Type Parameters:
T- the type of the component we are searching for.
A criterion for matching components. The component must match all of non-null
fields.
You can add more properties, simply by creating a write-only property which
will register a new predicate on write.
For internal use only. May be renamed or removed in a future release.
-
Constructor Summary
ConstructorsConstructorDescriptionSearchSpec(Class<T> clazz) Creates a search specification which matches all components of given class.SearchSpec(Class<T> clazz, String id, String testId, String caption, String placeholder, String text, CountRange count, Object value, String classes, String withoutClasses, List<Predicate<T>> predicates, String themes, String withoutThemes) Creates a search specification. -
Method Summary
Modifier and TypeMethodDescriptionvoidcaptionContains(String substring) Makes sure that the component's caption contains givensubstring.The requiredcaption; if null, no particular caption is matched.If not null, the component must match all of these class names.getClazz()The class of the component we are searching for.getCount()The expected number of matching components.getId()The requiredComponent.getId(); if null, no particular id is matched.The requiredplaceholder; if null, no particular placeholder is matched.Extra predicates the component must satisfy, on top of the other rules.The required test id, i.e. thedata-testidattribute; if null, no particular test id is matched.getText()The requiredElement.getText(); if null, no particular text is matched.If not null, the component must have all theme names defined.getValue()ExpectedHasValue.getValue(); ifnull, no particular value is matched.If not null, the component must NOT match any of these class names.If not null, the component must NOT have any of the theme names defined.voidsetCaption(String caption) The requiredcaption; if null, no particular caption is matched.voidsetClasses(String classes) If not null, the component must match all of these class names.voidsetCount(CountRange count) The expected number of matching components.voidThe requiredComponent.getId(); if null, no particular id is matched.voidsetPlaceholder(String placeholder) The requiredplaceholder; if null, no particular placeholder is matched.voidsetPredicates(List<Predicate<T>> predicates) Extra predicates the component must satisfy, on top of the other rules.voidThe required test id, i.e. thedata-testidattribute; if null, no particular test id is matched.voidThe requiredElement.getText(); if null, no particular text is matched.voidIf not null, the component must have all theme names defined.voidExpectedHasValue.getValue(); ifnull, no particular value is matched.voidsetWithoutClasses(String withoutClasses) If not null, the component must NOT match any of these class names.voidsetWithoutThemes(String withoutThemes) If not null, the component must NOT have any of the theme names defined.Predicate<com.vaadin.flow.component.Component> Returns a predicate which matches components based on this spec.toString()
-
Constructor Details
-
SearchSpec
Creates a search specification which matches all components of given class.- Parameters:
clazz- the class of the component we are searching for.
-
SearchSpec
public SearchSpec(Class<T> clazz, String id, String testId, String caption, String placeholder, String text, CountRange count, Object value, String classes, String withoutClasses, List<Predicate<T>> predicates, String themes, String withoutThemes) Creates a search specification.- Parameters:
clazz- the class of the component we are searching for.id- the requiredComponent.getId(); if null, no particular id is matched.testId- the requiredComponent.getTestId()(i.e. thedata-testidattribute); if null, no particular test id is matched.caption- the required caption; if null, no particular caption is matched.placeholder- the required placeholder; if null, no particular placeholder is matched.text- theElement.getText()count- expected count of matching components, defaults toCountRange.ANYvalue- expectedHasValue.getValue(); ifnull, no particular value is matched.classes- if not null, the component must match all of these class names. Space-separated.withoutClasses- if not null, the component must NOT match any of these class names. Space-separated.predicates- the predicates the component needs to match, not null. May be empty - in such case it is ignored.themes- if not null, the component must have all theme names defined. Space-separatedwithoutThemes- if not null, the component must NOT have any of the theme names defined. Space-separated
-
-
Method Details
-
getClazz
The class of the component we are searching for.- Returns:
- the current value
-
getId
The requiredComponent.getId(); if null, no particular id is matched.- Returns:
- the current value
-
setId
The requiredComponent.getId(); if null, no particular id is matched.- Parameters:
id- the new value
-
getTestId
The required test id, i.e. thedata-testidattribute; if null, no particular test id is matched.- Returns:
- the current value
-
setTestId
The required test id, i.e. thedata-testidattribute; if null, no particular test id is matched.- Parameters:
testId- the new value
-
getCaption
The requiredcaption; if null, no particular caption is matched.- Returns:
- the current value
-
setCaption
The requiredcaption; if null, no particular caption is matched.- Parameters:
caption- the new value
-
getPlaceholder
The requiredplaceholder; if null, no particular placeholder is matched.- Returns:
- the current value
-
setPlaceholder
The requiredplaceholder; if null, no particular placeholder is matched.- Parameters:
placeholder- the new value
-
getText
The requiredElement.getText(); if null, no particular text is matched.- Returns:
- the current value
-
setText
The requiredElement.getText(); if null, no particular text is matched.- Parameters:
text- the new value
-
getCount
The expected number of matching components. Defaults to any number.- Returns:
- the current value, not null
-
setCount
The expected number of matching components. Defaults to any number.- Parameters:
count- the new value, not null
-
getValue
ExpectedHasValue.getValue(); ifnull, no particular value is matched.- Returns:
- the current value
-
setValue
ExpectedHasValue.getValue(); ifnull, no particular value is matched.- Parameters:
value- the new value
-
getClasses
If not null, the component must match all of these class names. Space-separated.- Returns:
- the current value
-
setClasses
If not null, the component must match all of these class names. Space-separated.- Parameters:
classes- the new value
-
getWithoutClasses
If not null, the component must NOT match any of these class names. Space-separated.- Returns:
- the current value
-
setWithoutClasses
If not null, the component must NOT match any of these class names. Space-separated.- Parameters:
withoutClasses- the new value
-
getPredicates
Extra predicates the component must satisfy, on top of the other rules.- Returns:
- the current value
-
setPredicates
Extra predicates the component must satisfy, on top of the other rules.- Parameters:
predicates- the new value
-
getThemes
If not null, the component must have all theme names defined. Space-separated.- Returns:
- the current value
-
setThemes
If not null, the component must have all theme names defined. Space-separated.- Parameters:
themes- the new value
-
getWithoutThemes
If not null, the component must NOT have any of the theme names defined. Space-separated.- Returns:
- the current value
-
setWithoutThemes
If not null, the component must NOT have any of the theme names defined. Space-separated.- Parameters:
withoutThemes- the new value
-
toString
-
captionContains
Makes sure that the component's caption contains givensubstring.- Parameters:
substring- the substring the caption must contain.
-
toPredicate
Returns a predicate which matches components based on this spec. All rules are matched except thecountrule. The rules are matched against given component only (not against its children).- Returns:
- the predicate, not null.
-