File tree Expand file tree Collapse file tree 6 files changed +49
-17
lines changed Expand file tree Collapse file tree 6 files changed +49
-17
lines changed Original file line number Diff line number Diff line change @@ -115,11 +115,15 @@ EXPOSE 4723
115115COPY \
116116 Appium/entry_point.sh \
117117 Appium/generate_config.sh \
118+ Appium/wireless_connect.sh \
119+ Appium/wireless_autoconnect.sh \
118120 /root/
119121RUN chmod +x /root/entry_point.sh && \
120- chmod +x /root/generate_config.sh
122+ chmod +x /root/generate_config.sh && \
123+ chmod +x /root/wireless_connect.sh && \
124+ chmod +x /root/wireless_autoconnect.sh
121125
122126# ========================================
123127# Run xvfb and appium server
124128# ========================================
125- CMD [ " /root/entry_point.sh" ]
129+ CMD /root/wireless_autoconnect.sh && /root/ entry_point.sh
Original file line number Diff line number Diff line change 33NODE_CONFIG_JSON=" /root/nodeconfig.json"
44CMD=" xvfb-run appium"
55
6+ if [ ! -z " $REMOTE_ADB " ]; then
7+ /root/wireless_connect.sh
8+ fi
9+
610if [ ! -z " $CONNECT_TO_GRID " ]; then
711 /root/generate_config.sh $NODE_CONFIG_JSON
812 CMD+=" --nodeconfig $NODE_CONFIG_JSON "
Original file line number Diff line number Diff line change @@ -30,20 +30,6 @@ if [ -z "$NODE_TIMEOUT" ]; then
3030 NODE_TIMEOUT=300
3131fi
3232
33- if [ ! -z " $REMOTE_ADB " ]; then
34- if [ ! -z " $ANDROID_DEVICES " ]; then
35- IFS=' ,' read -r -a array <<< " $ANDROID_DEVICES"
36- for i in " ${! array[@]} "
37- do
38- echo " Connecting to: ${array[$i]} "
39- adb connect ${array[$i]}
40- echo " Success!"
41- done
42- # Give time to finish connection
43- sleep 1
44- fi
45- fi
46-
4733# Get device names
4834devices=($( adb devices | grep -oP " \K([^ ]+)(?=\sdevice(\W|$))" ) )
4935echo " Devices found: ${# devices[@]} "
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ if [ ! -z " $REMOTE_ADB " ]; then
4+
5+ if [ -z " $REMOTE_ADB_POLLING_SEC " ]; then
6+ REMOTE_ADB_POLLING_SEC=5
7+ fi
8+
9+ function connect() {
10+ while true
11+ do
12+ # to avoid immediate run
13+ sleep ${REMOTE_ADB_POLLING_SEC}
14+ /root/wireless_connect.sh
15+ done
16+ }
17+
18+ ( trap " true" HUP ; connect ) > /dev/null 2> /dev/null < /dev/null & disown
19+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ if [ ! -z " $ANDROID_DEVICES " ]; then
4+ connected_devices=$( adb devices)
5+ IFS=' ,' read -r -a array <<< " $ANDROID_DEVICES"
6+ for i in " ${! array[@]} "
7+ do
8+ array_device=$( echo ${array[$i]} | tr -d " " )
9+ # string contains check
10+ if [[ ${connected_devices} != * ${array_device} * ]]; then
11+ echo " Connecting to: ${array_device} "
12+ adb connect ${array_device}
13+ echo " Success!"
14+ fi
15+ done
16+ # Give time to finish connection
17+ sleep 1
18+ fi
Original file line number Diff line number Diff line change @@ -110,9 +110,10 @@ Then run docker container with following parameters:
110110
111111- REMOTE\_ADB=True
112112- ANDROID\_DEVICES=\<android\_device\_host\>:\<android\_device\_port\> \[,\<android\_device\_host\>:\<android\_device\_port\>\]
113+ - REMOTE_ADB_POLLING_SEC=60 (default: 5, interval between polling the list of connected devices in order to connect to lost remote devices)
113114
114115```
115- $ docker run -d -p 4723:4723 -e REMOTE_ADB=True -e ANDROID_DEVICES=192.168.0.5:5555,192.168.0.6:5555
116+ $ docker run -d -p 4723:4723 -e REMOTE_ADB=True -e ANDROID_DEVICES=192.168.0.5:5555,192.168.0.6:5555 -e REMOTE_ADB_POLLING_SEC=60
116117
117118```
118119
You can’t perform that action at this time.
0 commit comments