Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #163 from vania-pooh/master
Browse files Browse the repository at this point in the history
Exporting DISPLAY variable for Android
  • Loading branch information
vania-pooh authored Jun 21, 2019
2 parents c7551fa + 1d36c35 commit b6c260a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions selenium/android/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ BOOTSTRAP_PORT=4725
EMULATOR=emulator-5554
APPIUM_ARGS=${APPIUM_ARGS:-""}
PORT=${PORT:-"4444"}
DISPLAY=99
DISPLAY_NUM=99
export DISPLAY=":$DISPLAY_NUM"
SCREEN_RESOLUTION=${SCREEN_RESOLUTION:-"1920x1080x24"}
SKIN=${SKIN:-"1080x1920"}
STOP=""
Expand All @@ -27,12 +28,12 @@ clean() {

trap clean SIGINT SIGTERM

/usr/bin/xvfb-run -e /dev/stdout -l -n "$DISPLAY" -s "-ac -screen 0 $SCREEN_RESOLUTION -noreset -listen tcp" /usr/bin/fluxbox -display ":$DISPLAY" -log /root/fluxbox.log 2>/dev/null &
/usr/bin/xvfb-run -e /dev/stdout -l -n "$DISPLAY_NUM" -s "-ac -screen 0 $SCREEN_RESOLUTION -noreset -listen tcp" /usr/bin/fluxbox -display "$DISPLAY" -log /root/fluxbox.log 2>/dev/null &
XVFB_PID=$!

retcode=1
until [ $retcode -eq 0 -o -n "$STOP" ]; do
DISPLAY=":$DISPLAY" wmctrl -m >/dev/null 2>&1
DISPLAY="$DISPLAY" wmctrl -m >/dev/null 2>&1
retcode=$?
if [ $retcode -ne 0 ]; then
echo Waiting X server...
Expand All @@ -44,11 +45,11 @@ if [ -n "$STOP" ]; then exit 0; fi
if [ "$ENABLE_VNC" != "true" -a "$ENABLE_VIDEO" != "true" ]; then
EMULATOR_ARGS="-no-window"
fi
ANDROID_AVD_HOME=/root/.android/avd DISPLAY=":$DISPLAY" /opt/android-sdk-linux/emulator/emulator ${EMULATOR_ARGS} -writable-system -no-boot-anim -no-audio -no-jni -avd @AVD_NAME@ -sdcard /sdcard.img -skin "$SKIN" -skindir /opt/android-sdk-linux/platforms/@PLATFORM@/skins/ -verbose -gpu swiftshader_indirect -ranchu -qemu -enable-kvm &
ANDROID_AVD_HOME=/root/.android/avd DISPLAY="$DISPLAY" /opt/android-sdk-linux/emulator/emulator ${EMULATOR_ARGS} -writable-system -no-boot-anim -no-audio -no-jni -avd @AVD_NAME@ -sdcard /sdcard.img -skin "$SKIN" -skindir /opt/android-sdk-linux/platforms/@PLATFORM@/skins/ -verbose -gpu swiftshader_indirect -ranchu -qemu -enable-kvm &
EMULATOR_PID=$!

if [ "$ENABLE_VNC" == "true" ]; then
x11vnc -display ":$DISPLAY" -passwd selenoid -shared -forever -loop500 -rfbport 5900 -rfbportv6 5900 -logfile /root/x11vnc.log &
x11vnc -display "$DISPLAY" -passwd selenoid -shared -forever -loop500 -rfbport 5900 -rfbportv6 5900 -logfile /root/x11vnc.log &
X11VNC_PID=$!
fi

Expand Down

0 comments on commit b6c260a

Please sign in to comment.