forked from openedx-unsupported/edx-app-android
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtravis-acceptance-tests.sh
50 lines (40 loc) · 1.66 KB
/
travis-acceptance-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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# exit on error
set -e
# create debug build
pwd
echo "[INFO] running assembleProdDebug ..."
./gradlew assembleProdDebug
echo "[INFO] build created"
# get current timestamp, to be used in apk name
current_time=$(date "+%Y.%m.%d-%H.%M.%S")
echo "Current Time : $current_time"
# enter tests project folder
cd AcceptanceTests
pwd
# export required keys and parameters
# Travis Environment is supposed to provide two vairables
# SAUCE_KEY and SAUCE_USERNAME
# These two variables are used later in this shell script.
export APK_PATH="../VideoLocker/build/outputs/apk/VideoLocker-prod-debug.apk"
export APK_NAME="edx-prod-debug-"$current_time".apk"
echo "-----------------Configuration------------------"
echo "SAUCE_KEY=$SAUCE_KEY"
echo "SAUCE_USERNAME=$SAUCE_USERNAME"
echo "APK_PATH=$APK_PATH"
echo "APK_NAME=$APK_NAME"
echo "------------------------------------------------"
# Upload apk to SauceLabs
echo "[INFO] uploading apk file ..."
curl -u $SAUCE_USERNAME:$SAUCE_KEY -X POST -H "Content-Type: application/octet-stream" https://saucelabs.com/rest/v1/storage/$SAUCE_USERNAME/$APK_NAME?overwrite=true --data-binary @$APK_PATH
echo "[INFO] apk uploaded"
# run acceptance tests on SauceLabs in a background thread
echo "[INFO] running tests ..."
mvn test -DappPath=sauce-storage:$APK_NAME -DosVersion="4.4" -DdeviceOS=android -DdeviceName="Android Emulator" -DtestngXml=android.xml -DsauceKey=$SAUCE_KEY -DsauceUser=$SAUCE_USERNAME -DsauceBuildName=$APK_NAME
echo "[INFO] test run finished!"
# exit from the AcceptanceTests folder
cd ..
pwd
# upload reports to artifacts folder
./gradlew copyAcceptanceTestBuildArtifacts
echo "[INFO] acceptance test reports are being uploaded"