Marionette JS Client

API Docs for: 1.7.1
Show:

Marionette.Drivers.Tcp Class

NodeJS only tcp socket driver for marionette. See Marionette.Drivers.MozTcp for the gecko/xpcom vesion of this driver.

Constructor

Marionette.Drivers.Tcp

(
  • options
)

Parameters:

  • options Options

    connection options.

    • [host="localhost"] String optional

      host.

    • [port="2828"] Numeric optional

      port.

Methods

_nextCommand

() private

Checks queue if not waiting for a response Sends command to websocket server

_onDeviceResponse

(
  • data
)
private

Handles responses from devices. Will only respond to the event if the connectionId is equal to the event id and the client is ready.

Parameters:

  • data Object

    response from server.

close

()

Destroys connection to server

Will immediately close connection to server closing any pending responses.

connect

(
  • callback
)

Connects to a remote server. Requires a _connect function to be defined.

MyClass.prototype._connect = function _connect(){
  //open a socket to marrionete accept response
  //you *must* call _onDeviceResponse with the first
  //response from marionette it looks like this:
  //{ from: 'root', applicationType: 'gecko', traits: [] }
  this.connectionId = result.id;
}

Parameters:

  • callback Function

    executes after successfully connecting to the server.

send

(
  • command
  • callback
)

Sends remote command to server. Each command will be queued while waiting for any pending commands. This ensures order of response is correct.

Parameters:

  • command Object

    remote command to send to marionette.

  • callback Function

    executed when response comes back.

setScriptTiemout

(
  • the
)

We just set the script timeout. If you need to do something in the driver.

Parameters:

  • the Integer

    timeout value.

waitForSocket

(
  • [options]
  • [callback]
)

Utility to wait for the marionette socket to be ready.

Parameters:

  • [options] Object optional

    for timeout.

    • [interval] Number optional

      time between running test.

    • [timeout] Number optional

      maximum wallclock time before failing test.

  • [callback] Function optional

    callback.

Properties

_waiting

Boolean private

Waiting for a command to finish?

connectionId

Numeric

Connection id for the server.

port

Numeric

ready

Boolean

Is system ready for commands?

timeout

Numeric

Timeout for commands