-
public interface NodeAssertions
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumNodeAssertions.ComposeBaseAssertionType
-
Method Summary
Modifier and Type Method Description UnitassertIsDisplayed()UnitassertIsNotDisplayed()Asserts that the current semantics node is not displayed on screen. UnitassertIsEnabled()Asserts that the current semantics node is enabled. UnitassertIsNotEnabled()Asserts that the current semantics node is not enabled. UnitassertIsOn()Asserts that the current semantics node is checked. UnitassertIsOff()Asserts that the current semantics node is unchecked. UnitassertIsSelected()Asserts that the current semantics node is selected. UnitassertIsNotSelected()Asserts that the current semantics node is not selected. UnitassertIsToggleable()Asserts that the current semantics node is toggleable. UnitassertIsSelectable()Asserts that the current semantics node is selectable. UnitassertIsFocused()Asserts that the current semantics node has a focus. UnitassertIsNotFocused()Asserts that the current semantics node does not have a focus. UnitassertContentDescriptionEquals(String values)Asserts that the node's content description contains exactly the given values and nothing else. UnitassertContentDescriptionContains(String value, Boolean substring, Boolean ignoreCase)Asserts that the node's content description contains the given value. UnitassertTextEquals(String values, Boolean includeEditableText)Asserts that the node's text contains exactly the given values and nothing else. UnitassertTextContains(String value, Boolean substring, Boolean ignoreCase)Asserts that the node's text contains the given value. UnitassertValueEquals(String value)Asserts the node's value equals the given value. UnitassertRangeInfoEquals(ProgressBarRangeInfo value)Asserts the node's range info equals the given value. UnitassertHasClickAction()Asserts that the current semantics node has a click action. UnitassertHasNoClickAction()Asserts that the current semantics node has doesn't have a click action. UnitassertDoesNotExist()Asserts that no item was found or that the item is no longer in the hierarchy. UnitassertExists(String errorMessageOnFail)Asserts that the component was found and is part of the component tree. Unitassert(SemanticsMatcher matcher, Function0<String> messagePrefixOnError)Asserts that the provided matcher is satisfied for this node. abstract ComposeDelegategetDelegate()-
-
Method Detail
-
assertIsDisplayed
Unit assertIsDisplayed()
-
assertIsNotDisplayed
Unit assertIsNotDisplayed()
Asserts that the current semantics node is not displayed on screen.
Throws AssertionError if the node is displayed.
-
assertIsEnabled
Unit assertIsEnabled()
Asserts that the current semantics node is enabled.
Throws AssertionError if the node is not enabled or does not define the property at all.
-
assertIsNotEnabled
Unit assertIsNotEnabled()
Asserts that the current semantics node is not enabled.
Throws AssertionError if the node is enabled or does not defined the property at all.
-
assertIsOn
Unit assertIsOn()
Asserts that the current semantics node is checked.
Throws AssertionError if the node is not unchecked, indeterminate, or not toggleable.
-
assertIsOff
Unit assertIsOff()
Asserts that the current semantics node is unchecked.
Throws AssertionError if the node is checked, indeterminate, or not toggleable.
-
assertIsSelected
Unit assertIsSelected()
Asserts that the current semantics node is selected.
Throws AssertionError if the node is unselected or not selectable.
-
assertIsNotSelected
Unit assertIsNotSelected()
Asserts that the current semantics node is not selected.
Throws AssertionError if the node is selected or not selectable.
-
assertIsToggleable
Unit assertIsToggleable()
Asserts that the current semantics node is toggleable.
Throws AssertionError if the node is not toggleable.
-
assertIsSelectable
Unit assertIsSelectable()
Asserts that the current semantics node is selectable.
Throws AssertionError if the node is not selectable.
-
assertIsFocused
Unit assertIsFocused()
Asserts that the current semantics node has a focus.
Throws AssertionError if the node is not in the focus or does not defined the property at all.
-
assertIsNotFocused
Unit assertIsNotFocused()
Asserts that the current semantics node does not have a focus.
Throws AssertionError if the node is in the focus or does not defined the property at all.
-
assertContentDescriptionEquals
Unit assertContentDescriptionEquals(String values)
Asserts that the node's content description contains exactly the given values and nothing else.
Note that in merged semantics tree there can be a list of content descriptions that got merged from the child nodes. Typically an accessibility tooling will decide based on its heuristics which ones to announce.
Throws AssertionError if the node's descriptions don't contain all items from values, or if the descriptions contain extra items that are not in values.
- Parameters:
values- List of values to match (the order does not matter)
-
assertContentDescriptionContains
Unit assertContentDescriptionContains(String value, Boolean substring, Boolean ignoreCase)
Asserts that the node's content description contains the given value.
Note that in merged semantics tree there can be a list of content descriptions that got merged from the child nodes. Typically an accessibility tooling will decide based on its heuristics which ones to announce.
Throws AssertionError if the node's value does not contain
value, or if the node has no value- Parameters:
value- Value to match as one of the items in the list of content descriptions.substring- Whether this can be satisfied as a substring match of an item in the list of descriptions.ignoreCase- Whether case should be ignored.
-
assertTextEquals
Unit assertTextEquals(String values, Boolean includeEditableText)
Asserts that the node's text contains exactly the given values and nothing else.
This will also search in SemanticsProperties.EditableText by default.
Note that in merged semantics tree there can be a list of text items that got merged from the child nodes. Typically an accessibility tooling will decide based on its heuristics which ones to use.
Throws AssertionError if the node's text values don't contain all items from values, or if the text values contain extra items that are not in values.
- Parameters:
values- List of values to match (the order does not matter)includeEditableText- Whether to also assert against the editable text.
-
assertTextContains
Unit assertTextContains(String value, Boolean substring, Boolean ignoreCase)
Asserts that the node's text contains the given value.
This will also search in SemanticsProperties.EditableText.
Note that in merged semantics tree there can be a list of text items that got merged from the child nodes. Typically an accessibility tooling will decide based on its heuristics which ones to use.
Throws AssertionError if the node's value does not contain
value, or if the node has no value- Parameters:
value- Value to match as one of the items in the list of text values.substring- Whether this can be satisfied as a substring match of an item in the list of text.ignoreCase- Whether case should be ignored.
-
assertValueEquals
Unit assertValueEquals(String value)
Asserts the node's value equals the given value.
For further details please check SemanticsProperties.StateDescription. Throws AssertionError if the node's value is not equal to
value, or if the node has no value
-
assertRangeInfoEquals
Unit assertRangeInfoEquals(ProgressBarRangeInfo value)
Asserts the node's range info equals the given value.
For further details please check SemanticsProperties.ProgressBarRangeInfo. Throws AssertionError if the node's value is not equal to
value, or if the node has no value
-
assertHasClickAction
Unit assertHasClickAction()
Asserts that the current semantics node has a click action.
Throws AssertionError if the node is doesn't have a click action.
-
assertHasNoClickAction
Unit assertHasNoClickAction()
Asserts that the current semantics node has doesn't have a click action.
Throws AssertionError if the node has a click action.
-
assertDoesNotExist
Unit assertDoesNotExist()
Asserts that no item was found or that the item is no longer in the hierarchy.
This will synchronize with the UI and fetch all the nodes again to ensure it has latest data.
-
assertExists
Unit assertExists(String errorMessageOnFail)
Asserts that the component was found and is part of the component tree.
This will synchronize with the UI and fetch all the nodes again to ensure it has latest data. If you are using fetchSemanticsNode you don't need to call this. In fact you would just introduce additional overhead.
- Parameters:
errorMessageOnFail- Error message prefix to be added to the message in case this asserts fails.
-
assert
Unit assert(SemanticsMatcher matcher, Function0<String> messagePrefixOnError)
Asserts that the provided matcher is satisfied for this node.
- Parameters:
matcher- Matcher to verify.messagePrefixOnError- Prefix to be put in front of an error that gets thrown in case this assert fails.
-
getDelegate
abstract ComposeDelegate getDelegate()
-
-
-
-