appId: ${APP_ID}
# If the flow is interrupted, restore the network connection
onFlowComplete:
  - setAirplaneMode: disabled
---
# Send offilne message - assumes user is already in a chat conversation
# Note: This fragment only runs on Android
- runFlow:
    when:
      platform: android
    commands:
      - setAirplaneMode: enabled
      - extendedWaitUntil:
          visible: Waiting for network...
          timeout: 15000

      # Send offline message
      - tapOn: 'Write a message...'
      - inputText: Offline message
      - tapOn: Send
      - runScript: ../scripts/getTime.js
      - assertVisible: 'You, Offline message, ${output.time}, Sending'

      # Restore network connection
      - setAirplaneMode: disabled
      - extendedWaitUntil:
          notVisible: Waiting for network...
          timeout: 15000
      - waitForAnimationToEnd:
          timeout: 3000

      # Assert message was sent
      - extendedWaitUntil:
          visible: You, Offline message,.*, Sent
          timeout: 25000
