Skip to content

alejandroq/docker-protractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProtractorJS + Docker Container = Headless E2E in CI/CD

Alejandro Quesada v1.0.0

Description

Plug n' play functional E2E ProtractorJS testing suites in a Docker container. Chrome XVFB, documentation and permissions factored into Debian usage.

Status

Image Name Travis Status Git
stable Build Status master
latest Build Status dev
Docker Hub Docker Pull Command
https://hub.docker.com/r/alejandroq/docker-protractor/ docker pull alejandroq/docker-protractor:

Documentation

Your Protractor and Karma configurations must maintain the following:

// Protractor Conf
chromeOptions: {
      args: [
        "--headless",
        "no-sandbox",
        "--disable-gpu",
        "--window-size=800,600"
      ]
    }
// Karma Conf
browsers: ['ChromeHeadlessNoSandbox'],
    customLaunchers: {
      ChromeHeadlessNoSandbox: {
        base: 'ChromeHeadless',
        flags: ['--no-sandbox']
      }
    },

Examples can be found in the examples directory.

An example of this container being used for Angular:

# !/bin/bash

# the currenty testing entry point is via:
# ENTRYPOINT ["bash"]

# At the moment, it would be best to define
# a smoke test in a shell script for running
# within the CI/CD. Specifying a specific 
# suite is beneficial as you can freely determine 
# the tradeoff of quality and money (as CI/CD services
# such as CodeCommit are typically pay as you go)
#
# Our example smoke test in a `./test` shell script file
set -e
npm install
./node_modules/@angular/cli/bin/ng e2e --aot --prod
./node_modules/@angular/cli/bin/ng test --single-run
echo
docker run -v $PWD/examples/angular-example:/protractor -w /protractor  "$AUTHOR/$CONTAINER" ./test

Updates

A notorious issue with ChromeDriver is its frequency of updating - and rendering old webdrivers obsolete. I have a TravisCI Cron job re-build the Docker containers daily (and therefore pull in the latest webdrivers). In your personal use, it is advisable you update them often when it fails to run outside of any errors within a testing script.

daily cron

TODO

  • Repair tests
    • NG
    • Cucumber
    • Typescript
  • Update test package.json's
    • Cucumber
    • NG to 6.*
    • Typescript

Resources

About

Run E2E test suites in a Docker container. Chrome XVFB, documentation and permissions factored into usage - plug n' go!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published