2020-07-17 08:47:59 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ $# -lt 2 ]; then
|
|
|
|
echo "1: record: true/false
|
|
|
|
2: class name
|
2020-07-17 10:38:32 +03:00
|
|
|
3: method name"
|
|
|
|
|
2020-07-17 08:47:59 +03:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd src/androidTest/java
|
|
|
|
|
2020-07-28 14:17:34 +03:00
|
|
|
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
|
2020-07-17 08:47:59 +03:00
|
|
|
|
|
|
|
cd ../../../
|
|
|
|
|
|
|
|
if [ $1 == "true" ] ; then
|
|
|
|
record="-Precord"
|
2020-07-17 10:38:32 +03:00
|
|
|
else
|
2020-07-17 08:47:59 +03:00
|
|
|
record=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -e $3 ] ; then
|
|
|
|
method=""
|
|
|
|
else
|
|
|
|
method="#$3"
|
2020-07-28 14:17:34 +03:00
|
|
|
|
|
|
|
# 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
|
2020-07-17 08:47:59 +03:00
|
|
|
fi
|
|
|
|
|
2020-07-17 10:38:32 +03:00
|
|
|
./gradlew gplayDebugExecuteScreenshotTests $record \
|
|
|
|
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
|
|
|
|
-Pandroid.testInstrumentationRunnerArguments.class=$class$method
|
2020-07-17 08:47:59 +03:00
|
|
|
|
|
|
|
sed -i s'#<bool name="is_beta">true</bool>#<bool name="is_beta">false</bool>#'g src/main/res/values/setup.xml
|