-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun-tests-android.sh
More file actions
94 lines (61 loc) · 2.18 KB
/
run-tests-android.sh
File metadata and controls
94 lines (61 loc) · 2.18 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
##### Cloud testrun dependencies start
echo "[Testdroid-ssa-client] Extracting tests.zip..."
unzip tests.zip
echo "[Testdroid-ssa-client] NOT Starting Appium, start it in your test script if needed!"
##### Cloud testrun dependencies end.
export APPIUM_APPFILE=$PWD/application.apk #dummy app, not the actual app
## Run the test:
echo "[Testdroid-ssa-client] Running test ${TEST}"
export APPFILE=$PWD/android/app/build/outputs/apk/release/app-release.apk
# put local tools to path
export PATH=$PATH:$PWD
export SCREENSHOTSFOLDER=$PWD/screenshots
#################################
echo "using APPFILE: ${APPFILE}"
cd "$(dirname "$0")" || exit
echo "Before install $(date)"
APILEVEL=$(adb shell getprop ro.build.version.sdk)
APILEVEL="${APILEVEL//[$'\t\r\n']}"
export APILEVEL
echo "API level is: ${APILEVEL}"
# Run adb once so API level can be read without the "daemon not running"-message
adb devices
adb shell pm list packages -f | grep detox
UDID="$(adb devices | grep device | tr "\n" " " | awk '{print $5}')"
export UDID
echo "UDID: $UDID"
rm -rf "$SCREENSHOTSFOLDER"
rm ./*.xml
mkdir -p "$SCREENSHOTSFOLDER"
echo $SCREENSHOTSFOLDER
node --version
npm -version
watchman --version
echo "Npm install"
npm install
#build project
#"${PWD}/node_modules/.bin/detox" build --configuration android.device.release
echo "Launching Detox server"
"${PWD}/node_modules/.bin/detox" -version
#"${PWD}/node_modules/.bin/detox" run-server &
"${PWD}/node_modules/.bin/detox" run-server > detox-server.log 2>&1 &
# allow device to contact host by localhost
adb reverse tcp:8099 tcp:8099
echo "Running tests $(date)"
sed -i.bu "s/ADD_DEVICE_ID_HERE/$UDID/" package.json
cat package.json
"${PWD}/node_modules/.bin/detox" test --configuration android.device.release --loglevel verbose > detox.log 2>&1
scriptExitStatus=$?
ls -la detox.log
echo "detox-test-log"
cat detox.log
echo "detox-server-log"
cat detox-server.log
adb uninstall com.detox.rn.example
adb uninstall com.detox.rn.example.test
adb shell pm list packages -f | grep detox
adb shell pm list instrumentation | grep detox
echo "Test has been run $(date), exit status: '${scriptExitStatus}'"
mv ./*.xml TEST-all.xml
exit $scriptExitStatus