runAllScreenshotCombinations 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. ## $1 noCI/stable/master: wether to run deleteOutdatedComments.sh or uploadReport.sh
  3. ## $2 true/false: record or verify screenshots
  4. ## $3 classMethod: piped from androidScreenshotTest
  5. ## $4 github event number
  6. if [[ $2 = "true" ]]; then
  7. record="-Precord"
  8. else
  9. record=""
  10. fi
  11. classMethod=$3
  12. resultCode=0
  13. while read line
  14. do
  15. darkMode=$(echo "$line" | cut -d" " -f1)
  16. color=$(echo "$line" | cut -d" " -f2)
  17. echo "Run $color on $darkMode mode"
  18. if [[ $1 = "noCI" ]]; then
  19. ./gradlew --console plain gplayDebugExecuteScreenshotTests \
  20. $record \
  21. -Pscreenshot=true \
  22. -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
  23. -Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \
  24. -Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" \
  25. $classMethod </dev/null > /dev/null
  26. if [[ $? -ne 0 ]]; then
  27. exit
  28. fi
  29. else
  30. ./gradlew --console plain gplayDebugExecuteScreenshotTests \
  31. $record \
  32. -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
  33. -Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \
  34. -Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" </dev/null > /dev/null \
  35. && scripts/deleteOutdatedComments.sh "$1-$darkMode-$color" "Screenshot" "$4" \
  36. "$GIT_USERNAME" "$GIT_TOKEN" \
  37. || resultCode=1 && scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$4" \
  38. "$1-$darkMode-$color" "Screenshot" "$4" "$GIT_USERNAME" "$GIT_TOKEN"
  39. fi
  40. done < scripts/screenshotCombinations
  41. exit $resultCode