Moropo
RoadmapTerms
  • Welcome to Moropo
  • Quick Start
  • Uploading your app
    • Producing an Android Build
    • Producing an iOS Build
    • Uploading Your Build To Moropo
  • Creating Tests
    • Using the Test Creator
    • Test Configuration
    • Test Step Commands
      • addMedia
      • assertNotVisible
      • assertTrue
      • assertVisible
      • back (Android only)
      • clearKeychain (iOS Only)
      • clearState
      • copyTextFrom
      • doubleTapOn
      • eraseText
      • evalScript
      • extendedWaitUntil
      • hideKeyboard
      • inputRandomEmail
      • inputRandomNumber
      • inputRandomPersonName
      • inputRandomText
      • inputText
      • launchApp
      • longPressOn
      • openLink
      • pasteText
      • pressKey
      • repeat
      • runFlow
      • runScript
      • scroll
      • scrollUntilVisible
      • setLocation
      • startRecording
      • stopApp
      • stopRecording
      • swipe
      • takeScreenshot
      • tapOn
      • travel
      • waitForAnimationToEnd
    • Test Step Selectors
    • Importing From Maestro
    • Environment Variables
      • ${BUNDLEID}
      • ${EXPORELEASECHANNEL}
      • ${MOROPO_TEST_EMAIL}
      • ${MOROPO_EMAIL_URL}
    • Advanced Use Cases
      • JavaScript
      • Conditionals
      • Network Connection
      • Drag and Drop
  • Running Tests
    • Manually Trigger a Test Run
    • Scheduling a Test Run
    • Tags
    • Supported Devices
    • Test Execution Limits
    • Flakiness Tolerance & Retries
  • CI Integration
    • Initial CI Setup In Moropo
    • GitHub Action
    • Moropo API
      • Branches
      • Builds
      • Test Runs
      • Tests
  • Test Results
    • Results Explorer
    • Slack Reporting
    • Email Reporting
  • App Frameworks
    • Flutter
    • React Native
  • Guides
    • React Native Expo
    • Access Emails During A Test Flow
    • Git workflow using Moropo API
  • Infrastructure
    • IP Addresses
  • Security
    • Services Infrastructure
    • Security Best Practices
Powered by GitBook
On this page
  • when
  • Conditions
  • Supported Commands
  • Example
  • while
  • Conditions
  • Supported Commands
  • Example

Was this helpful?

Edit on GitHub
  1. Creating Tests
  2. Advanced Use Cases

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:

  1. when

  2. while

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:

  1. visible - run the command only when the proceeding selector element is visible

  2. notVisible - run the command only when the proceeding selector element is NOT visible

  3. true - run the command only when the given value is true or not empty

  4. platform - run the command only when the platform is one of android|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:

  • runFlow

  • 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

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:

  1. visible - run the command only while the proceeding selector element is visible

  2. notVisible - run the command only while the proceeding selector element is NOT visible

  3. true - run the command only while the given value is true or not empty

  4. platform - run the command only while the platform is one of android|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:

  • repeat

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 1 year ago

Was this helpful?