Coder Social home page Coder Social logo

ncodefresh / docker-protractor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mrsheepuk/docker-protractor

0.0 2.0 0.0 128 KB

Docker container for running protractor tests, based on https://bitbucket.org/rkrzewski/dockerfile/

Shell 100.00%

docker-protractor's Introduction

Dockerfile for Protractor test execution

Based on caltha/protractor, this image contains a fully configured environment for running Protractor tests under Chromium and Firefox browsers.

This version additionally supports linking docker containers together to test software in another container, and passing a custom base URL into your protractor specs so you don't have to hard-code the URL in them.

Installed software

  • Xvfb The headless X server, for running browsers inside Docker
  • node.js The runtime platform for running JavaScript on the server side, including Protractor tests
  • npm Node.js package manager used to install Protractor and any specific node.js modules the tests may need
  • Selenium webdriver Browser instrumentation agent used by Protractor to execute the tests
  • Java 8 SE Needed by Selenium
  • Chromium The OSS core part of Google Chrome browser
  • Firefox Firefox browser
  • Protractor An end-to-end test framework for web applications
  • Supervisor Process controll system used to manage Xvfb and Selenium background processes needed by Protractor

Running

In order to run tests from a CI system, execute the following:

docker run --rm -v <test project location>:/project mrsheepuk/protractor

The container will terminate automatically after the tests are completed. The output of supervisord visible on the console is not interesting in most circumstances. You should check target/supervsor.out file to see the output of Protractor. Dispalying the file in an Unix terminal using cat is recommended over opening it using an editor because the file contains ANSI escape sequences.

To run against another container, execute as follows (this example assumes that the image you are testing exposes its web site on port 3000):

docker run -d --name=webe2e <image to test>
docker run --rm --link=webe2e:webe2e -v <test project location>:/project --env BASEURL=http://webe2e:3000/ mrsheepuk/protractor
docker rm -f webe2e

You can also use the BASEURL variable without container linking, to test any arbitrary web site. If you wish to use the BASEURL functionality, you must use relative URLs within your test specs (e.g. browser.get("/profile/") instead of browser.get("http://test.com/profile/").

If you want to run the tests interactively you can launch the container and enter into it:

CONTAINER=$(docker run -d -v <test project location>:/project --env MANUAL=yes mrsheepuk/protractor)
docker exec -ti $CONTAINER sudo -i -u node bash

When inside the container you can run the tests at the console by simply invoking protractor. When things don't work as expected, you should check Selenium WebDrover output in /var/log/supervisor/webdriver-err.log. When you are done, you terminate the Protractor container with docker kill $CONTAINER

docker-protractor's People

Contributors

mrsheepuk avatar

Watchers

James Cloos avatar Nikolai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.