forked from nextcloud/android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunAllScreenshotCombinations
executable file
·57 lines (47 loc) · 2.07 KB
/
runAllScreenshotCombinations
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
## $1 noCI/stable/master: wether to run deleteOldComments.sh or uploadReport.sh
## $2 true/false: record or verify screenshots
## $3 classMethod: piped from androidScreenshotTest
## $4 github event number
sed -i s'#<bool name="is_beta">false</bool>#<bool name="is_beta">true</bool>#'g app/src/main/res/values/setup.xml
if [[ $2 = "true" ]]; then
record="-Precord"
else
record=""
fi
classMethod=$3
resultCode=0
grep -v "#" scripts/screenshotCombinations | while read line
do
darkMode=$(echo "$line" | cut -d" " -f1)
color=$(echo "$line" | cut -d" " -f2)
echo -n "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
echo " failed!"
else
echo
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/deleteOldComments.sh "$1-$darkMode-$color" "Screenshot" "$4" \
|| resultCode=1 && scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$4" \
"$1-$darkMode-$color" "Screenshot" "$4"
fi
done
sed -i s'#<bool name="is_beta">true</bool>#<bool name="is_beta">false</bool>#'g app/src/main/res/values/setup.xml
exit $resultCode