Docker Service
wdio-docker-service is a 3rd party package, for more information please see GitHub | npm
This service is intended for use with WebdriverIO and it helps run functional/integration tests against/using containerized applications. It uses popular Docker service (installed separately) to run containers.
Why use it?
Ideally your tests would run in some variety of CI/CD pipeline where often there are no "real" browsers and other resources your application depends on. With advent of Docker practically all necessary application dependencies can be containerized. With this service you may run your application container or a docker-selenium in your CI and in complete isolation (assuming CI can have Docker installed as a dependency). Same may apply to local development if your application needs to have a level of isolation from your main OS.
How it works
Service will run an existing docker image and once its ready, will initiate WebdriverIO tests that should run against your containerized application.
Installation
Run:
npm install wdio-docker-service --save-dev
Instructions on how to install WebdriverIO can be found here.
Configuration
By default, Google Chrome, Firefox and PhantomJS are available when installed on the host system.
In order to use the service you need to add docker
to your service array:
// wdio.conf.js
exports.config = {
// ...
services: ['docker'],
// ...
};
Options
dockerOptions
Various options required to run docker container
Type: Object
Default: { options: { rm: true } }
Example:
dockerOptions: {
image: 'selenium/standalone-chrome',
healthCheck: 'http://localhost:4444',
options: {
p: ['4444:4444'],
shmSize: '2g'
}
}