Conditional Blocks

Conditional Blocks enable Drizz tests to intelligently adapt to multiple possible UI states during execution. Many real-world applications present dynamic or variant screens—such as optional popups, different onboarding flows, or context-specific layouts. Drizz’s IF / ELSE IF / ELSE structure ensures the test selects the correct action at runtime based on actual UI visibility, allowing a single test to handle multiple variations reliably. This mechanism increases test resilience, reduces branching test files, and ensures deterministic behavior across unpredictable UI paths.

When a screen can appear in multiple possible states, Drizz allows chaining conditions using:

  • IF → primary condition

  • ELSE IF → one or more intermediate conditions

  • ELSE → final fallback when none of the above match

This structure is used when the app may atleast 2 or more UI variations and the test must reliably choose the correct action each time.

CASE 1: Having exact 2 variation condition

Structure:

IF "<condition>"
{
    <commands when true>
}
ELSE
{
    <commands when false>
}

Example

IF "Profile" icon is visible
{
    Tap on "Profile" icon
}
ELSE
{
    Tap on "Hamburger" menu
}
END IF

CASE 2: Having more than 2 variation condition

Structure:

Example:

Last updated

Was this helpful?