appId: com.toughra.ustadmobile
env:
  TESTRESULTSDIR: "${TESTRESULTSDIR}/005_002_teacher_can_edit_discussion_board"
  TESTNAME:  "005_002_teacher_can_edit_discussion_board"
---
- clearState: com.toughra.ustadmobile
- runFlow:
    file: "../common/startserver.yaml"
    env:
      CONTROLSERVER: ${CONTROLSERVER}
      TESTSERIAL: ${TESTSERIAL}
      TESTNAME: ${TESTNAME}
- runFlow: "../common/clear_state_and_get_started.yaml"
- runFlow: "../common/select_site.yaml"
- runFlow:
    file: "../common/user_login.yaml"
- runFlow:
    file: "../common/create_course_with_1teacher_1student.yaml"
    env:
      TESTCOURSENAME: "Test Course Block"
- runFlow: "../common/clear_state_and_get_started.yaml"
- runFlow: "../common/select_site.yaml"
- runFlow:
    file: "../common/user_login.yaml"
    env:
      USERNAME: "t1"
      PASSWORD: "test"
- tapOn: "Courses"
- tapOn: "Test Course Block"
# edit the course to add blocks
- tapOn:
    id: "floating_action_button"
# add assignment block ------ 1
- scrollUntilVisible:
    element:
      text: "Add block"
    direction: DOWN
- tapOn: "Add block"
- runFlow:
    when:
      notVisible:
        text: "Discussion board"
    commands:
      - swipe:
          from:
            text: "Drag handle"
          direction: UP
- tapOn: "Discussion board"
- tapOn: "Title*"
- inputText: "Discussion 1"
- hideKeyboard
- tapOn: "Description"
- tapOn:
    id: "com.toughra.ustadmobile:id/editor"
- inputText: "test block"
- tapOn: "Done"
- assertVisible:
    id: "app_title"
    text: "Add discussion"
- tapOn: "Done"
- tapOn: "Save"
- scrollUntilVisible:
    element:
      text: "Discussion 1"
    direction: DOWN
- tapOn: "Discussion 1"
- assertVisible:            #  +POST button
    id: "floating_action_button"
- back
- tapOn:            #  Edit button
    id: "floating_action_button"
- scrollUntilVisible:
    element:
      text: "Discussion 1"
    direction: DOWN
- tapOn: "Discussion 1"
- tapOn: "Description"
- tapOn:
    id: "com.toughra.ustadmobile:id/editor"
- inputText: "test block"
- tapOn: "Done"
- assertVisible:
    id: "app_title"
    text: "Edit discussion"
- tapOn: "Done"