Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sauce-tunnel

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sauce-tunnel

A wrapper around the Sauce Labs tunnel jar

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

sauce-tunnel

A Node.js wrapper around the Saucelabs tunnel jar.

This code is extracted from grunt-saucelabs by axemclion, with the grunt-specific parts removed.

It was extracted into its own module to avoid duplication between grunt-saucelabs, grunt-mocha-webdriver, and any future Node module that may need it.

Usage

Before starting the tunnel, initialize it first

var tunnel = new SauceTunnel(SAUCE_USERNAME, SAUCE_ACCESSKEY, tunnelIdentifier, tunneled, extraFlags);
  1. SAUCE_USERNAME and SAUCE_ACCESSKEY are the username and the accesskey for saucelabs. They are usually set as environment variables (specially in continuous integration tools like travis )
  2. The tunnelIdentifier is a unique identifier for the tunnel. It is optional and is automatically generated when not specified. Note that the tunnel identifier may have to be passed in with the browsers object as a desired capability to enable traffic to use the tunnel. More details here
  3. The tunneled attribute is a boolean value to indicate if the tunnel is to be created or not. This value can be set to false to mock a tunnel creation if the site tested is publically accessible. To create a tunnel, set this value to true.
  4. The extraFlags attribute is an optioonal array of options flags (see here). Example: ['--debug', '--direct-domains', 'www.google.com']

One the tunnel is initialized, start the tunnel using it with the following command.

tunnel.start(function(status){
  // status === true indicates that the tunnel was successfully created. 
});

The actual webdriver code to run the test cases can be added inside the callback function. Once the webdriver completes its task, you can shut down the tunnel using

tunnel.stop(function(){
  // Tunnel was stopped
});

Full Example

To get started easily, here is the code you can copy paste

var SauceTunnel = require('sauce-tunnel');
var tunnel = new SauceTunnel(process.env.SAUCE_USERNAME, process.env.SAUCE_ACCESSKEY, 'tunnel', true/* ['--debug'] */);
tunnel.start(function(status){
  if (status === false){
    throw new Error('Something went wrong with the tunnel');
  }
  /** var wd =  ... Work with the web driver**/
  // Once all webdriver work is done
  tunnel.stop(function(){
    // Tunnel destroyed
  });
});

CHANGELOG

v1.1

  • Remove all the logic surrounding tracking open tunnels, killing existing tunnels, and tunnel timeouts. (#3)

Keywords

FAQs

Package last updated on 03 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc