This is a test repository to run selenium test inside docker container. This repository contains some sample selenium test cases written in Ruby RSpec.
- Docker
git clone https://github.com/vbanthia/selenium-docker-test.git
cd selenium-docker-test
docker build --rm -t selenium-test ./Dockerfile
docker run -d --name selenium-server selenium/standalone-chrome
docker run --name selenium-test \
--link selenium-server:server \
-e "WEBDRIVER_HOST=server" \
-e "FEATURE_TYPE=feature_one" \
selenium-test
Above command will do following things:
- Start selenium test container
- Link it with selenium server container using tag as server
- Add environment variable
WEBDRIVER_HOST
andFEATURE_TYPE
required by test script WEBDRIVER_HOST
is simply selenium-server container tag
docker cp selenium-test:/usr/src/app/result.html ./
docker rm selenium-test # Remove selenium-test container
docker stop selenium-server # Stop selenium-server container
docker rm selenium-server # Remove selenium-server container
docker rmi selenium-test # Delete selenium-test docker image