appId: ${APP_ID}
env:
  USERNAME: john.doe@example.com
  MODULE_NAME: Time off
---
- runFlow: ../navigate-to-module.yml
- assertVisible: .*See more*
- tapOn: .*See more*
- assertVisible: .*Special leave.*
- tapOn: .*Special leave.*
- assertVisible: .*Special leave.*
- assertVisible: .*Balance detail.*
- assertVisible: .*Policy description.*
- tapOn: .*Policy description.*
- tapOn: .*Close.*
- waitForAnimationToEnd:
    timeout: 1000
- tapOn: .*Request.*
- assertVisible: .*Request.*
- assertVisible: .*What type of request?.*
- assertVisible: .*How much time are you going to request?.*
- tapOn: .*Request Duration*
- waitForAnimationToEnd:
    timeout: 1000
- tapOn: .*More than a day*
- waitForAnimationToEnd:
    timeout: 1000
- assertVisible: .*Since when?.*
- assertVisible: .*Select the first day of your leave.*
- tapOn: .*MM/DD/YYYY.*
- runScript: ../scripts/getSpecialLeaveStartDate.js
- runFlow:
    when:
      true: ${output.startDateNeedsNextMonth}
    commands:
      - tapOn: Next
- tapOn: ${output.startDate}
- tapOn: .*Apply*
- waitForAnimationToEnd:
    timeout: 1000
- assertVisible: .*Until when?.*
- assertVisible: .*Select the last day of your leave.*
- tapOn: .*MM/DD/YYYY.*
- runScript: ../scripts/getSpecialLeaveEndDate.js
- runFlow:
    when:
      true: ${output.endDateNeedsNextMonth}
    commands:
      - tapOn: Next
- tapOn: ${output.endDate}
- tapOn: .*Apply*
- waitForAnimationToEnd:
    timeout: 1000
- scrollUntilVisible:
    element: .*Enter a description.*
- tapOn: .*Enter a description.*
- inputText: .*Test description.*
- tapOn: .*Done*
- waitForAnimationToEnd:
    timeout: 1000
- scrollUntilVisible:
    element: .*Upload file.*
- assertVisible: .*Documentation.*
- assertVisible: .*Provide an attached file.*
- assertVisible: .*Choose a file.*
- assertVisible:
    text: '.*Allowed formats: PDF, JPG or PNG up to 100 MB.*'
- assertVisible: .*Upload file.*
- runFlow: ../upload-file.yml
- waitForAnimationToEnd:
    timeout: 3000
- scrollUntilVisible:
    element: .*[a-zA-Z0-9]{4,}\.(jpeg|jpg|png|pdf).*
- assertVisible: .*[a-zA-Z0-9]{4,}\.(jpeg|jpg|png|pdf).*
- scrollUntilVisible:
    element: .*You are requesting.*
- assertVisible: .*You are requesting.*
- runFlow: ../submit-request-form.yml
