appId: com.toughra.ustadmobile
tags:
  - discussionBoard
env:
  TESTRESULTSDIR: "build/reports/maestro/005_001_add_discussionBoard/Screenshots"
onFlowStart:
  - startRecording: 005_001_add_discussionBoard
  - runScript:
      file: "common/startserver.js"
      env:
        TESTCONTROLLER_URL: ${TESTCONTROLLER_URL}
  - clearState: com.toughra.ustadmobile
onFlowComplete:
  - stopRecording
  - runScript:
      file: "common/stopserver.js"
      env:
        TESTCONTROLLER_URL: ${TESTCONTROLLER_URL}
---
# Add students to the course through bulk import using .csv file
- runScript:
    file: "common/import_users_via_http.js"
    env:
      TESTCONTROLLER_URL: ${TESTCONTROLLER_URL}
      IMPORT_FROM_CSV_FILE: "Ustad_Teacher_and_Students.csv"
- runFlow: "common/clear_state_and_learning_space_existing_userflow.yaml"
- runFlow: "common/select_site.yaml"
- runFlow:
    file: "common/user_login.yaml"
    env:
      USERNAME: "teach1"
      PASSWORD: "testt1"
- 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
# verify title is mandatory for discussion board
- tapOn: "Discussion board"
- tapOn: "Title*"
- tapOn: "Done"
- assertNotVisible:
    text: "Add block"
- tapOn: "Title*"
- inputText: "Discussion 1"
- hideKeyboard
- tapOn: "Description"
- tapOn:
    id: "com.toughra.ustadmobile:id/editor"
- inputText: "test block"
- tapOn: "Done"
- tapOn: "Done"
- tapOn: "Save"
- scrollUntilVisible:
    element:
      text: "Discussion 1"
    direction: DOWN
- tapOn: "Discussion 1"
- assertVisible:            #  +POST button
    id: "floating_action_button"
- back
# verify teacher able to edit the discussion board
- 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"
- tapOn: "Save"
