To assert whether an element is visible, use the following command that takes the same parameters as tapOn
- assertVisible:
# Same exact parameters as in tapOn or any other command that uses selectors
This command will wait for view to appear if it is not visible yet.
You are most likely going to be using the following properties, but please refer to the Selectors page for an exhaustive list of all available selectors:
text
- text in a viewid
- id of a viewenabled
-true
if view is enabledchecked
-true
if view is checkedfocused
-true
if view has keyboard focusselected
-true
if view is selected
To check whether view with a text My Button
is visible you can run the following command:
- assertVisible: "My Button"
To check whether view with a text My Button
is visible and enabled you can run the following command:
- assertVisible:
text: "My Button"
enabled: true
Such test will fail if either
- There is no button with such text
- There is a button but it is disabled
{% content-ref url="assertnotvisible.md" %} assertnotvisible.md {% endcontent-ref %}
{% content-ref url="asserttrue.md" %} asserttrue.md {% endcontent-ref %}