runAllScreenshotCombinations 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. if [[ $2 = "true" ]]; then
  6. record="-Precord"
  7. else
  8. record=""
  9. fi
  10. classMethod=$3
  11. while read line
  12. do
  13. darkMode=$(echo "$line" | cut -d" " -f1)
  14. color=$(echo "$line" | cut -d" " -f2)
  15. echo "Run $color on $darkMode mode"
  16. if [[ $1 = "noCI" ]]; then
  17. ./gradlew --console plain gplayDebugExecuteScreenshotTests \
  18. $record \
  19. -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
  20. -Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \
  21. -Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" \
  22. $classMethod </dev/null > /dev/null
  23. if [[ $? -ne 0 ]]; then
  24. exit
  25. fi
  26. else
  27. ./gradlew gplayDebugExecuteScreenshotTests \
  28. $record \
  29. -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
  30. -Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \
  31. -Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" \
  32. && scripts/deleteOutdatedComments.sh "$1-$darkMode-$color" "Screenshot" "$DRONE_PULL_REQUEST" \
  33. "$GIT_USERNAME" "$GIT_TOKEN" \
  34. || scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$DRONE_BUILD_NUMBER" \
  35. "$1-$darkMode-$color" "Screenshot" "$DRONE_PULL_REQUEST" "$GIT_USERNAME" "$GIT_TOKEN"
  36. fi
  37. done < scripts/screenshotCombinations