runAllScreenshotCombinations 1.7 KB

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