Skip to content

Commit

Permalink
Merge pull request #387 from zebrunner/chrome-fixes
Browse files Browse the repository at this point in the history
Chrome fixes
  • Loading branch information
vdelendik authored May 17, 2024
2 parents 721152e + 10020cc commit 50bee55
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,17 @@ ENV ADB_PORT=5037
ENV ANDROID_DEVICE=
ENV ADB_POLLING_SEC=5

ENV CHROMEDRIVER_AUTODOWNLOAD=true

# uiautomator port
ENV CHROMEDRIVER_PORT=8200
# chromedriver devtools port
ENV ANDROID_DEVTOOLS_PORT=9222
ENV CHROME_OPTIONS="\"androidDevToolsPort\": ${ANDROID_DEVTOOLS_PORT}"

ENV PROXY_PORT=8080
ENV SERVER_PROXY_PORT=0

ENV CHROMEDRIVER_AUTODOWNLOAD=true

# Log settings
ENV LOG_LEVEL=info
ENV LOG_DIR=/tmp/log
Expand Down
21 changes: 20 additions & 1 deletion files/android.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# print all settings
# print all settings
adb shell getprop ro.build.characteristics

# device type
Expand Down Expand Up @@ -36,3 +36,22 @@ then
else
export AUTOMATION_NAME='uiautomator2'
fi

# Forward adb port
# Used to connect appium builtin adb and mcloud-android-connector adb
socat TCP-LISTEN:5037,fork TCP:connector:5037 &

# Forward appium-uiautomator2 port
# Used to connect appium-uiautomator2-server and appium-uiautomator2-driver
# https://github.com/appium/appium-uiautomator2-server/wiki
while true; do
#TODO: experiment later with default command again. Current implementation could keep port open and redirect when needed only
socat TCP:localhost:${CHROMEDRIVER_PORT},retry,interval=1,forever TCP:connector:${CHROMEDRIVER_PORT},retry,interval=1,forever
sleep 1
done &

# Forward devtools port
# Used to control mobile chrome browser
if [[ -n $CHROME_OPTIONS ]]; then
socat TCP-LISTEN:${ANDROID_DEVTOOLS_PORT},fork TCP:connector:${ANDROID_DEVTOOLS_PORT} &
fi
2 changes: 1 addition & 1 deletion files/ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [[ -z $USBMUXD_SOCKET_ADDRESS ]]; then
usbmuxd -f &
sleep 2
# socat server to share usbmuxd socket via TCP
socat TCP-LISTEN:2222,reuseaddr,fork UNIX-CONNECT:/var/run/usbmuxd &
socat TCP-LISTEN:${USBMUXD_SOCKET_ADDRESS},reuseaddr,fork UNIX-CONNECT:/var/run/usbmuxd &
else
# rm /var/run/usbmuxd in advance to be able to start socat and join it to $USBMUXD_SOCKET_ADDRESS
rm -f /var/run/usbmuxd
Expand Down
4 changes: 3 additions & 1 deletion files/zbr-default-caps-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ cat << EndOfMessage
"appium:deviceName": "${DEVICE_NAME}",
"appium:udid": "${DEVICE_UDID}",
"appium:automationName": "${AUTOMATION_NAME}",
"appium:remoteAdbHost": "${REMOTE_ADB_HOST}"
"appium:remoteAdbHost": "${REMOTE_ADB_HOST}",
"appium:chromedriverPort": ${CHROMEDRIVER_PORT},
"appium:chromeOptions": {${CHROME_OPTIONS}}
}
EndOfMessage
fi
Expand Down

0 comments on commit 50bee55

Please sign in to comment.