appId: com.toughra.ustadmobile

---
# This test tests the Library page of app adding content
# Test parameters needs to provide for this test :
 # 1) TESTFILENAME : provide the content name inside the 'test-files/content' folder
 # 2) TESTCONTENTNAME : provide the content title, it should be a string
 # 3) CONTROLSERVER: ${CONTROLSERVER} : provides the test-control-server address
 # 4) TESTSERIAL: ${TESTSERIAL} : provides the device serial number
 # 5) TESTRESULTSDIR : ${TESTRESULTSDIR} : provides the path to store test results

# clear the app
- clearState: com.toughra.ustadmobile
# clear the downloads
- evalScript: ${http.get(CONTROLSERVER + "cleardownloads?device=" + TESTSERIAL)}
# push the test file to the downloads
- evalScript: ${http.get(CONTROLSERVER + "pushcontent?test-file-name=" + TESTFILENAME +"&device=" + TESTSERIAL)}
# get started
- launchApp
- hideKeyboard
- tapOn: "GET STARTED"
# select site
- runFlow: "./select_site.yaml"
# admin login
- runFlow:
    file: "./user_login.yaml"
# adding content to library
- tapOn: "Library"
- tapOn: "CONTENT"
- tapOn: "Add file"
- runFlow:
    when:
      notVisible: "Downloads"
    file: redirect_to_downloads.yaml
- tapOn: ${TESTFILENAME}
  # id is  used for content title , text is not used because it keeps on changing
- tapOn:
    id: "com.toughra.ustadmobile:id/entry_title_text"
- longPressOn:
   id: "com.toughra.ustadmobile:id/entry_title_text"
- runFlow:
    when:
      visible: "Select all"
    file: redirect_to_select.yaml
- runFlow:
    when:
      visible:
        text: "More options"
    file: moreOptions.yaml
- eraseText
- inputText: ${TESTCONTENTNAME}
- hideKeyboard
- tapOn: "SAVE"
- runFlow:
    when:
      visible: "Allow Ustad Mobile to send you notifications?"
    file: dismiss_notification.yaml
- tapOn:
    text: ${TESTCONTENTNAME}
- extendedWaitUntil:
    visible: "Delete"
    timeout: 600000
- takeScreenshot: "${TESTRESULTSDIR}/screenshots/content_add_to_library"