appId: ${APP_ID}
---
# Navigate from Learning home to the Sessions list, exercise both tabs,
# and confirm the target session is reachable.
- scrollUntilVisible:
    element: 'Your sessions'
    direction: DOWN
# "View all" index 2 = Sessions (see courses.yml for ordering note).
- tapOn:
    text: 'View all'
    index: 2
- assertVisible: Sessions

# Upcoming tab (default)
- assertVisible: 'Upcoming'
- tapOn: 'Upcoming'

# Finished tab
- assertVisible: 'Finished'
- tapOn: 'Finished'

# The session may live in Upcoming or Finished. Try Upcoming first;
# if not found after waiting, switch to Finished.
- assertVisible: 'Upcoming'
- tapOn: 'Upcoming'
- waitForAnimationToEnd:
    timeout: 3000
- runFlow:
    when:
      notVisible:
        text: '.*${SESSION_NAME}.*'
    commands:
      - assertVisible: 'Finished'
      - tapOn: 'Finished'
      - extendedWaitUntil:
          visible:
            text: '.*${SESSION_NAME}.*'
          timeout: 13000
