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
when
The 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 onlywhen
the proceeding selector element is visiblenotVisible
- run the command onlywhen
the proceeding selector element is NOT visibletrue
- run the command onlywhen
the given value is true or not emptyplatform
- run the command onlywhen
the 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 text
complex statement
- runFlow
file: test.yaml
when:
visible:
text: some text
notVisible:
text: some different text
true: ${SOME_VARIABLE == 'value'}
platform: ios
while
while
The 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 onlywhile
the proceeding selector element is visiblenotVisible
- run the command onlywhile
the proceeding selector element is NOT visibletrue
- run the command onlywhile
the given value is true or not emptyplatform
- run the command onlywhile
the 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 text
complex statement
- repeat
commands:
- scroll:
direction: DOWN
while:
visible:
text: some text
notVisible:
text: some different text
true: ${SOME_VARIABLE == 'value'}
platform: ios
Last updated
Was this helpful?