WebdriverIO service to start and stop docker container (for Selenium and more)
npm install wdio-docker-serviceWDIO Docker Service 


===
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.
Run:
``bash`
npm install wdio-docker-service --save-dev
Instructions on how to install WebdriverIO can be found here.
to your service array:`javascript
// wdio.conf.js
exports.config = {
// ...
services: ['docker'],
// ...
};
`Options
$3
Various options required to run docker containerType:
ObjectDefault:
{ Example:
`javascript
dockerOptions: {
image: 'selenium/standalone-chrome',
healthCheck: 'http://localhost:4444',
options: {
p: ['4444:4444'],
shmSize: '2g'
}
}
`$3
Docker container name tag. Could be local or from Docker HUB.Type:
StringRequired:
true$3
Configuration which checks your containers' readiness before initiating tests. Normally this would be a localhost url.
If healthCheck is not configured, Webdriver will start running tests immediately after Docker container starts, which
maybe too early considering that it takes time for web service to start inside a Docker container.Type:
String|ObjectOptions for Object use:
- url - url to an app running inside your container
- maxRetries - number of retries until healthcheck fails. Default: 10
- inspectInterval - interval between each retry in ms. Default: 500
- startDelay - initial delay to begin healthcheck in ms. Default: 0
Example 1 (String):
healthCheck: 'http://localhost:4444'Example 2 (Object):
`javascript
healthCheck: {
url: 'http://localhost:4444',
maxRetries: 3,
inspectInterval: 1000,
startDelay: 2000
}
`$3
Map of options used by docker run command. For more details on run command click here.Any single-letter option will be converted to
-[option] (i.e. d: true -> -d). Any option of two-character or more will
be converted to
--[option] (i.e. rm: true -> --rm). For options that may be used more than once
(i.e.
-e,-add-host, --expose, etc.), please use array notation (i.e. e: ["NODE_ENV=development", "FOO=bar"]).Type:
ObjectExample:
`javascript
options: {
e: ['NODE_ENV=development', 'PROXY=http://myproxy:80']
p: ['4444:4444', '5900:5900'],
shmSize: '2g'
}
`$3
Any arguments you may want to pass into container. Corresponds to [ARG...] in Docker run CLI.Type:
String$3
Any command you may want to pass into container. Corresponds to [COMMAND] in Docker run CLI.Type:
String$3
A callback method which is called when Docker application is ready. Readiness is determined by ability to ping healthCheck url.Type:
Function$3
Path to where logs from docker container should be storedType:
String`