diff --git a/README.md b/README.md index db1b1f1..9a700e9 100644 --- a/README.md +++ b/README.md @@ -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 # @@ -124,6 +129,23 @@ 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 < /opt/plugins/custom/selenium/opsdis.com/sides/.options +--filter MyTestSuite +EOT + +cat < /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: ``` @@ -131,6 +153,8 @@ The directory structure should look like this: │   ├── out │   └── sides │   └── opsdis.com.side +│   └── .side.yml +│   └── .options ``` # Execute the plugin # diff --git a/dockerimage/Dockerfile b/dockerimage/Dockerfile index 321366f..ce851bf 100644 --- a/dockerimage/Dockerfile +++ b/dockerimage/Dockerfile @@ -5,9 +5,9 @@ LABEL maintainer="Opsdis Consulting AB " # 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/* @@ -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