npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wdio-docker-service

v3.2.1

Published

WebdriverIO service to start and stop docker container (for Selenium and more)

Downloads

59,012

Readme

WDIO Docker Service Maintainability Build Status Test Coverage

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'
    }
}

dockerOptions.image

Docker container name tag. Could be local or from Docker HUB.

Type: String

Required: true

dockerOptions.healthCheck

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|Object

Options 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):

healthCheck: {
    url: 'http://localhost:4444',
    maxRetries: 3,
    inspectInterval: 1000,
    startDelay: 2000
}

dockerOptions.options

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: Object

Example:

options: {
    e: ['NODE_ENV=development', 'PROXY=http://myproxy:80']
    p: ['4444:4444', '5900:5900'],
    shmSize: '2g'
}

dockerOptions.args

Any arguments you may want to pass into container. Corresponds to [ARG...] in Docker run CLI.

Type: String

dockerOptions.command

Any command you may want to pass into container. Corresponds to [COMMAND] in Docker run CLI.

Type: String

onDockerReady

A callback method which is called when Docker application is ready. Readiness is determined by ability to ping healthCheck url.

Type: Function

dockerLogs

Path to where logs from docker container should be stored

Type: String

Testing Use Cases / Recipes

Please visit our Wiki for more details.