Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ cd check_selenium_docker/dockerimage/
docker build . --tag opsdis/selenium-chrome-node-with-side-runner
```

Image for an alternative supported browser:

```
sed 's/chrome/firefox/' Dockerfile | docker build --tag opsdis/selenium-firefox-node-with-side-runner -
```

# Plugin #

Expand Down Expand Up @@ -124,13 +129,32 @@ chmod 777 /opt/plugins/custom/selenium/opsdis.com/out/
chmod 755 /opt/plugins/custom/selenium/opsdis.com/sides/opsdis.com.side
```

Optionally add a runner local configuration file or additional command-line
arguments to pass, for example:

```
cat <<EOT > /opt/plugins/custom/selenium/opsdis.com/sides/.options
--filter MyTestSuite
EOT

cat <<EOT > /opt/plugins/custom/selenium/opsdis.com/sides/.side.yml
capabilities:
acceptInsecureCerts: true
EOT
```

See [Command-line Runner / Run-time configuration](https://www.selenium.dev/selenium-ide/docs/en/introduction/command-line-runner#run-time-configuration).


The directory structure should look like this:

```
├── opsdis.com
│   ├── out
│   └── sides
│   └── opsdis.com.side
│   └── .side.yml
│   └── .options
```

# Execute the plugin #
Expand Down
11 changes: 8 additions & 3 deletions dockerimage/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ LABEL maintainer="Opsdis Consulting AB <info@opsdis.com>"
# selenium container leaves us as user 'seluser', but we need to install more stuff
USER root

# Install nodejs 10 which includes npm
# Install nodejs LTS which includes npm
RUN apt-get -qqy update \
&& curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - \
&& curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash - \
&& apt-get -qqy --no-install-recommends install \
nodejs \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
Expand All @@ -21,6 +21,11 @@ RUN mkdir /selenium-side-runner && chown -R seluser /selenium-side-runner
WORKDIR /selenium-side-runner

# Five seconds after starting container (as deamon) selenium-side-runner will run every /sides/*.side file
RUN sed -i '/^\/usr\/bin\/supervisord.*/a sleep 5 && selenium-side-runner --server http://localhost:4444/wd/hub --output-directory /selenium-side-runner/out /sides/*.side' /opt/bin/entry_point.sh
RUN sed -i "/^\/usr\/bin\/supervisord.*/a \
OPTS=('-c browserName=chrome --server http://localhost:4444/wd/hub' '--output-directory /selenium-side-runner/out')\n\
[[ -s /sides/.options ]] && readarray -t -O 2 OPTS < /sides/.options\n\
[[ -s /sides/.side.yml ]] && OPTS+=('--config /sides/.side.yml')\n\
sleep 5 && selenium-side-runner \${OPTS[@]} /sides/*.side &> /selenium-side-runner/out/output.log" \
/opt/bin/entry_point.sh

USER seluser