-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.sh
executable file
·26 lines (20 loc) · 1.18 KB
/
tests.sh
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
#!/usr/bin/env bash
# ./gradlew :app:connectedDebugAndroidTest runs test differently than Android Studio.
# This script runs the same commands as Android Studio and seems to behave more predictably.
adb uninstall host.exp.exponent.test
# Clear logs
adb logcat -c
./gradlew :app:assembleDebugAndroidTest
adb push app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk /data/local/tmp/host.exp.exponent.test
adb shell pm install -r "/data/local/tmp/host.exp.exponent.test"
adb shell pm revoke "host.exp.exponent" android.permission.READ_CONTACTS
adb shell pm revoke "host.exp.exponent" android.permission.READ_EXTERNAL_STORAGE
adb shell pm revoke "host.exp.exponent" android.permission.WRITE_EXTERNAL_STORAGE
adb shell pm revoke "host.exp.exponent" android.permission.CAMERA
adb shell pm revoke "host.exp.exponent" android.permission.ACCESS_COARSE_LOCATION
adb shell pm revoke "host.exp.exponent" android.permission.ACCESS_FINE_LOCATION
# Run the tests and grab the logs even if it fails
adb shell am instrument -w -r -e debug false host.exp.exponent.test/android.support.test.runner.AndroidJUnitRunner
ANDROID_TEST_RESULT=$?
adb logcat -d > logcat.txt && adb logcat -c
exit $ANDROID_TEST_RESULT