new (require("digdug/Tunnel"))(kwArgs: Object)

A Tunnel is a mechanism for connecting to a WebDriver service provider that securely exposes local services for testing within the service provider’s network.

Parameters

Name Type Description
kwArgs Object

A map of properties that should be set on the new instance.

Source

All Properties

Property Defined by
architecture: string

The architecture the tunnel will run against.

digdug/Tunnel
auth: string

An HTTP authorization string to use when initiating connections to the tunnel.

digdug/Tunnel
clientUrl: string
(readonly)

The URL that a WebDriver client should used to interact with this service.

digdug/Tunnel
directory: string

The directory where the tunnel software will be extracted.

digdug/Tunnel
executable: string

The executable to spawn in order to create a tunnel.

digdug/Tunnel
(readonly)

A map of additional capabilities that need to be sent to the provider when a new session is being created.

digdug/Tunnel
hostname: string

The host on which a WebDriver client can access the service provided by the tunnel.

digdug/Tunnel
isDownloaded: string
(readonly)

Whether or not the tunnel software has already been downloaded.

digdug/Tunnel
isRunning: boolean
(readonly)

Whether or not the tunnel is currently running.

digdug/Tunnel
isStarting: boolean
(readonly)

Whether or not the tunnel is currently starting up.

digdug/Tunnel
isStopping: boolean
(readonly)

Whether or not the tunnel is currently stopping.

digdug/Tunnel
pathname: string

The path that a WebDriver client should use to access the service provided by the tunnel.

digdug/Tunnel
platform: string

The operating system the tunnel will run on.

digdug/Tunnel
port: number

The local port where the WebDriver server should be exposed by the tunnel.

digdug/Tunnel
protocol: string

The protocol (e.g., 'http') that a WebDriver client should use to access the service provided by the tunnel.

digdug/Tunnel
proxy: string

The URL of a proxy server for the tunnel to go through.

digdug/Tunnel
tunnelId: string

A unique identifier for the newly created tunnel.

digdug/Tunnel
url: string

The URL where the tunnel software can be downloaded.

digdug/Tunnel
verbose: boolean

Whether or not to tell the tunnel to provide verbose logging output.

digdug/Tunnel

All Methods

Method Defined by
_makeArgs(): Array.<string>
(protected)

Creates the list of command-line arguments to be passed to the spawned tunnel.

digdug/Tunnel
_makeChild(): Object
(protected)

Creates a newly spawned child process for the tunnel software.

digdug/Tunnel
_makeOptions(): Object
(protected)

Creates the set of options to use when spawning the tunnel process.

digdug/Tunnel
_normalizeEnvironment(environment)
(protected)

Normalizes a specific Tunnel environment descriptor to a general form.

digdug/Tunnel

Called with the response after a file download has completed

digdug/Tunnel
_start(): Object
(protected)

This method provides the implementation that actually starts the tunnel and any other logic for emitting events on the Tunnel based on data passed by the tunnel software.

digdug/Tunnel
_stop(): Promise.<void>
(protected)

This method provides the implementation that actually stops the tunnel.

digdug/Tunnel
download(forceDownload: boolean): Promise.<void>

Downloads and extracts the tunnel software if it is not already downloaded.

digdug/Tunnel

Get a list of environments available on the service.

digdug/Tunnel
sendJobState(jobId: string, data: JobState): Promise.<void>

Sends information about a job to the tunnel provider.

digdug/Tunnel
start(): Promise.<void>

Starts the tunnel, automatically downloading dependencies if necessary.

digdug/Tunnel
stop(): Promise.<integer>

Stops the tunnel.

digdug/Tunnel

All Events

Event Defined by

Part of the tunnel has been downloaded from the server.

digdug/Tunnel

Information about the status of the tunnel setup process that is suitable for presentation to end-users.

digdug/Tunnel

A chunk of raw string data output by the tunnel software to stderr.

digdug/Tunnel

A chunk of raw string data output by the tunnel software to stdout.

digdug/Tunnel

Properties

architecture: string

The architecture the tunnel will run against. This information is automatically retrieved for the current system at runtime.

Source

auth: string

An HTTP authorization string to use when initiating connections to the tunnel. This value of this property is defined by Tunnel subclasses.

(readonly) clientUrl: string

The URL that a WebDriver client should used to interact with this service.

directory: string

The directory where the tunnel software will be extracted. If the directory does not exist, it will be created. This value is set by the tunnel subclasses.

executable: string

The executable to spawn in order to create a tunnel. This value is set by the tunnel subclasses.

(readonly) extraCapabilities: string

A map of additional capabilities that need to be sent to the provider when a new session is being created.

hostname: string

The host on which a WebDriver client can access the service provided by the tunnel. This may or may not be the host where the tunnel application is running.

Defaults to

'localhost'

(readonly) isDownloaded: string

