A collection of predefined matchers. See also sap.ui.test.matchers
Node | Description |
---|
Method | Description |
---|---|
sap.ui.test.OpaBuilder.Matchers.aggregation |
Creates a matcher function that returns all aggregation items fulfilling given matcher(s). The result will always be an array, even if it is a non-multiple aggregation. |
sap.ui.test.OpaBuilder.Matchers.aggregationAtIndex |
Creates a matcher function that returns an aggregation element of a control at a given index. |
sap.ui.test.OpaBuilder.Matchers.aggregationLength |
Creates a sap.ui.test.matchers.AggregationLengthEquals matcher. |
sap.ui.test.OpaBuilder.Matchers.aggregationMatcher |
Checks whether at least one aggregation item fulfills given matcher(s). |
sap.ui.test.OpaBuilder.Matchers.ancestor |
Creates a declarative matcher definition for sap.ui.test.matchers.Ancestor. |
sap.ui.test.OpaBuilder.Matchers.bindingPath |
Creates a sap.ui.test.matchers.BindingPath matcher. |
sap.ui.test.OpaBuilder.Matchers.bindingProperties |
Creates a matcher that checks whether the bound context or model has the given properties. |
sap.ui.test.OpaBuilder.Matchers.children |
Creates a matcher function that returns all children fulfilling given matcher(s). The result will always be an array, even if only one child was found. |
sap.ui.test.OpaBuilder.Matchers.childrenMatcher |
Creates a matcher function that checks whether one children fulfilling given matcher(s). |
sap.ui.test.OpaBuilder.Matchers.conditional |
Creates a matcher that checks states for given conditions. |
sap.ui.test.OpaBuilder.Matchers.customData |
Creates a matcher that checks whether a control has all given custom data. |
sap.ui.test.OpaBuilder.Matchers.descendant |
Creates a declarative matcher definition for sap.ui.test.matchers.Descendant. |
sap.ui.test.OpaBuilder.Matchers.filter |
Creates a matcher that checks all inputs against given matchers. The input can be an array or a single element. The result will always be an array. If the input is a single element, the result will be an array containing the given element (or empty if not matching the matchers). |
sap.ui.test.OpaBuilder.Matchers.focused |
Creates a matcher that checks whether a control has the focus. |
sap.ui.test.OpaBuilder.Matchers.i18n |
Creates a sap.ui.test.matchers.I18NText matcher. |
sap.ui.test.OpaBuilder.Matchers.labelFor |
Creates a sap.ui.test.matchers.LabelFor matcher. |
sap.ui.test.OpaBuilder.Matchers.match |
Creates a matcher that checks a single input against all defined matchers. |
sap.ui.test.OpaBuilder.Matchers.not |
Creates a matcher function which is negating the result of provided matchers. The matcher function returns a boolean value but never a control. Example usage for only matching controls without a certain text: |
sap.ui.test.OpaBuilder.Matchers.properties |
Creates a sap.ui.test.matchers.Properties matcher. |
sap.ui.test.OpaBuilder.Matchers.resourceBundle |
Creates a matcher that validates the given property against a token text of a library message bundle. |
sap.ui.test.OpaBuilder.Matchers.some |
Creates a matcher that checks for at least one successful match from a group of matchers. |
Creates a matcher function that returns all aggregation items fulfilling given matcher(s). The result will always be an array, even if it is a non-multiple aggregation.
Param | Type | DefaultValue | Description |
---|---|---|---|
sAggregationName | string |
the aggregation name |
|
vMatchers | sap.ui.test.matchers.Matcher function Array Object |
the matchers to filter aggregation items |
Creates a matcher function that returns an aggregation element of a control at a given index.
Param | Type | DefaultValue | Description |
---|---|---|---|
sAggregationName | string |
the name of the aggregation that is used for matching |
|
iIndex | int |
the index within the aggregation |
Creates a sap.ui.test.matchers.AggregationLengthEquals matcher.
Param | Type | DefaultValue | Description |
---|---|---|---|
sAggregationName | string |
the name of the aggregation that is used for matching |
|
iLength | int |
the length that aggregation name should have |
Checks whether at least one aggregation item fulfills given matcher(s).
Param | Type | DefaultValue | Description |
---|---|---|---|
sAggregationName | string |
the aggregation name |
|
vMatchers | sap.ui.test.matchers.Matcher function Array Object |
the matchers to filter aggregation items |
Creates a declarative matcher definition for sap.ui.test.matchers.Ancestor.
Param | Type | DefaultValue | Description |
---|---|---|---|
vAncestor | object string |
the ancestor control to check, if undefined, validates every control to true. Can be a control or a control ID |
|
bDirect | boolean |
specifies if the ancestor should be a direct ancestor (parent) |
Creates a sap.ui.test.matchers.BindingPath matcher.
Param | Type | DefaultValue | Description |
---|---|---|---|
sModelPropertyPath | string |
the binding context path (including the model name) that is used for matching |
|
sPropertyPath | string |
the binding property path that is used for matching. If (context) path is also set, propertyPath will be assumed to be relative to the binding context path |
Creates a matcher that checks whether the bound context or model has the given properties.
Param | Type | DefaultValue | Description |
---|---|---|---|
sModelName | string |
the name of the model to get the binding context for |
|
oProperties | object |
the property-path map with expected values |
Creates a matcher function that returns all children fulfilling given matcher(s). The result will always be an array, even if only one child was found.
Param | Type | DefaultValue | Description |
---|---|---|---|
vBuilderOrMatcher | sap.ui.test.matchers.Matcher function Array Object sap.ui.test.OpaBuilder |
the matchers to filter child items |
|
bDirect | boolean |
specifies if the ancestor should be a direct ancestor (parent) |
Creates a matcher function that checks whether one children fulfilling given matcher(s).
Param | Type | DefaultValue | Description |
---|---|---|---|
vBuilderOrMatcher | sap.ui.test.matchers.Matcher function Array Object sap.ui.test.OpaBuilder |
the matchers to filter child items |
|
bDirect | boolean |
specifies if the ancestor should be a direct ancestor (parent) |
Creates a matcher that checks states for given conditions.
Param | Type | DefaultValue | Description |
---|---|---|---|
vConditions | sap.ui.test.matchers.Matcher function Array Object boolean |
conditions to pre-check |
|
vSuccessMatcher | sap.ui.test.matchers.Matcher function Array Object |
actual matcher that is executed if conditions are met |
|
vElseMatcher | sap.ui.test.matchers.Matcher function Array Object |
actual matcher that is executed if conditions are not met |
Creates a matcher that checks whether a control has all given custom data.
Param | Type | DefaultValue | Description |
---|---|---|---|
oCustomData | object |
the map of custom data keys and their values to check against |
Creates a declarative matcher definition for sap.ui.test.matchers.Descendant.
Param | Type | DefaultValue | Description |
---|---|---|---|
vDescendent | object string |
the descendant control to check. If undefined, it validates every control to true. Can be a control or a control ID |
|
bDirect | boolean |
specifies if the descendant should be a direct child |
Creates a matcher that checks all inputs against given matchers. The input can be an array or a single element. The result will always be an array. If the input is a single element, the result will be an array containing the given element (or empty if not matching the matchers).
Param | Type | DefaultValue | Description |
---|---|---|---|
vMatchers | sap.ui.test.matchers.Matcher function Array Object |
the matchers to check all items against |
Creates a matcher that checks whether a control has the focus.
Param | Type | DefaultValue | Description |
---|---|---|---|
bCheckChildren | boolean |
set true to check additionally for the focus on any child element |
Creates a sap.ui.test.matchers.I18NText matcher.
Param | Type | DefaultValue | Description |
---|---|---|---|
sPropertyName | string |
the name of the control property to match the I18N text with |
|
sModelTokenPath | string |
the path to the I18N text. If model is omitted, |
|
aParameters | string[] | [] |
the values to be used instead of the placeholders |
Creates a sap.ui.test.matchers.LabelFor matcher.
Param | Type | DefaultValue | Description |
---|---|---|---|
sPropertyName | string |
the name of the control property to match the I18N text with |
|
bText | boolean |
define whether check is against plain text |
|
sModelTokenPathOrText | string |
the path to the I18N text containing the model name. If |
|
aParameters | any[] | [] |
the values to be used instead of the placeholders in case of I18N texts |
Creates a matcher that checks a single input against all defined matchers.
Param | Type | DefaultValue | Description |
---|---|---|---|
vMatchers | sap.ui.test.matchers.Matcher function Array Object |
the matchers to check all items against |
Creates a matcher function which is negating the result of provided matchers. The matcher function returns a boolean value but never a control.
Example usage for only matching controls without a certain text:
new OpaBuilder().hasType("sap.m.Text").has(
OpaBuilder.Matchers.not(
OpaBuilder.Matchers.properties({ text: "Ignore controls with this text"})
)
);
Param | Type | DefaultValue | Description |
---|---|---|---|
vMatchers | sap.ui.test.matchers.Matcher function Array Object |
the matchers that will actually be executed |
Creates a sap.ui.test.matchers.Properties matcher.
Param | Type | DefaultValue | Description |
---|---|---|---|
oProperties | object |
the object with the properties to be checked |
Creates a matcher that validates the given property against a token text of a library message bundle.
Param | Type | DefaultValue | Description |
---|---|---|---|
sPropertyName | string |
the name of the control property to match the I18N text with |
|
sLibrary | string |
the name of the library to retrieve the resource bundle from |
|
sToken | string |
the text token to validate against |
|
aParameters | string[] | [] |
the values to be used instead of the placeholders |
Creates a matcher that checks for at least one successful match from a group of matchers.
Param | Type | DefaultValue | Description |
---|---|---|---|
aMatchers | sap.ui.test.matchers.Matcher function Array Object | [] |
aMatchers list of matchers were one must be met |