appId: com.toughra.ustadmobile
env:
  TESTRESULTSDIR: "build/reports/maestro/012_001_user_generate_report/Screenshots"
onFlowStart:
  - startRecording: 012_001_user_generate_report
  - 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}
---
- runScript:
    file: "common/import_users_via_http.js"
    env:
      TESTCONTROLLER_URL: ${TESTCONTROLLER_URL}
      IMPORT_FROM_CSV_FILE: "Ustad_Teacher_and_Students.csv"

# Add data to generate report ---------pending

# verify teacher able to generate Report
- runFlow: "common/clear_state_and_get_started.yaml"
- runFlow: "common/select_site.yaml"
- runFlow:
    file: "common/user_login.yaml"
    env:
      USERNAME: "teach1"
      PASSWORD: "testt1"
- tapOn: "Reports"
- tapOn:
    id: "floating_action_button"      #    +Report button
- tapOn: "Title*"
- inputText: "Test Report"
- tapOn: "Time range*"
- tapOn: "Custom period (e.g. last x days/weeks)"
- tapOn: "X Axis*"
- tapOn: "Day"
- tapOn: "Series Title*"
- inputText: "Usage time by day this week"
- hideKeyboard
- tapOn: "Y Axis*"
- tapOn: "Total Duration"
- tapOn: "Subgroup by"
- tapOn: "Gender"
- tapOn: "Chart type"
- tapOn: "Bar Chart"
- tapOn: "Done"
- tapOn:
    id: "floating_action_button"
- scrollUntilVisible:
    element:
      text: "Add filter"
    direction: DOWN
- tapOn: "Add filter"
- tapOn: "Field*"
- tapOn: "Person age"
- tapOn: "Condition*"
- tapOn: "Greater"
- tapOn: "Value*"
- inputText: "13"
- tapOn: "Done"
- tapOn: "Done"
- takeScreenshot: "${TESTRESULTSDIR}/bar_chart_graph_report"
- tapOn: "Reports"
- assertVisible: "Test Report"
- tapOn: "Test Report"
- tapOn:
    id: "floating_action_button"
- tapOn: "Time range*"
- tapOn: "Custom date range"
- tapOn:
    text: "dd/mm/yyyy"
    index: 0
- runScript:
    file: "common/setDate.js"
- inputText: ${output.yesterdayDate}
- tapOn: "dd/mm/yyyy"
- runScript:
    file: "common/setDate.js"
- inputText: ${output.currentDate}
- scrollUntilVisible:
    element:
      text: "Chart type"
    direction: DOWN
- tapOn: "Chart type"
- tapOn: "Line Chart"
- tapOn: "Done"
#- assertVisible: "SHARE"
#- assertVisible: "EXPORT DATA"
- takeScreenshot: "${TESTRESULTSDIR}/line_chart_graph_report"
