Skip to content

moshiurqa/docker-selion

 
 

Repository files navigation

docker-selion

Docker images for SeLion (grid) server Hub and Node configurations with Chrome and Firefox.

Build Status ![Gitter](https://badges.gitter.im/Join Chat.svg)

Find us on Gitter

These images build on the Selenium docker images here https://github.com/SeleniumHQ/docker-selenium

Images included here:

  • selion/base: Base image which includes Java runtime, Selenium + SeLion JAR files
  • selion/hub: Image for running a Selion Grid Hub
  • selion/node-base: Base image for the SeLion node images
  • selion/node-chrome: SeLion node with Chrome installed, needs to be connected to a SeLion Grid Hub
  • selion/node-firefox: SeLion node with Firefox installed, needs to be connected to a SeLion Grid Hub
  • selion/node-phantomjs: SeLion node with Phantomjs installed, needs to be connected to a SeLion Grid Hub
  • selion/standalone-chrome: SeLion standalone with Chrome installed
  • selion/standalone-firefox: SeLion standalone with Firefox installed
  • selion/standalone-phantomjs: SeLion standalone with Phantomjs installed

Running the images

When executing docker run for an image with chrome browser please add volume mount -v /dev/shm:/dev/shm to use the host's shared memory.

$ docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selion/node_chrome:1.1.0

This is a workaround to node-chrome crash in docker container issue: https://code.google.com/p/chromium/issues/detail?id=519952

Selion Grid Hub

$ docker run -d -p 4444:4444 --name selion-hub selion/hub:1.1.0

SELION_OPTS options

You can pass SELION_OPTS variable with additional commandline parameters for starting a hub or a node. So to run a SeLion sauce hub.

Selion Grid Sauce Hub

$ docker run -d -p 4444:4444 -e SELION_OPTS="-type sauce" --name selion-hub selion/hub:1.1.0

Chrome and Firefox Grid Nodes

$ docker run -d --link selion-hub:hub selion/node-chrome:1.1.0
$ docker run -d --link selion-hub:hub selion/node-firefox:1.1.0

Java Environment Options

You can pass JAVA_OPTS environment variable to selenium java processes.

$ docker run -d -p 4444:4444 -e JAVA_OPTS=-Xmx512m --name selion-hub selion/hub:1.1.0

Building the images

Ensure you have the ubuntu:15.04 base image downloaded, this step is optional since Docker takes care of downloading the parent base image automatically.

$ docker pull ubuntu:15.04

Clone the repo and from the project directory root you can build everything by running:

$ VERSION=local make build

Note: Omitting VERSION=local will build the images with the develop version number thus overwriting the images downloaded from Docker Hub.

Using the images

Example: Spawn a container for testing in Chrome:
$ docker run -d --name selion-hub -p 4444:4444 selion/hub:1.1.0
$ CH=$(docker run --rm --name=ch \
    --link selion-hub:hub -v /e2e/uploads:/e2e/uploads \
    selion/node-chrome:1.1.0)

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.

Example: Spawn a container for testing in Firefox:

This command line is the same as for Chrome. Remember that the Selenium running container is able to launch either Chrome or Firefox, the idea around having 2 separate containers, one for each browser is for convenience plus avoiding certain :focus issues your web app may encounter during end-to-end test automation.

$ docker run -d --name selion-hub -p 4444:4444 selion/hub:1.1.0
$ FF=$(docker run --rm --name=fx \
    --link selion-hub:hub -v /e2e/uploads:/e2e/uploads \
    selion/node-firefox:1.1.0)

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.

Troubleshooting

All output is sent to stdout so it can be inspected by running:

$ docker logs -f <container-id|container-name>

License

The Apache Software License, Version 2.0

About

SeLion grid docker images

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 61.4%
  • Makefile 33.5%
  • JavaScript 5.1%