Conditionals
Certain commands allow the use of conditional statements to allow the user to execute them only in certain cases.
There are currently two supported conditional statements:
when
whenThe when statement allows a command to be executed only when one, or more, conditional statements are met.
The check for the conditional statement is performed once upon evaluation of the command.
Conditions
when supports four different conditions:
visible- run the command onlywhenthe proceeding selector element is visiblenotVisible- run the command onlywhenthe proceeding selector element is NOT visibletrue- run the command onlywhenthe given value is true or not emptyplatform- run the command onlywhenthe platform is one ofandroid|ios|web
These conditionals can be used individually or combined into a complex statement
Supported Commands
The commands which can take the when statement are as follows:
runScript (not yet supported by Moropo)
Example
simple statement
- runFlow
file: test.yaml
when:
visible:
text: some textcomplex statement
- runFlow
file: test.yaml
when:
visible:
text: some text
notVisible:
text: some different text
true: ${SOME_VARIABLE == 'value'}
platform: ioswhile
whileThe while statement allows a command to be executed only when one, or more, conditional statements are met.
The check for the conditional statement is performed each time the conditional is not satisfied.
Conditions
while supports four different conditions:
visible- run the command onlywhilethe proceeding selector element is visiblenotVisible- run the command onlywhilethe proceeding selector element is NOT visibletrue- run the command onlywhilethe given value is true or not emptyplatform- run the command onlywhilethe platform is one ofandroid|ios|web
These conditionals can be used individually or combined into a complex statement
Supported Commands
The commands which can take the while statement are as follows:
Example
simple statement
- repeat
commands:
- scroll:
direction: DOWN
while:
visible:
text: some textcomplex statement
- repeat
commands:
- scroll:
direction: DOWN
while:
visible:
text: some text
notVisible:
text: some different text
true: ${SOME_VARIABLE == 'value'}
platform: iosLast updated
Was this helpful?