diff --git a/Makefile b/Makefile index aea2c5aca4..a839f1e919 100644 --- a/Makefile +++ b/Makefile @@ -8,19 +8,23 @@ MAJOR := $(word 1,$(subst ., ,$(VERSION))) MINOR := $(word 2,$(subst ., ,$(VERSION))) MAJOR_MINOR_PATCH := $(word 1,$(subst -, ,$(VERSION))) -all: hub chrome firefox chrome_debug firefox_debug standalone_chrome standalone_firefox standalone_chrome_debug standalone_firefox_debug +all: hub chrome firefox opera chrome_debug firefox_debug opera_debug standalone_chrome standalone_firefox standalone_opera standalone_chrome_debug standalone_firefox_debug standalone_opera_debug generate_all: \ generate_hub \ generate_nodebase \ generate_chrome \ generate_firefox \ + generate_opera \ generate_chrome_debug \ generate_firefox_debug \ + generate_opera_debug \ generate_standalone_firefox \ generate_standalone_chrome \ + generate_standalone_opera \ generate_standalone_firefox_debug \ - generate_standalone_chrome_debug + generate_standalone_chrome_debug \ + generate_standalone_opera_debug build: all @@ -53,6 +57,12 @@ generate_firefox: firefox: nodebase generate_firefox cd ./NodeFirefox && docker build $(BUILD_ARGS) -t $(NAME)/node-firefox:$(VERSION) . +generate_opera: + cd ./NodeOpera && ./generate.sh $(VERSION) $(NAMESPACE) $(AUTHORS) + +opera: nodebase generate_opera + cd ./NodeOpera && docker build $(BUILD_ARGS) -t $(NAME)/node-opera:$(VERSION) . + generate_standalone_firefox: cd ./Standalone && ./generate.sh StandaloneFirefox node-firefox Firefox $(VERSION) $(NAMESPACE) $(AUTHORS) @@ -77,6 +87,18 @@ generate_standalone_chrome_debug: standalone_chrome_debug: chrome_debug generate_standalone_chrome_debug cd ./StandaloneChromeDebug && docker build $(BUILD_ARGS) -t $(NAME)/standalone-chrome-debug:$(VERSION) . +generate_standalone_opera: + cd ./Standalone && ./generate.sh StandaloneOpera node-opera Opera $(VERSION) $(NAMESPACE) $(AUTHORS) + +standalone_opera: opera generate_standalone_opera + cd ./StandaloneOpera && docker build $(BUILD_ARGS) -t $(NAME)/standalone-opera:$(VERSION) . + +generate_standalone_opera_debug: + cd ./StandaloneDebug && ./generate.sh StandaloneOperaDebug node-opera-debug Opera $(VERSION) $(NAMESPACE) $(AUTHORS) + +standalone_opera_debug: opera_debug generate_standalone_opera_debug + cd ./StandaloneOperaDebug && docker build $(BUILD_ARGS) -t $(NAME)/standalone-opera-debug:$(VERSION) . + generate_chrome_debug: cd ./NodeDebug && ./generate.sh NodeChromeDebug node-chrome Chrome $(VERSION) $(NAMESPACE) $(AUTHORS) @@ -89,6 +111,12 @@ generate_firefox_debug: firefox_debug: generate_firefox_debug firefox cd ./NodeFirefoxDebug && docker build $(BUILD_ARGS) -t $(NAME)/node-firefox-debug:$(VERSION) . +generate_opera_debug: + cd ./NodeDebug && ./generate.sh NodeOperaDebug node-opera Opera $(VERSION) $(NAMESPACE) $(AUTHORS) + +opera_debug: generate_opera_debug opera + cd ./NodeOperaDebug && docker build $(BUILD_ARGS) -t $(NAME)/node-opera-debug:$(VERSION) . + tag_latest: docker tag $(NAME)/base:$(VERSION) $(NAME)/base:latest docker tag $(NAME)/hub:$(VERSION) $(NAME)/hub:latest @@ -209,12 +237,16 @@ release: tag_major_minor test: test_chrome \ test_firefox \ + test_opera \ test_chrome_debug \ test_firefox_debug \ + test_opera_debug \ test_chrome_standalone \ test_firefox_standalone \ + test_opera_standalone \ test_chrome_standalone_debug \ - test_firefox_standalone_debug + test_firefox_standalone_debug \ + test_opera_standalone_debug test_chrome: @@ -241,6 +273,18 @@ test_firefox_standalone: test_firefox_standalone_debug: VERSION=$(VERSION) NAMESPACE=$(NAMESPACE) ./tests/bootstrap.sh StandaloneFirefoxDebug +test_opera: + VERSION=$(VERSION) NAMESPACE=$(NAMESPACE) ./tests/bootstrap.sh NodeOpera + +test_opera_debug: + VERSION=$(VERSION) NAMESPACE=$(NAMESPACE) ./tests/bootstrap.sh NodeOperaDebug + +test_opera_standalone: + VERSION=$(VERSION) NAMESPACE=$(NAMESPACE) ./tests/bootstrap.sh StandaloneOpera + +test_opera_standalone_debug: + VERSION=$(VERSION) NAMESPACE=$(NAMESPACE) ./tests/bootstrap.sh StandaloneOperaDebug + .PHONY: \ all \ @@ -251,17 +295,23 @@ test_firefox_standalone_debug: ci \ firefox \ firefox_debug \ + opera \ + opera_debug \ generate_all \ generate_hub \ generate_nodebase \ generate_chrome \ generate_firefox \ + generage_opera \ generate_chrome_debug \ generate_firefox_debug \ + generate_opera_debug \ generate_standalone_chrome \ generate_standalone_firefox \ + generate_standalone_opera \ generate_standalone_chrome_debug \ generate_standalone_firefox_debug \ + generate_standalone_opera_debug \ hub \ nodebase \ release \ diff --git a/NodeOpera/Dockerfile.txt b/NodeOpera/Dockerfile.txt new file mode 100644 index 0000000000..9d2189341a --- /dev/null +++ b/NodeOpera/Dockerfile.txt @@ -0,0 +1,58 @@ +USER root + + +#============================================ +# Opera +#============================================ +# can specify versions by OPERA_VERSION; +# e.g. opera-stable=60.0.3255.109 +# opera-beta=60.0.3255.103 +# opera-developer=62.0.3323.0 +# opera=12.16.1860 +# opera-next=12.16.1860 +# latest (equivalent to opera-stable) +# opera-beta (pull latest beta) +#============================================ +ARG OPERA_VERSION="opera-stable" +RUN wget -q -O - https://deb.opera.com/archive.key | apt-key add - \ + && echo "deb https://deb.opera.com/opera-stable/ stable non-free" >> /etc/apt/sources.list.d/opera-stable.list \ + && apt-get update -qqy \ + && apt-get -qqy install \ + ${OPERA_VERSION:-opera-stable} \ + && dpkg-divert --divert /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so.orig \ + --package ${OPERA_VERSION:-opera-stable} --rename --add \ + /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so \ + && ln -sf /usr/lib/chromium-browser/libffmpeg.so /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so \ + && rm /etc/apt/sources.list.d/opera-stable.list \ + && rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +#================================= +# Opera Launch Script Wrapper +#================================= +COPY wrap_opera_binary /opt/bin/wrap_opera_binary +RUN /opt/bin/wrap_opera_binary + +USER seluser + +#===================== +# Opera webdriver +#===================== +# can specify versions by OPERA_DRIVER_VERSION +# Latest released version will be used by default +#===================== +ARG OPERA_DRIVER_VERSION +RUN LATEST_VERSION=$(curl -s https://api.github.com/repos/operasoftware/operachromiumdriver/releases/latest | jq .name -r) \ + && [ -z "$OPERA_DRIVER_VERSION" ] && OPERA_DRIVER_VERSION=$LATEST_VERSION \ + && echo "Using operadriver version: "$OPERA_DRIVER_VERSION \ + && wget --no-verbose -O /tmp/operadriver_linux64.zip https://github.com/operasoftware/operachromiumdriver/releases/download/v.${OPERA_DRIVER_VERSION}/operadriver_linux64.zip \ + && rm -rf /opt/selenium/operadriver \ + && unzip /tmp/operadriver_linux64.zip -d /tmp/ \ + && mv /tmp/operadriver_linux64/operadriver /opt/selenium/operadriver-${OPERA_DRIVER_VERSION} \ + && rm -rf /tmp/operadriver_linux64* \ + && chmod 755 /opt/selenium/operadriver-${OPERA_DRIVER_VERSION} \ + && sudo ln -fs /opt/selenium/operadriver-${OPERA_DRIVER_VERSION} /usr/bin/operadriver + +COPY generate_config /opt/bin/generate_config + +# Generating a default config during build time +RUN /opt/bin/generate_config > /opt/selenium/config.json diff --git a/NodeOpera/README-short.txt b/NodeOpera/README-short.txt new file mode 100644 index 0000000000..d97b09d428 --- /dev/null +++ b/NodeOpera/README-short.txt @@ -0,0 +1 @@ +Selenium Node configured to run Chromium based versions of Opera diff --git a/NodeOpera/generate.sh b/NodeOpera/generate.sh new file mode 100755 index 0000000000..1d7fe1d7a3 --- /dev/null +++ b/NodeOpera/generate.sh @@ -0,0 +1,13 @@ +#!/bin/bash +VERSION=$1 +NAMESPACE=$2 +AUTHORS=$3 + +echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" > ./Dockerfile +echo "# NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED." >> ./Dockerfile +echo "# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE" >> ./Dockerfile +echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >> ./Dockerfile +echo FROM ${NAMESPACE}/node-base:${VERSION} >> ./Dockerfile +echo LABEL authors="$AUTHORS" >> ./Dockerfile +echo "" >> ./Dockerfile +cat ./Dockerfile.txt >> ./Dockerfile diff --git a/NodeOpera/generate_config b/NodeOpera/generate_config new file mode 100755 index 0000000000..1aaa15b567 --- /dev/null +++ b/NodeOpera/generate_config @@ -0,0 +1,27 @@ +#!/bin/bash + +OPERA_VERSION=$(opera -version) + +cat <<_EOF +{ + "capabilities": [ + { + "version": "$OPERA_VERSION", + "browserName": "operablink", + "maxInstances": $NODE_MAX_INSTANCES, + "seleniumProtocol": "WebDriver", + "applicationName": "$NODE_APPLICATION_NAME" + } + ], + "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", + "maxSession": $NODE_MAX_SESSION, + "host": "$NODE_HOST", + "port": $NODE_PORT, + "register": true, + "registerCycle": $NODE_REGISTER_CYCLE, + "nodePolling": $NODE_POLLING, + "unregisterIfStillDownAfter": $NODE_UNREGISTER_IF_STILL_DOWN_AFTER, + "downPollingLimit": $NODE_DOWN_POLLING_LIMIT, + "debug": $GRID_DEBUG +} +_EOF diff --git a/NodeOpera/wrap_opera_binary b/NodeOpera/wrap_opera_binary new file mode 100755 index 0000000000..e4f66651eb --- /dev/null +++ b/NodeOpera/wrap_opera_binary @@ -0,0 +1,13 @@ +#!/bin/bash + +WRAPPER_PATH=$(readlink -f /usr/lib/*-linux-gnu/opera/opera) +BASE_PATH="$WRAPPER_PATH-base" +mv "$WRAPPER_PATH" "$BASE_PATH" + +cat > "$WRAPPER_PATH" <<_EOF +#!/bin/bash + +# Note: exec -a below is a bashism. +exec -a "\$0" "$BASE_PATH" --no-sandbox "\$@" +_EOF +chmod +x "$WRAPPER_PATH" diff --git a/NodeOperaDebug/README-short.txt b/NodeOperaDebug/README-short.txt new file mode 100644 index 0000000000..4fb330437a --- /dev/null +++ b/NodeOperaDebug/README-short.txt @@ -0,0 +1 @@ +_This image is only intended for development purposes!_ Runs a Selenium Grid Node with a VNC Server to allow you to visually see the browser being automated. diff --git a/README.md b/README.md index c6370d1d9c..500e724f62 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,16 @@ Images included: - __selenium/node-base__: Base image for Grid Nodes which includes a virtual desktop environment - __selenium/node-chrome__: Grid Node with Chrome installed, needs to be connected to a Grid Hub - __selenium/node-firefox__: Grid Node with Firefox installed, needs to be connected to a Grid Hub +- __selenium/node-opera__: Grid Node with Opera installed, needs to be connected to a Grid Hub - __selenium/node-chrome-debug__: Grid Node with Chrome installed and runs a VNC server, needs to be connected to a Grid Hub - __selenium/node-firefox-debug__: Grid Node with Firefox installed and runs a VNC server, needs to be connected to a Grid Hub +- __selenium/node-opera-debug__: Grid Node with Opera installed and runs a VNC server, needs to be connected to a Grid Hub - __selenium/standalone-chrome__: Selenium Standalone with Chrome installed - __selenium/standalone-firefox__: Selenium Standalone with Firefox installed +- __selenium/standalone-opera__: Selenium Standalone with Opera installed - __selenium/standalone-chrome-debug__: Selenium Standalone with Chrome installed and runs a VNC server - __selenium/standalone-firefox-debug__: Selenium Standalone with Firefox installed and runs a VNC server +- __selenium/standalone-opera-debug__: Selenium Standalone with Opera installed and runs a VNC server ## @@ -43,23 +47,31 @@ $ docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-firefox:3. #OR $ docker run -d -p 4444:4444 --shm-size 2g selenium/standalone-firefox:3.141.59-zirconium ``` +Opera +``` bash +$ docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-opera:3.141.59-zirconium +#OR +$ docker run -d -p 4444:4444 --shm-size=2g selenium/standalone-opera:3.141.59-zirconium +``` This is a known workaround to avoid the browser crashing inside a docker container, here are the documented issues for [Chrome](https://code.google.com/p/chromium/issues/detail?id=519952) and [Firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=1338771#c10). The shm size of 2gb is arbitrary but known to work well, your specific use case might need a different value, it is recommended to tune this value according to your needs. Along the examples `-v /dev/shm:/dev/shm` will be used, but both are known to work. -### Standalone Chrome and Firefox +### Standalone Chrome, Firefox and Opera ``` bash $ docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome:3.141.59-zirconium # OR $ docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-firefox:3.141.59-zirconium +# OR +$ docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-opera:3.141.59-zirconium ``` _Note: Only one standalone image can run on port_ `4444` _at a time._ -To inspect visually what the browser is doing use the `standalone-chrome-debug` or `standalone-firefox-debug` images. See [Debugging](#debugging) section for details. +To inspect visually what the browser is doing use the `standalone-chrome-debug`, `standalone-firefox-debug` or `standalone-opera-debug` images. See [Debugging](#debugging) section for details. ### Selenium Grid Hub and Nodes There are different ways to run the images and create a grid, check the following options. @@ -73,6 +85,7 @@ $ docker network create grid $ docker run -d -p 4444:4444 --net grid --name selenium-hub selenium/hub:3.141.59-zirconium $ docker run -d --net grid -e HUB_HOST=selenium-hub -v /dev/shm:/dev/shm selenium/node-chrome:3.141.59-zirconium $ docker run -d --net grid -e HUB_HOST=selenium-hub -v /dev/shm:/dev/shm selenium/node-firefox:3.141.59-zirconium +$ docker run -d --net grid -e HUB_HOST=selenium-hub -v /dev/shm:/dev/shm selenium/node-opera:3.141.59-zirconium ``` When you are done using the grid and the containers have exited, the network can be removed with the following command: @@ -95,6 +108,15 @@ snippet as your `docker-compose.yaml`, save it locally and in the same folder ru # Add the `-d` flag at the end for detached execution version: '2' services: + chrome: + image: selenium/node-chrome:3.141.59-zirconium + volumes: + - /dev/shm:/dev/shm + depends_on: + - hub + environment: + HUB_HOST: hub + firefox: image: selenium/node-firefox:3.141.59-zirconium volumes: @@ -104,8 +126,8 @@ services: environment: HUB_HOST: hub - chrome: - image: selenium/node-chrome:3.141.59-zirconium + opera: + image: selenium/node-opera:3.141.59-zirconium volumes: - /dev/shm:/dev/shm depends_on: @@ -130,6 +152,7 @@ services: container_name: selenium-hub ports: - "4444:4444" + chrome: image: selenium/node-chrome:3.141.59-zirconium volumes: @@ -139,6 +162,7 @@ services: environment: - HUB_HOST=selenium-hub - HUB_PORT=4444 + firefox: image: selenium/node-firefox:3.141.59-zirconium volumes: @@ -148,6 +172,16 @@ services: environment: - HUB_HOST=selenium-hub - HUB_PORT=4444 + + opera: + image: selenium/node-opera:3.141.59-zirconium + volumes: + - /dev/shm:/dev/shm + depends_on: + - selenium-hub + environment: + - HUB_HOST=selenium-hub + - HUB_PORT=4444 ``` To stop the grid and cleanup the created containers, run `docker-compose down`. @@ -187,6 +221,17 @@ services: deploy: replicas: 1 entrypoint: bash -c 'SE_OPTS="-host $$HOSTNAME" /opt/bin/entry_point.sh' + + opera: + image: selenium/node-opera:3.141.59-zirconium + volumes: + - /dev/shm:/dev/shm + environment: + HUB_HOST: hub + HUB_PORT: 4444 + deploy: + replicas: 1 + entrypoint: bash -c 'SE_OPTS="-host $$HOSTNAME" /opt/bin/entry_point.sh' ``` #### Using `--link` @@ -198,6 +243,7 @@ It could serve you as an option for a proof of concept, and for simplicity it is $ docker run -d -p 4444:4444 --name selenium-hub selenium/hub:3.141.59-zirconium $ docker run -d --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-chrome:3.141.59-zirconium $ docker run -d --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-firefox:3.141.59-zirconium +$ docker run -d --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-opera:3.141.59-zirconium ``` ### Deploying to Kubernetes @@ -286,7 +332,7 @@ $ docker run -d -e HUB_HOST= -e NODE_MAX_INSTANCES=5 -e NODE_MA ### Running in Headless mode -Both [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode) and [Chrome](https://developers.google.com/web/updates/2017/04/headless-chrome) support running tests in headless mode. +[Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode), [Chrome](https://developers.google.com/web/updates/2017/04/headless-chrome) and [Opera](https://forums.opera.com/topic/20375/opera-cli-switches-and-headless) support running tests in headless mode. When using headless mode, there's no need for the [Xvfb](https://en.wikipedia.org/wiki/Xvfb) server to be started. To avoid starting the server you can set the `START_XVFB` environment variable to `false` (or any other value than `true`), for example: @@ -341,6 +387,18 @@ $ FF=$(docker run --rm --name=fx \ _Note: Since a Docker container is not meant to preserve state and spawning a new one takes less than 3 seconds you will likely want to remove containers after each end-to-end test with_ `--rm` _command. You need to think of your Docker containers as single processes, not as running virtual machines, in case you are familiar with [Vagrant](https://www.vagrantup.com/)._ +##### Example: Spawn a container for testing in Opera: + +``` bash +$ docker run -d --name selenium-hub -p 4444:4444 selenium/hub:3.141.59-zirconium +$ CH=$(docker run --rm --name=ch \ + --link selenium-hub:hub -v /e2e/uploads:/e2e/uploads \ + -v /dev/shm:/dev/shm \ + selenium/node-opera:3.141.59-zirconium) +``` + +_Note:_ `-v /e2e/uploads:/e2e/uploads` _is optional in case you are testing browser uploads on your web app you will probably need to share a directory for this._ + ## Waiting for the Grid to be ready It is a good practice to check first if the Grid is up and ready to receive requests, this can be done by checking the `/wd/hub/status` endpoint. @@ -390,6 +448,7 @@ $ docker run -d -p 4444:4444 --net grid --name selenium-hub \ selenium/hub:3.141.59-zirconium $ docker run -d --net grid -e HUB_HOST=selenium-hub -v /dev/shm:/dev/shm selenium/node-chrome:3.141.59-zirconium $ docker run -d --net grid -e HUB_HOST=selenium-hub -v /dev/shm:/dev/shm selenium/node-firefox:3.141.59-zirconium +$ docker run -d --net grid -e HUB_HOST=selenium-hub -v /dev/shm:/dev/shm selenium/node-opera:3.141.59-zirconium ``` **Note:** The `\` line delimiter won't work on Windows based terminals, try either `^` or a backtick. @@ -444,11 +503,13 @@ In the event you wish to visually see what the browser is doing you will want to ``` bash $ docker run -d -P -p :5900 --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-chrome-debug:3.141.59-zirconium $ docker run -d -P -p :5900 --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-firefox-debug:3.141.59-zirconium +$ docker run -d -P -p :5900 --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-opera-debug:3.141.59-zirconium ``` e.g.: ``` bash $ docker run -d -P -p 5900:5900 --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-chrome-debug:3.141.59-zirconium $ docker run -d -P -p 5901:5900 --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-firefox-debug:3.141.59-zirconium +$ docker run -d -P -p 5900:5900 --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-opera-debug:3.141.59-zirconium ``` to connect to the Chrome node on 5900 and the Firefox node on 5901 (assuming those node are free, and reachable). @@ -457,12 +518,16 @@ And for standalone: $ docker run -d -p 4444:4444 -p :5900 -v /dev/shm:/dev/shm selenium/standalone-chrome-debug:3.141.59-zirconium # OR $ docker run -d -p 4444:4444 -p :5900 -v /dev/shm:/dev/shm selenium/standalone-firefox-debug:3.141.59-zirconium +# OR +$ docker run -d -p 4444:4444 -p :5900 -v /dev/shm:/dev/shm selenium/standalone-opera-debug:3.141.59-zirconium ``` or ``` bash $ docker run -d -p 4444:4444 -p 5900:5900 -v /dev/shm:/dev/shm selenium/standalone-chrome-debug:3.141.59-zirconium # OR $ docker run -d -p 4444:4444 -p 5901:5900 -v /dev/shm:/dev/shm selenium/standalone-firefox-debug:3.141.59-zirconium +# OR +$ docker run -d -p 4444:4444 -p 5900:5900 -v /dev/shm:/dev/shm selenium/standalone-opera-debug:3.141.59-zirconium ``` You can acquire the port that the VNC server is exposed to by running: @@ -483,6 +548,7 @@ When you are prompted for the password it is `secret`. If you wish to change thi ``` dockerfile #FROM selenium/node-chrome-debug:3.141.59-zirconium #FROM selenium/node-firefox-debug:3.141.59-zirconium +#FROM selenium/node-opera-debug:3.141.59-zirconium #Choose the FROM statement that works for you. RUN x11vnc -storepasswd /home/seluser/.vnc/passwd @@ -512,4 +578,4 @@ or `Message: unknown error: Chrome failed to start: exited abnormally` -The reason _might_ be that you've set the `START_XVFB` environment variable to "false", but forgot to actually run Firefox or Chrome (respectively) in headless mode. +The reason _might_ be that you've set the `START_XVFB` environment variable to "false", but forgot to actually run Firefox, Chrome or Opera (respectively) in headless mode. diff --git a/StandaloneOpera/README-short.txt b/StandaloneOpera/README-short.txt new file mode 100644 index 0000000000..2a40281013 --- /dev/null +++ b/StandaloneOpera/README-short.txt @@ -0,0 +1 @@ +Selenium Standalone configured to run Opera diff --git a/StandaloneOpera/selenium.conf b/StandaloneOpera/selenium.conf new file mode 100644 index 0000000000..c07fb1ff00 --- /dev/null +++ b/StandaloneOpera/selenium.conf @@ -0,0 +1,36 @@ +; Documentation of this file format -> http://supervisord.org/configuration.html + +; Priority 0 - xvfb, 5 - fluxbox (debug images), 10 - x11vnc (debug images), 15 - selenium-node + +[program:xvfb] +priority=0 +command=/opt/bin/start-xvfb.sh +autostart=true +autorestart=false +startsecs=0 +startretries=0 + +;Logs +redirect_stderr=false +stdout_logfile=/var/log/supervisor/xvfb-stdout.log +stderr_logfile=/var/log/supervisor/xvfb-stderr.log +stdout_logfile_maxbytes=50MB +stderr_logfile_maxbytes=50MB +stdout_logfile_backups=5 +stderr_logfile_backups=5 +stdout_capture_maxbytes=50MB +stderr_capture_maxbytes=50MB + + +[program:selenium-standalone] +priority=15 +command=/opt/bin/start-selenium-standalone.sh +autostart=true +autorestart=false +startsecs=0 +startretries=0 + +;Logs (all Hub activity redirected to stdout so it can be seen through "docker logs" +redirect_stderr=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 diff --git a/StandaloneOperaDebug/README-short.txt b/StandaloneOperaDebug/README-short.txt new file mode 100644 index 0000000000..534cd92084 --- /dev/null +++ b/StandaloneOperaDebug/README-short.txt @@ -0,0 +1 @@ +_This image is only intended for development purposes!_ Runs a Selenium Grid Standalone with a VNC Server to allow you to visually see the browser being automated. diff --git a/StandaloneOperaDebug/selenium.conf b/StandaloneOperaDebug/selenium.conf new file mode 100644 index 0000000000..c07fb1ff00 --- /dev/null +++ b/StandaloneOperaDebug/selenium.conf @@ -0,0 +1,36 @@ +; Documentation of this file format -> http://supervisord.org/configuration.html + +; Priority 0 - xvfb, 5 - fluxbox (debug images), 10 - x11vnc (debug images), 15 - selenium-node + +[program:xvfb] +priority=0 +command=/opt/bin/start-xvfb.sh +autostart=true +autorestart=false +startsecs=0 +startretries=0 + +;Logs +redirect_stderr=false +stdout_logfile=/var/log/supervisor/xvfb-stdout.log +stderr_logfile=/var/log/supervisor/xvfb-stderr.log +stdout_logfile_maxbytes=50MB +stderr_logfile_maxbytes=50MB +stdout_logfile_backups=5 +stderr_logfile_backups=5 +stdout_capture_maxbytes=50MB +stderr_capture_maxbytes=50MB + + +[program:selenium-standalone] +priority=15 +command=/opt/bin/start-selenium-standalone.sh +autostart=true +autorestart=false +startsecs=0 +startretries=0 + +;Logs (all Hub activity redirected to stdout so it can be seen through "docker logs" +redirect_stderr=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 diff --git a/StandaloneOperaDebug/start-selenium-standalone.sh b/StandaloneOperaDebug/start-selenium-standalone.sh new file mode 100755 index 0000000000..2732189a29 --- /dev/null +++ b/StandaloneOperaDebug/start-selenium-standalone.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +# +# IMPORTANT: Change this file only in directory StandaloneDebug! + +java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \ + ${SE_OPTS} diff --git a/tests/SeleniumTests/__init__.py b/tests/SeleniumTests/__init__.py index 1e96123b49..fb9d05c8df 100644 --- a/tests/SeleniumTests/__init__.py +++ b/tests/SeleniumTests/__init__.py @@ -77,3 +77,12 @@ def test_title_and_maximize_window(self): self.driver.get('https://the-internet.herokuapp.com') self.driver.maximize_window() self.assertTrue(self.driver.title == 'The Internet') + + +class OperaTests(SeleniumGenericTests): + def setUp(self): + capabilities = DesiredCapabilities.CHROME + capabilities['browserName'] = 'operablink' + self.driver = webdriver.Remote( + desired_capabilities=capabilities + ) diff --git a/tests/test.py b/tests/test.py index f5d2648af0..2ff7ed5594 100644 --- a/tests/test.py +++ b/tests/test.py @@ -36,6 +36,12 @@ 'NodeFirefoxDebug': 'node-firefox-debug', 'StandaloneFirefox': 'standalone-firefox', 'StandaloneFirefoxDebug': 'standalone-firefox-debug', + + # Opera Images + 'NodeOpera': 'node-opera', + 'NodeOperaDebug': 'node-opera-debug', + 'StandaloneOpera': 'standalone-opera', + 'StandaloneOperaDebug': 'standalone-opera-debug', } TEST_NAME_MAP = { @@ -50,6 +56,12 @@ 'NodeFirefoxDebug': 'FirefoxTests', 'StandaloneFirefox': 'FirefoxTests', 'StandaloneFirefoxDebug': 'FirefoxTests', + + # Opera Images + 'NodeOpera': 'OperaTests', + 'NodeOperaDebug': 'OperaTests', + 'StandaloneOpera': 'OperaTests', + 'StandaloneOperaDebug': 'OperaTests', }