2020-07-28 23:14:14 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-09-28 16:45:35 +03:00
|
|
|
## $1 noCI/stable/master: wether to run deleteOldComments.sh or uploadReport.sh
|
2020-07-28 23:14:14 +03:00
|
|
|
## $2 true/false: record or verify screenshots
|
|
|
|
## $3 classMethod: piped from androidScreenshotTest
|
2020-09-25 12:53:09 +03:00
|
|
|
## $4 github event number
|
2020-07-28 23:14:14 +03:00
|
|
|
|
2022-03-11 13:32:01 +03:00
|
|
|
sed -i s'#<bool name="is_beta">false</bool>#<bool name="is_beta">true</bool>#'g app/src/main/res/values/setup.xml
|
2020-08-05 16:36:48 +03:00
|
|
|
|
2020-07-28 23:14:14 +03:00
|
|
|
if [[ $2 = "true" ]]; then
|
|
|
|
record="-Precord"
|
|
|
|
else
|
|
|
|
record=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
classMethod=$3
|
|
|
|
|
2020-11-10 10:21:45 +03:00
|
|
|
resultCode=0
|
2021-07-15 10:00:38 +03:00
|
|
|
grep -v "#" scripts/screenshotCombinations | while read line
|
2020-07-28 23:14:14 +03:00
|
|
|
do
|
|
|
|
darkMode=$(echo "$line" | cut -d" " -f1)
|
|
|
|
color=$(echo "$line" | cut -d" " -f2)
|
|
|
|
|
2021-07-15 10:00:38 +03:00
|
|
|
echo -n "Run $color on $darkMode mode"
|
2020-07-28 23:14:14 +03:00
|
|
|
|
|
|
|
if [[ $1 = "noCI" ]]; then
|
|
|
|
./gradlew --console plain gplayDebugExecuteScreenshotTests \
|
|
|
|
$record \
|
2020-11-04 14:42:11 +03:00
|
|
|
-Pscreenshot=true \
|
2020-07-28 23:14:14 +03:00
|
|
|
-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
|
2021-07-15 10:00:38 +03:00
|
|
|
echo " failed!"
|
|
|
|
else
|
|
|
|
echo
|
2020-07-28 23:14:14 +03:00
|
|
|
fi
|
|
|
|
else
|
2020-07-29 13:04:44 +03:00
|
|
|
./gradlew --console plain gplayDebugExecuteScreenshotTests \
|
2020-07-28 23:14:14 +03:00
|
|
|
$record \
|
|
|
|
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
|
|
|
|
-Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \
|
2020-07-29 13:04:44 +03:00
|
|
|
-Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" </dev/null > /dev/null \
|
2021-09-28 16:45:35 +03:00
|
|
|
&& scripts/deleteOldComments.sh "$1-$darkMode-$color" "Screenshot" "$4" "$GIT_TOKEN" \
|
2020-09-25 12:53:09 +03:00
|
|
|
|| resultCode=1 && scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$4" \
|
2021-09-06 12:29:03 +03:00
|
|
|
"$1-$darkMode-$color" "Screenshot" "$4" "$GIT_TOKEN"
|
2020-07-28 23:14:14 +03:00
|
|
|
fi
|
2021-07-15 10:00:38 +03:00
|
|
|
done
|
2020-11-10 10:21:45 +03:00
|
|
|
|
2022-03-11 13:32:01 +03:00
|
|
|
sed -i s'#<bool name="is_beta">true</bool>#<bool name="is_beta">false</bool>#'g app/src/main/res/values/setup.xml
|
2020-08-05 16:36:48 +03:00
|
|
|
|
2020-11-10 10:21:45 +03:00
|
|
|
exit $resultCode
|