Skip to content
/ e2e Public

Docker base image for end-to-end selenium webdriver testing in docker: ubuntu, xvfb, java, firefox

License

Notifications You must be signed in to change notification settings

daggerok/e2e

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E2E image Build Status Firefox e2e tests Chrome e2e tests

Automated e2e base image build for Docker Hub

  • Docker Ubuntu Bionic 18.04 / Trusty 14.04
  • Java Development Kit 8 OpenJDK / AdoptOpenJDK
  • Chrome with chrome driver version: 80.0.3987.106
  • Firefox with gecko driver version: 0.26.0
  • X Virtual Frame Buffer (xvfb)

v4 tags ww

images

  • Docker Ubuntu Trusty 14.04 base image including XVFB and JDK8
  • Docker Ubuntu Trusty 14.04 image including Chrome browser, chrome driver, XVFB and JDK8
  • Docker Ubuntu Trusty 14.04 image including Firefox browser, gecko driver, XVFB and JDK8
  • Docker Ubuntu Trusty 14.04 image including Firefox and Chrome browsers, theirs web-drivers, XVFB and JDK8

web drivers sources

Usage

just create your test Dockerfile

FROM daggerok/e2e:ubuntu-xvfb-jdk8
#/home/e2e/project-directory/
WORKDIR 'project-directory/'
ENTRYPOINT start-xvfb && ./gradlew test
COPY . .
FROM daggerok/e2e:bionic-xvfb-jdk8-v4
WORKDIR 'some-directory/'
ENTRYPOINT start-xvfb && ./gradlew test chrome
COPY . .
FROM daggerok/e2e:trusty-xvfb-jdk8
WORKDIR 'e2e-tests/'
ENTRYPOINT start-xvfb && ./gradlew test firefox
COPY . .
FROM daggerok/e2e:trusty-xvfb-jdk8-base-v4
#FROM daggerok/e2e:bionic-xvfb-jdk8-base-v4
RUN echo 'install browser, webdriver and use already installed and configured jdk8 + Xvfb based on Ubuntu 14.04'

build test image

# prepare tests/Dockerfile.firefox and build e2e test image  as usual...
docker build -f ./tests/Dockerfile.firefox -t daggerok/e2e-tests:`date +%Y-%m-%d` ./tests

run tests

docker run --rm --name run-`date +%Y-%m-%d`-e2e-tests daggerok/e2e-tests:`date +%Y-%m-%d`

reduce build time by using data volume

# build e2e test image  as usual...
docker build -f ./tests/Dockerfile.firefox -t daggerok/e2e-tests:`date +%Y-%m-%d` ./tests

# create re-usable e2e data volume
docker volume create e2e-data || echo 'oops, volume exists...'

# run e2e tests
docker run --rm --name run-`date +%Y-%m-%d`-e2e-tests \
  -v e2e-data:/home/e2e/.gradle/caches/modules-2/files-2.1 \
  -v e2e-data:/home/e2e/.m2/repository \
  daggerok/e2e-tests:`date +%Y-%m-%d`

fix chrome

To make it possible run e2e tests in chrome, you have to in addition configure --no-sandbox ChromeOptions argument in your tests, like so:

// ./mvnw test -Dselenide.browser=chrome -Dselenide.headless=true
if ("chrome".equals(Configuration.browser)) && Configuration.headless) {
  ChromeOptions chromeOptions = new ChromeOptions().addArguments("--no-sandbox");
  WebDriverRunner.setWebDriver(new ChromeDriver(chromeOptions));
}