nextcloud-android/scripts/androidScreenshotTest
tobiasKaminsky 76c20b22db
Write some UI tests for NotificationsActivity
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
2020-07-28 17:28:11 +02:00

44 lines
981 B
Bash
Executable file

#!/bin/bash
if [ $# -lt 2 ]; then
echo "1: record: true/false
2: class name
3: method name"
exit
fi
cd src/androidTest/java
class=$(find | grep $2 | grep -E "java$|kt$" | head -n1|sed s'/\//\./'g | sed s'#^\.\.##' | sed s'#\.java##'| sed s'#\.kt##')
if [[ -z $class ]]; then
echo "Class not found!"
exit 1
fi
cd ../../../
if [ $1 == "true" ] ; then
record="-Precord"
else
record=""
fi
if [ -e $3 ] ; then
method=""
else
method="#$3"
# check if method exists
if [[ $(grep -c $3 $(find | grep $2 | grep -E "java$|kt$" | head -n1)) -eq 0 ]]; then
echo "Method not found!"
exit 1
fi
fi
./gradlew gplayDebugExecuteScreenshotTests $record \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
-Pandroid.testInstrumentationRunnerArguments.class=$class$method
sed -i s'#<bool name="is_beta">true</bool>#<bool name="is_beta">false</bool>#'g src/main/res/values/setup.xml