Skip to content

Commit 8fa9113

Browse files
authored
[test]: fix node relay tests (#2269)
[deploy] Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 8355bd9 commit 8fa9113

File tree

5 files changed

+52
-59
lines changed

5 files changed

+52
-59
lines changed

.github/workflows/docker-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jobs:
6666
- name: Checkout code
6767
uses: actions/checkout@main
6868
- name: Set up containerd image store feature
69+
if: matrix.test-strategy != 'test_node_relay'
6970
uses: nick-invision/retry@master
7071
with:
7172
timeout_minutes: 10

Base/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ ARG VERSION
66
ARG RELEASE=selenium-${VERSION}
77
ARG AUTHORS=SeleniumHQ
88
# Default value should be aligned with upstream Selenium (https://github.com/SeleniumHQ/selenium/blob/trunk/java/maven_deps.bzl)
9-
ARG OPENTELEMETRY_VERSION=1.36.0
10-
ARG GRPC_VERSION=1.62.2
9+
ARG OPENTELEMETRY_VERSION=1.38.0
10+
ARG GRPC_VERSION=1.64.0
1111
ARG CS_VERSION=2.1.10
1212

1313
#Arguments to define the user running Selenium

Makefile

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ test_parallel: hub chrome firefox edge chromium
568568
echo NODE_CHROME=chromium >> .env ; \
569569
fi; \
570570
echo TEST_PLATFORMS=$(PLATFORMS) >> .env ; \
571-
docker compose --profile $(PLATFORMS) -f docker-compose-v3-test-parallel.yml up --no-log-prefix --exit-code-from tests ; \
571+
DOCKER_DEFAULT_PLATFORM=$(PLATFORMS) docker compose --profile $(PLATFORMS) -f docker-compose-v3-test-parallel.yml up --no-log-prefix --exit-code-from tests ; \
572572
done
573573

574574
test_video_dynamic_name:
@@ -578,7 +578,6 @@ test_video_dynamic_name:
578578
# This should run on its own CI job. There is no need to combine it with the other tests.
579579
# Its main purpose is to check that a video file was generated.
580580
test_video: video hub chrome firefox edge chromium
581-
# Running a few tests with docker compose to generate the videos
582581
sudo rm -rf ./tests/tests
583582
sudo rm -rf ./tests/videos; mkdir -p ./tests/videos
584583
if [ "$(PLATFORMS)" = "linux/amd64" ]; then \
@@ -614,12 +613,12 @@ test_video: video hub chrome firefox edge chromium
614613
echo VIDEO_FILE_NAME=$${VIDEO_FILE_NAME:-"firefox_video.mp4"} >> .env ; \
615614
echo VIDEO_FILE_NAME_SUFFIX=$${VIDEO_FILE_NAME_SUFFIX:-"true"} >> .env ; \
616615
fi ; \
617-
docker compose -f docker-compose-v3-test-video.yml up --abort-on-container-exit ; \
616+
DOCKER_DEFAULT_PLATFORM=$(PLATFORMS) docker compose -f docker-compose-v3-test-video.yml up --abort-on-container-exit ; \
618617
done
619618
make test_video_integrity
620619

621620
test_node_relay: hub node_base standalone_firefox
622-
sudo rm -rf ./tests/tests
621+
sudo rm -rf ./tests/tests ./tests/videos; mkdir -p ./tests/videos ; \
623622
if [ "$(PLATFORMS)" = "linux/amd64" ]; then \
624623
list_nodes="Android NodeFirefox" ; \
625624
else \
@@ -641,24 +640,29 @@ test_node_relay: hub node_base standalone_firefox
641640
echo TEST_NODE_RELAY=$$node >> .env ; \
642641
echo UID=$$(id -u) >> .env ; \
643642
echo BINDING_VERSION=$(BINDING_VERSION) >> .env ; \
644-
PROFILE="relay_standalone" ; \
645643
if [ $$node = "Android" ] ; then \
646-
echo BROWSER=firefox >> .env && \
647-
PROFILE="relay_appium" ; \
644+
echo BROWSER=firefox >> .env \
645+
&& echo BROWSER_NAME=firefox >> .env ; \
648646
fi ; \
649647
if [ $$node = "NodeChrome" ] ; then \
650-
echo BROWSER=chrome >> .env ; \
648+
echo BROWSER=chrome >> .env \
649+
&& BROWSER_NAMEchrome >> .env ; \
651650
fi ; \
652651
if [ $$node = "NodeChromium" ] ; then \
653-
echo BROWSER=chromium >> .env ; \
652+
echo BROWSER=chromium >> .env \
653+
&& echo BROWSER_NAME=chrome >> .env ; \
654654
fi ; \
655655
if [ $$node = "NodeEdge" ] ; then \
656-
echo BROWSER=edge >> .env ; \
656+
echo BROWSER=edge >> .env \
657+
&& echo BROWSER_NAME=MicrosoftEdge >> .env ; \
657658
fi ; \
658659
if [ $$node = "NodeFirefox" ] ; then \
659-
echo BROWSER=firefox >> .env ; \
660+
echo BROWSER=firefox >> .env \
661+
&& echo BROWSER_NAME=firefox >> .env ; \
660662
fi ; \
661-
docker compose --profile $${PROFILE} -f docker-compose-v3-test-node-relay.yml up --no-log-prefix --exit-code-from tests ; \
663+
export $$(cat .env | xargs) ; \
664+
envsubst < relay_config.toml > ./videos/relay_config.toml ; \
665+
DOCKER_DEFAULT_PLATFORM=$(PLATFORMS) docker compose --profile $$node -f docker-compose-v3-test-node-relay.yml up --no-log-prefix --exit-code-from tests ; \
662666
if [ $$? -ne 0 ]; then exit 1; fi ; \
663667
done
664668

@@ -701,7 +705,7 @@ test_node_docker: hub standalone_docker standalone_chrome standalone_firefox sta
701705
fi ; \
702706
export $$(cat .env | xargs) ; \
703707
envsubst < config.toml > ./videos/config.toml ; \
704-
docker compose -f docker-compose-v3-test-node-docker.yaml up --no-log-prefix --exit-code-from tests ; \
708+
DOCKER_DEFAULT_PLATFORM=$(PLATFORMS) docker compose -f docker-compose-v3-test-node-docker.yaml up --no-log-prefix --exit-code-from tests ; \
705709
if [ $$? -ne 0 ]; then exit 1; fi ; \
706710
if [ -d "$$DOWNLOADS_DIR" ] && [ $$(ls -1q $$DOWNLOADS_DIR | wc -l) -eq 0 ]; then \
707711
echo "Mounted downloads directory is empty. Downloaded files could not be retrieved!" ; \
Lines changed: 30 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,25 @@
1-
version: "3"
21
services:
3-
node-relay-emulator:
4-
profiles:
5-
- relay_appium
6-
image: ${NAMESPACE}/node-base:${TAG}
7-
container_name: node-relay-emulator
8-
shm_size: 2gb
9-
depends_on:
10-
- selenium-hub
11-
- appium-emulator
12-
environment:
13-
- SE_EVENT_BUS_HOST=selenium-hub
14-
- SE_EVENT_BUS_PUBLISH_PORT=4442
15-
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
16-
- SE_LOG_LEVEL=${LOG_LEVEL}
17-
- SE_NODE_SESSION_TIMEOUT=${SESSION_TIMEOUT}
18-
- SE_NODE_RELAY_URL=http://appium-emulator:4723
19-
- SE_NODE_RELAY_PROTOCOL_VERSION=HTTP/1.1
20-
- SE_NODE_RELAY_MAX_SESSIONS=1
21-
- SE_NODE_RELAY_PLATFORM_NAME=Android
22-
- SE_NODE_RELAY_PLATFORM_VERSION=${ANDROID_PLATFORM_API}
23-
- SE_NODE_RELAY_BROWSER_NAME=chrome
24-
- SE_NODE_RELAY_WEB_VNC=ws://appium-emulator:6080/websockify
25-
262
node-relay-standalone:
273
image: ${NAMESPACE}/node-base:${TAG}
28-
container_name: node-relay-standalone
294
shm_size: 2gb
305
depends_on:
316
- selenium-hub
32-
- standalone-receiver
7+
- standalone
338
volumes:
34-
- ./relay_config.toml:/opt/selenium/config.toml
9+
- ./videos/relay_config.toml:/opt/selenium/config.toml
3510
environment:
3611
- SE_EVENT_BUS_HOST=selenium-hub
3712
- SE_EVENT_BUS_PUBLISH_PORT=4442
3813
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
3914
- SE_LOG_LEVEL=${LOG_LEVEL}
4015
- GENERATE_CONFIG=false
4116

17+
standalone:
18+
image: ${NAMESPACE}/standalone-${BROWSER}:${TAG}
19+
shm_size: 2gb
20+
4221
selenium-hub:
4322
image: ${NAMESPACE}/hub:${TAG}
44-
container_name: selenium-hub
4523
environment:
4624
- SE_LOG_LEVEL=${LOG_LEVEL}
4725
- SE_SESSION_REQUEST_TIMEOUT=${REQUEST_TIMEOUT}
@@ -51,7 +29,7 @@ services:
5129
- "4444:4444"
5230

5331
tests:
54-
image: docker-selenium-tests:latest
32+
image: docker-selenium-tests:${TAG}
5533
build:
5634
context: ./
5735
dockerfile: ./Dockerfile
@@ -67,16 +45,32 @@ services:
6745
- TEST_DELAY_AFTER_TEST=${TEST_DELAY_AFTER_TEST}
6846
command: ["./bootstrap.sh", "${NODE}"]
6947

70-
standalone-receiver:
71-
image: ${NAMESPACE}/standalone-${BROWSER}:${TAG}
48+
node-relay-emulator:
49+
profiles:
50+
- Android
51+
image: ${NAMESPACE}/node-base:${TAG}
7252
shm_size: 2gb
73-
container_name: standalone-receiver
53+
depends_on:
54+
- selenium-hub
55+
- emulator
56+
environment:
57+
- SE_EVENT_BUS_HOST=selenium-hub
58+
- SE_EVENT_BUS_PUBLISH_PORT=4442
59+
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
60+
- SE_LOG_LEVEL=${LOG_LEVEL}
61+
- SE_NODE_SESSION_TIMEOUT=${SESSION_TIMEOUT}
62+
- SE_NODE_RELAY_URL=http://emulator:4723
63+
- SE_NODE_RELAY_PROTOCOL_VERSION=HTTP/1.1
64+
- SE_NODE_RELAY_MAX_SESSIONS=1
65+
- SE_NODE_RELAY_PLATFORM_NAME=Android
66+
- SE_NODE_RELAY_PLATFORM_VERSION=${ANDROID_PLATFORM_API}
67+
- SE_NODE_RELAY_BROWSER_NAME=chrome
68+
- SE_NODE_RELAY_WEB_VNC=ws://emulator:6080/websockify
7469

75-
appium-emulator:
70+
emulator:
7671
profiles:
77-
- relay_appium
78-
platform: linux/amd64
79-
image: ${ANDROID_BASED_NAME}/${ANDROID_BASED_IMAGE}:latest
72+
- Android
73+
image: ${ANDROID_BASED_NAME}/${ANDROID_BASED_IMAGE}:${TAG}
8074
shm_size: 2gb
8175
build:
8276
args:
@@ -85,7 +79,6 @@ services:
8579
ANDROID_BASED_TAG: ${ANDROID_BASED_TAG}
8680
CHROME_DRIVER_URL: https://chromedriver.storage.googleapis.com/113.0.5672.63/chromedriver_linux64.zip
8781
dockerfile: ./Dockerfile.emulator
88-
container_name: appium-emulator
8982
environment:
9083
- EMULATOR_DEVICE=Nexus 5
9184
- WEB_VNC=true
@@ -96,6 +89,3 @@ services:
9689
- EMULATOR_NAME=emulator-5554
9790
devices:
9891
- /dev/kvm
99-
ports:
100-
- "6080:6080"
101-
- "4723:4723"

tests/relay_config.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ drain-after-session-count = 0
1010
max-sessions = 1
1111

1212
[relay]
13-
url = "http://standalone-receiver:4444/wd/hub"
13+
url = "http://standalone:4444/wd/hub"
1414
status-endpoint = "/status"
1515
configs = [
16-
'1', '{"browserName":"firefox","platformName":"linux"}',
17-
'1', '{"browserName":"chrome","platformName":"linux"}',
18-
'1', '{"browserName":"MicrosoftEdge","platformName":"linux"}'
16+
'1', '{"browserName":"${BROWSER_NAME}","platformName":"linux"}'
1917
]

0 commit comments

Comments
 (0)