Skip to content

assertCondition ​

Assert that a visibility or script condition holds.

The assertCondition command checks one or more conditions and fails the step if any of them does not hold. The conditions are the same ones that runFlow accepts in when.

Parameters ​

ParameterTypeDescription
visibleSelectorFails if the element is not visible. See Selectors.
notVisibleSelectorFails if the element is still visible.
trueJavaScript stringFails if the expression is falsy. Write it as ${...}.
platformStringAndroid or iOS. On another platform the step is skipped and counts as passed.
timeoutIntegerMilliseconds to wait for visible and notVisible. If missing, the selector's own timeout is used, otherwise there is no extra wait.

When you set several conditions, they are checked in the order visible, notVisible, true.

Usage examples ​

yaml
- assertCondition:
    visible: "Welcome"
    timeout: 5000
yaml
- assertCondition:
    notVisible: "Loading…"
    true: ${output.count > 0}

Run the check only on Android:

yaml
- assertCondition:
    platform: Android
    visible:
      id: "toolbar"