forked from bitbar/test-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-tests_android.sh
More file actions
executable file
·55 lines (40 loc) · 1.34 KB
/
run-tests_android.sh
File metadata and controls
executable file
·55 lines (40 loc) · 1.34 KB
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
#!/bin/bash
##
## Work in progress! The dependency installations need to be done to the
## container so that we don't need to install them here.
##
TEST=${TEST:="BitbarSampleAppTest.py"} #Name of the test file
##### Cloud testrun dependencies start
echo "Extracting tests.zip..."
unzip tests.zip
echo "Installing pip for python"
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
echo "Installing Appium Python Client 0.24 and xmlrunner 1.7.7"
chmod 0755 requirements.txt
pip install -r requirements.txt
echo "Starting Appium ..."
appium --log-no-colors --log-timestamp
ps -ef|grep appium
##### Cloud testrun dependencies end.
export APPIUM_APPFILE=$PWD/application.apk #App file is at current working folder
## Desired capabilities:
export APPIUM_URL="http://localhost:4723/wd/hub" # Local & Cloud
export APPIUM_DEVICE="Local Device"
export APPIUM_PLATFORM="android"
APILEVEL=$(adb shell getprop ro.build.version.sdk)
APILEVEL="${APILEVEL//[$'\t\r\n']}"
echo "API level is: ${APILEVEL}"
## APPIUM_AUTOMATION
if [ "$APILEVEL" -gt "16" ]; then
echo "Setting APPIUM_AUTOMATION=Appium"
export APPIUM_AUTOMATION="uiautomator2"
else
echo "Setting APPIUM_AUTOMATION=selendroid"
export APPIUM_AUTOMATION="Selendroid"
fi
## Run the test:
echo "Running test ${TEST}"
rm -rf screenshots
python ${TEST}
mv test-reports/*.xml TEST-all.xml