Whether or not the tunnel software has already been downloaded.

(readonly) isRunning: boolean

Whether or not the tunnel is currently running.

(readonly) isStarting: boolean

Whether or not the tunnel is currently starting up.

(readonly) isStopping: boolean

Whether or not the tunnel is currently stopping.

pathname: string

The path that a WebDriver client should use to access the service provided by the tunnel.

Defaults to

'/wd/hub/'

platform: string

The operating system the tunnel will run on. This information is automatically retrieved for the current system at runtime.

port: number

The local port where the WebDriver server should be exposed by the tunnel.

Defaults to

4444

protocol: string

The protocol (e.g., 'http') that a WebDriver client should use to access the service provided by the tunnel.

Defaults to

'http'

proxy: string

The URL of a proxy server for the tunnel to go through. Only the hostname, port, and auth are used.

tunnelId: string

A unique identifier for the newly created tunnel.

url: string

The URL where the tunnel software can be downloaded.

verbose: boolean

Whether or not to tell the tunnel to provide verbose logging output.

Defaults to

false

Methods

(protected) _makeArgs(): Array.<string>

Creates the list of command-line arguments to be passed to the spawned tunnel. Implementations should override this method to provide the appropriate command-line arguments.

Arguments passed to digdug/Tunnel#_makeChild will be passed as-is to this method.

Returns

  • A list of command-line arguments.

(protected) _makeChild(): Object

Creates a newly spawned child process for the tunnel software. Implementations should call this method to create the tunnel process.

Arguments passed to this method will be passed as-is to digdug/Tunnel#_makeArgs and digdug/Tunnel#_makeOptions.

Returns

  • An object containing a newly spawned Process and a Deferred that will be resolved once the tunnel has started successfully.

(protected) _makeOptions(): Object

Creates the set of options to use when spawning the tunnel process. Implementations should override this method to provide the appropriate options for the tunnel software.

Arguments passed to digdug/Tunnel#_makeChild will be passed as-is to this method.

Returns

  • A set of options matching those provided to Node.js child_process.spawn.

(protected) _normalizeEnvironment(environment)

Normalizes a specific Tunnel environment descriptor to a general form. To be overriden by a child implementation.

Parameters

Name Type Description
environment

an environment descriptor specific to the Tunnel

Returns

  • a normalized environment

_postDownloadFile()

Called with the response after a file download has completed

(protected) _start(): Object

This method provides the implementation that actually starts the tunnel and any other logic for emitting events on the Tunnel based on data passed by the tunnel software.

The default implementation that assumes the tunnel is ready for use once the child process has written to stdout or stderr. This method should be reimplemented by other tunnel launchers to implement correct launch detection logic.

Returns

  • An object containing a reference to the child process, and a Deferred that is resolved once the tunnel is ready for use. Normally this will be the object returned from a call to Tunnel#_makeChild.

(protected) _stop(): Promise.<void>

This method provides the implementation that actually stops the tunnel.

The default implementation that assumes the tunnel has been closed once the child process has exited. This method should be reimplemented by other tunnel launchers to implement correct shutdown logic, if necessary.

Returns

  • A promise that resolves once the tunnel has shut down.

download(forceDownload: boolean): Promise.<void>

Downloads and extracts the tunnel software if it is not already downloaded.

This method can be extended by implementations to perform any necessary post-processing, such as setting appropriate file permissions on the downloaded executable.

Parameters

Name Type Description
forceDownload boolean

Force downloading the software even if it already has been downloaded.

Returns

  • A promise that resolves once the download and extraction process has completed.

getEnvironments()

Get a list of environments available on the service.

This method should be overridden and use a specific implementation that returns normalized environments from the service. E.g.

{ browserName: 'firefox', version: '12', platform: 'windows', descriptor: { } }

Returns

  • An object containing the response and helper functions

sendJobState(jobId: string, data: JobState): Promise.<void>

Sends information about a job to the tunnel provider.

Parameters

Name Type Description
jobId string

The job to send data about. This is usually a session ID.

data JobState

Data to send to the tunnel provider about the job.

Returns

  • A promise that resolves once the job state request is complete.

start(): Promise.<void>

Starts the tunnel, automatically downloading dependencies if necessary.

Returns

  • A promise that resolves once the tunnel has been established.

stop(): Promise.<integer>

Stops the tunnel.

Returns

  • A promise that resolves to the exit code for the tunnel once it has been terminated.

Events

downloadprogress: Object

Part of the tunnel has been downloaded from the server.

Properties

Name Type Description
received number

The number of bytes received so far.

total number

The total number of bytes to download.

Source

status: string

Information about the status of the tunnel setup process that is suitable for presentation to end-users.

Source

stderr: string

A chunk of raw string data output by the tunnel software to stderr.

Source

stdout: string

A chunk of raw string data output by the tunnel software to stdout.

Source