Skip to content

Commit

Permalink
feat: Doc with examples about running latest selenium grid.
Browse files Browse the repository at this point in the history
  • Loading branch information
damencho committed May 23, 2023
1 parent 569b18d commit 770e1d3
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ classes
target
*.log
target/
doc/grid/resources/

# PSNR test sequences and output files
resources/psnr/output/
Expand All @@ -27,4 +28,4 @@ resources/psnr/test_sequences/
# VSCode files
.classpath
.project
.settings
.settings
12 changes: 12 additions & 0 deletions doc/grid/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG BROWSER=chrome
ARG VERSION=latest
FROM selenium/standalone-${BROWSER}:${VERSION}

USER root

RUN mkdir -p /usr/share/jitsi-meet-torture
COPY resources /usr/share/jitsi-meet-torture/resources

# setting custom version when using beta
ARG VERSION
RUN if [ "${VERSION}" = "beta" ] ; then sed -i "s/\${SE_NODE_BROWSER_VERSION}/beta/g" /opt/bin/generate_config; fi
38 changes: 38 additions & 0 deletions doc/grid/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## A quick how to create a grid with latest selenium

You need docker and docker-compose installed locally.

### Images

We need images with some media on them to be used as input device - audio and video.

Create the images:
```
cd jitsi-meet-torture/doc/grid
cp -r ../../resources .
wget -P resources https://github.com/jitsi/jitsi-meet-torture/releases/download/example-video-source/FourPeople_1280x720_30.y4m
docker build --build-arg VERSION=latest --build-arg BROWSER=chrome -t jitsi/standalone-chrome:latest .
docker build --build-arg VERSION=latest --build-arg BROWSER=firefox -t jitsi/standalone-firefox:latest .
docker build --build-arg VERSION=beta --build-arg BROWSER=firefox -t jitsi/standalone-firefox:beta .
docker build --build-arg VERSION=beta --build-arg BROWSER=chrome -t jitsi/standalone-chrome:beta .
```

### Start the grid
```
docker-compose-v3-dynamic-grid.yml
```

This will start the grid and a node and everytime a session is requested a new docker image with the browser will be run.
Once the session is not needed anymore the node will be destroyed.
You can now open the grid dashboard at: http://localhost:4444/.
The number of sessions/chrome instances will be limited to the resource of the machine running the node.
You can start several nodes on different machines, for more information: https://github.com/SeleniumHQ/docker-selenium#using-dynamic-grid-in-different-machinesvms


#### Example run
```
mvn test -Djitsi-meet.instance.url=https://alpha.jitsi.net -Djitsi-meet.tests.toRun=UDPTest -Denable.headless=true \
-Dweb.participant1.isRemote=true -Dweb.participant2.isRemote=true -Dweb.participant3.isRemote=true -Dweb.participant4.isRemote=true \
-Dremote.resource.path=/usr/share/jitsi-meet-torture \
-Dremote.address=http://localhost:4444/wd/hub
```
24 changes: 24 additions & 0 deletions doc/grid/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[docker]
# Configs have a mapping between the Docker image to use and the capabilities that need to be matched to
# start a container with the given image.
configs = [
"jitsi/standalone-firefox:latest", '{"browserName": "firefox", "platformName": "linux"}',
"jitsi/standalone-chrome:latest", '{"browserName": "chrome", "platformName": "linux"}',
"jitsi/standalone-firefox:beta", '{"browserName": "firefox", "platformName": "linux", "browserVersion": "beta"}',
"jitsi/standalone-chrome:beta", '{"browserName": "chrome", "platformName": "linux", "browserVersion": "beta" }'
]

# URL for connecting to the docker daemon
# host.docker.internal works for macOS and Windows.
# Linux could use --net=host in the `docker run` instruction or 172.17.0.1 in the URI below.
# To have Docker listening through tcp on macOS, install socat and run the following command
# socat -4 TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock
url = "http://127.0.0.1:2375"
# Docker image used for video recording
#video-image = "selenium/video:ffmpeg-4.3.1-20230508"

# Uncomment the following section if you are running the node on a separate VM
# Fill out the placeholders with appropriate values
#[server]
#host = <ip-from-node-machine>
#port = <port-from-node-machine>
26 changes: 26 additions & 0 deletions doc/grid/docker-compose-v3-dynamic-grid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-dynamic-grid.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-dynamic-grid.yml down`
version: "3"
services:
node-docker:
image: selenium/node-docker:4.9.1-20230508
volumes:
- ./assets:/opt/selenium/assets
- ./config.toml:/opt/bin/config.toml
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_NODE_SESSION_TIMEOUT=60

selenium-hub:
image: selenium/hub:4.9.1-20230508
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
Binary file removed resources/lib/maven-ant-tasks-2.1.3.jar
Binary file not shown.

0 comments on commit 770e1d3

Please sign in to comment.