Skip to content

Commit ad168b0

Browse files
authored
Fix E2E tests running on selenium/standalone-chrome Docker image (#198)
1 parent b51c5e7 commit ad168b0

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

Makefile

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,12 @@ docker.up.demo: docker.down.demo
11211121

11221122
# Run E2E tests environment in Docker Compose.
11231123
#
1124+
# For Chrome WebDriver:
1125+
# `/opt/bin/start-vnc.sh & /opt/bin/start-novnc.sh` could be added after
1126+
# `start-xvfb.sh` script for starting up VNC and web client for it.
1127+
# VNC web client (noVNC) can be accessed on this address:
1128+
# http://localhost:7900/?autoconnect=1&resize=scale&password=secret
1129+
#
11241130
# Usage:
11251131
# make docker.up.e2e [browser=(chrome|firefox)]
11261132
# [rebuild=(no|yes)]
@@ -1148,7 +1154,9 @@ docker-up-e2e-env = RUST_BACKTRACE=1 \
11481154
COMPOSE_WEBDRIVER_ENTRYPOINT=$(strip \
11491155
$(if $(call eq,$(browser),firefox),\
11501156
"geckodriver --binary=/opt/firefox/firefox" ,\
1151-
"chromedriver --port=4444 --allowed-ips='' --allowed-origins='*'" ))
1157+
"sh -c \"/opt/bin/start-xvfb.sh 2>/dev/null & \
1158+
exec chromedriver --port=4444 --allowed-ips='' \
1159+
--allowed-origins='*'\"" ))
11521160

11531161
docker.up.e2e: docker.down.e2e
11541162
ifeq ($(rebuild),yes)
@@ -1195,6 +1203,12 @@ endif
11951203

11961204
# Run dockerized WebDriver.
11971205
#
1206+
# For Chrome:
1207+
# `/opt/bin/start-vnc.sh & /opt/bin/start-novnc.sh` could be added after
1208+
# `start-xvfb.sh` script for starting up VNC and web client for it.
1209+
# VNC web client (noVNC) can be accessed on this address:
1210+
# http://localhost:7900/?autoconnect=1&resize=scale&password=secret
1211+
#
11981212
# Usage:
11991213
# make docker.up.webdriver [browser=(chrome|firefox)]
12001214

@@ -1208,9 +1222,11 @@ ifeq ($(browser),firefox)
12081222
--binary=/opt/firefox/firefox
12091223
else
12101224
docker run --rm -d --network=host --shm-size 512m \
1211-
--name medea-webdriver-chrome --entrypoint chromedriver \
1225+
--name medea-webdriver-chrome --entrypoint sh \
12121226
selenium/standalone-chrome:$(CHROME_VERSION) \
1213-
--port=4444 --allowed-ips='' --allowed-origins='*'
1227+
-c "/opt/bin/start-xvfb.sh 2>/dev/null & \
1228+
exec chromedriver --port=4444 --allowed-ips='' \
1229+
--allowed-origins='*'"
12141230
endif
12151231

12161232

e2e/.env

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,11 @@ COMPOSE_CONTROL_MOCK_IMAGE_VER=dev
1111
COMPOSE_WEBDRIVER_IMAGE_NAME=selenium/standalone-chrome
1212
COMPOSE_WEBDRIVER_IMAGE_VER=latest
1313

14-
COMPOSE_WEBDRIVER_ENTRYPOINT="chromedriver --port=4444 --allowed-ips='' --allowed-origins='*'"
14+
# `/opt/bin/start-vnc.sh & /opt/bin/start-novnc.sh` could be added after
15+
# `start-xvfb.sh` script for starting up VNC and web client for it.
16+
# VNC web client (noVNC) can be accessed on this address:
17+
# http://localhost:7900/?autoconnect=1&resize=scale&password=secret
18+
COMPOSE_WEBDRIVER_ENTRYPOINT="sh -c \"/opt/bin/start-xvfb.sh 2>/dev/null & \
19+
exec chromedriver --port=4444 \
20+
--allowed-ips='' \
21+
--allowed-origins='*'\""

webdriver.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@
88
},
99
"goog:chromeOptions": {
1010
"args": [
11+
"--disable-browser-side-navigation",
1112
"--disable-dev-shm-usage",
13+
"--disable-extensions",
14+
"--disable-gpu",
15+
"--dns-prefetch-disable",
1216
"--no-sandbox",
1317
"--use-fake-device-for-media-stream",
14-
"--use-fake-ui-for-media-stream"
18+
"--use-fake-ui-for-media-stream",
19+
"--window-size=1920,1080"
1520
]
1621
}
1722
}

0 commit comments

Comments
 (0)