nextcloud-android/scripts/runAllScreenshotCombinations
tobiasKaminsky a506c31f76
use result from combinations
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
2020-11-10 09:10:05 +01:00

47 lines
1.7 KiB
Bash
Executable file

#!/bin/bash
## $1 noCI/stable/master: wether to run deleteOutdatedComments.sh or uploadReport.sh
## $2 true/false: record or verify screenshots
## $3 classMethod: piped from androidScreenshotTest
if [[ $2 = "true" ]]; then
record="-Precord"
else
record=""
fi
classMethod=$3
resultCode=0
while read line
do
darkMode=$(echo "$line" | cut -d" " -f1)
color=$(echo "$line" | cut -d" " -f2)
echo "Run $color on $darkMode mode"
if [[ $1 = "noCI" ]]; then
./gradlew --console plain gplayDebugExecuteScreenshotTests \
$record \
-Pscreenshot=true \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
-Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \
-Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" \
$classMethod </dev/null > /dev/null
if [[ $? -ne 0 ]]; then
exit
fi
else
./gradlew --console plain gplayDebugExecuteScreenshotTests \
$record \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
-Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \
-Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" </dev/null > /dev/null \
&& scripts/deleteOutdatedComments.sh "$1-$darkMode-$color" "Screenshot" "$DRONE_PULL_REQUEST" \
"$GIT_USERNAME" "$GIT_TOKEN" \
|| resultCode=1 && scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$DRONE_BUILD_NUMBER" \
"$1-$darkMode-$color" "Screenshot" "$DRONE_PULL_REQUEST" "$GIT_USERNAME" "$GIT_TOKEN"
fi
done < scripts/screenshotCombinations
exit $resultCode