Giter Club home page Giter Club logo

digdug's Introduction

ディグダグ

Build Status npm version Average time to resolve an issue Percentage of issues still open

Dig Dug is a simple abstraction library for downloading and launching WebDriver service tunnels and interacting with the REST APIs of these services.

Dig Dug can run a local Selenium server, and it supports the following cloud testing services:

Configuration

In many cases, the only configuration you'll need to do to create a tunnel is provide authentication data. This can be provided by setting properties on tunnels or via environment variables. The tunnels use the following environment variables:

Tunnel class Environment variables
BrowserStackTunnel BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY
CrossBrowserTestingTunnel CBT_USERNAME, CBT_APIKEY
SauceLabsTunnel SAUCE_USERNAME, SAUCE_ACCESS_KEY
TestingBotTunnel TESTINGBOT_KEY, TESTINGBOT_SECRET

Other properties, such as the local port the tunnel should serve on or the URL of a proxy server the tunnel should go through, can be passed to a tunnel constructor or set on a tunnel instance. See the pages for Tunnel and the tunnel subclasses for available properties.

Usage

To create a new tunnel, import the desired tunnel class, create a new instance, and call its start method. start returns a Promise that resolves when the tunnel has successfully started. For example, to create a new Sauce Labs tunnel:

var SauceLabsTunnel = require('digdug/SauceLabsTunnel');
var tunnel = new SauceLabsTunnel();
tunnel.start().then(function () {
	// interact with the WebDriver server at tunnel.clientUrl
});

Once a tunnel has been started, a test runner interacts with it as described in the service's documentation. The Sauce Labs and TestingBot executables start a WebDriver server on localhost that the test client communicates with. To interact with BrowserStack, a test client will connect to hub.browserstack.com after the tunnel has started.

The tunnel classes also provide a sendJobState convenience method to let the remote service know whether a test session passed or failed. This method accepts a session ID and an object containing service-specific data, and it returns a Promise that resolves if the job state was successfully updated.

tunnel.sendJobState(sessionId, { success: true });

When testing is finished, call the tunnel's stop method to cleanly shut it down. This method returns a Promise that is resolved when the service tunnel executable has exited.

tunnel.stop().then(function () {
	// the tunnel has been shut down
});

Utilities

Dig Dug includes a utility script, digdugEnvironmnents. After the digdug package has been installed, run this script to get a list of environments provided by a particular testing service.

$ ./node_modules/.bin/digdugEnvironments SauceLabsTunnel
{"platform":"OS X 10.9","browserName":"firefox","version":"4"}
{"platform":"OS X 10.9","browserName":"firefox","version":"5"}
{"platform":"OS X 10.9","browserName":"firefox","version":"6"}
{"platform":"OS X 10.9","browserName":"firefox","version":"7"}
{"platform":"OS X 10.9","browserName":"firefox","version":"8"}
{"platform":"OS X 10.9","browserName":"firefox","version":"9"}
{"platform":"OS X 10.9","browserName":"firefox","version":"10"}
...

Note that BrowserStackTunnel requires that the BROWSERSTACK_ACCESS_KEY and BROWSERSTACK_USERNAME environment variables exist and are set to a user's account access key and username. The other tunnels do not (currently) require authentication to request an environment list.

API documentation

View API documentation

License

Dig Dug is a JS Foundation project offered under the New BSD license.

© SitePen, Inc. and its contributors

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.