Skip to content

Commit c47c953

Browse files
authored
Create firebase_test.sh
1 parent d134aca commit c47c953

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

content/firebase_test.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
3+
while [[ $# -gt 1 ]]; do
4+
case $1 in
5+
-h|--help)
6+
# show help
7+
echo "Showing help"
8+
exit 0
9+
;;
10+
-d|--devices)
11+
DEVICES="$2"
12+
shift # past argument
13+
;;
14+
-s|--sdks)
15+
SDKS="$2"
16+
shift # past argument
17+
;;
18+
-l|--locales)
19+
LOCALES="$2"
20+
shift # past argument
21+
;;
22+
-p|--project)
23+
PROJECT="$2"
24+
shift # past argument
25+
;;
26+
-o|--orientations)
27+
ORIENTATIONS="$2"
28+
shift # past argument
29+
;;
30+
-r|--apk-release-path)
31+
PROD_APK_PATH="$2"
32+
shift # past argument
33+
;;
34+
-t|--apk-test-path)
35+
TEST_APK_PATH="$2"
36+
shift # past argument
37+
;;
38+
esac
39+
shift # past argument or value
40+
done
41+
42+
PROJECT="${PROJECT-""}"
43+
DEVICES="${DEVICES-"Nexus5"}"
44+
SDKS="${SDKS-"23"}"
45+
LOCALES="${LOCALES-"en"}"
46+
ORIENTATIONS="${ORIENTATIONS-"portrait"}"
47+
PROD_APK_PATH="${PROD_APK_PATH-"app-prod-release.apk"}"
48+
TEST_APK_PATH="${TEST_APK_PATH-"app-prod-release-androidTest.apk"}"
49+
50+
echo "Authenticating service account in google cloud..."
51+
52+
gcloud auth activate-service-account ${FIREBASE_SERVICE_ACCOUNT_EMAIL} --key-file=${FIREBASE_API_SECRET_FILE_PATH}
53+
54+
echo "Using project [${PROJECT}] for firebase tests..."
55+
echo ""
56+
57+
gcloud config set project ${PROJECT}
58+
59+
echo "Testing project with the following configurations:"
60+
echo "Devices: [${DEVICES}]"
61+
echo "SDK's: [${SDKS}]"
62+
echo "Locales: [${LOCALES}]"
63+
echo "Orientations: [${ORIENTATIONS}]"
64+
echo ""
65+
66+
gcloud firebase test android run \
67+
--type instrumentation \
68+
--app ${PROD_APK_PATH} \
69+
--test ${TEST_APK_PATH} \
70+
--device-ids ${DEVICES} \
71+
--os-version-ids ${SDKS} \
72+
--locales ${LOCALES} \
73+
--orientations ${ORIENTATIONS}

0 commit comments

Comments
 (0)