appId: world.respect.app
onFlowStart:
  - clearState: world.respect.app
  - runScript:
      file: "scripts/school_init.js"
      env:
        TESTCONTROLLER_URL: ${TESTCONTROLLER_URL}
        SCHOOL_ADMIN_PASSWORD: ${SCHOOL_ADMIN_PASSWORD}
        DIR_ADMIN_AUTH_HEADER: ${DIR_ADMIN_AUTH_HEADER}
        SCHOOL_URL: ${SCHOOL_URL}
        SCHOOL_NAME: ${SCHOOL_NAME}
        URL_SUBSTITUTION: ${URL_SUBSTITUTION}
        NAME: "002_browse_lessons_test"

onFlowComplete:
  - runScript:
      file: "scripts/teardown.js"
---
- runFlow: "subflows/school_admin_login_flow.yaml"

- tapOn:
    id: "floating_action_button"
- tapOn: "Add from Link"
- tapOn: "Link*"
- inputText: "https://respect.world/respect-ds/case_valid/appmanifest.json"
- tapOn: "Next"
- assertVisible:
    id: "app_title"
    text: "App detail"
- assertVisible: "My app"
- assertVisible: "Try it"
- assertVisible: "Add App"
# verify App got added to Apps section
- tapOn: "Add App"
- tapOn: "Apps"
- assertVisible:
    id: "app_title"
    text: "Apps"
- assertVisible: "My app"
- tapOn: "My app"
- assertVisible: "Lessons"
- tapOn: "Lessons"
- tapOn: "Grade 1"
- tapOn: "Lesson 001"
- assertVisible: "Lesson 001"
- assertVisible: "App name"
- tapOn: "Open"
- extendedWaitUntil:
    visible: "Lesson 001"
    timeout: 1000
- assertVisible: "Hello World Lesson"
- tapOn: "Close"


