Internationalisation
Bundled Plugins API
This
A token passed to test functions to allow them to indicate if a test run will complete asynchronously.

API Overview

API Documentation

Constants

state

Signature
cp.spec.Run.This.state
Type
Constant
Description
A collection of states that a Run.This can be in.
Notes
  • States include:
  • running - The Run is currently running and will terminate at the end of the function (synchrnonous).
  • waiting - The Run is waiting, and will terminate when done() is called. (asynchronous).
  • done - The Run is done.

Functions

Signature
cp.spec.Run.This.defaultTimeout([timeout]) -> number
Type
Function
Description
Gets and/or sets the default timeout for asynchronous tests.
Parameters
  • timeout - (optional) the new timeout, in seconds.
Returns
  • The current default timeout, in seconds.

Constructors

This

Signature
cp.spec.Run.This(run, actionFn, index) -> cp.spec.Run.This
Type
Constructor
Description
Creates a new Run.This instance for a Run.
Parameters
  • run - The Run.
  • actionFn - The action function to execute.
  • index - The index of the action in the current phase.
Returns
  • The new Run.This.

Methods

abort

Signature
cp.spec.Run.This:abort([message])
Type
Method
Description
Indicates the stage has aborted.
Parameters
  • message - The optional message to output.

cleanup

Signature
cp.spec.Run.This:cleanup()
Type
Method
Description
Cleans up This after a step.

done

Signature
cp.spec.Run.This:done()
Type
Method
Description
Indicates that the test is completed.
Signature
cp.spec.Run.This:expectAbort([messagePattern]) -> Run.This
Type
Method
Description
Indicates that this spec is expecting an abort/error to occur.
Parameters
  • messagePattern - The pattern to check the fail message against. If not provided, any message will match.
Returns
  • The same Run.This instance.
Signature
cp.spec.Run.This:expectFail([messagePattern]) -> Run.This
Type
Method
Description
Indicates that this spec is expecting an assert/fail to occur.
Parameters
  • messagePattern - The pattern to check the fail message against. If not provided, any message will match.
Returns
  • The same Run.This instance.

fail

Signature
cp.spec.Run.This:fail([message])
Type
Method
Description
Indicates the run has failed.
Parameters
  • message - The optional message to output.

isActive

Signature
cp.spec.Run.This:isActive() -> boolean
Type
Method
Description
Checks if the this is in an active state - either running or waiting.
Returns
  • true if isActive.

isDone

Signature
cp.spec.Run.This:isDone() -> boolean
Type
Method
Description
Returns true if this is done.

isWaiting

Signature
cp.spec.Run.This:isWaiting() -> boolean
Type
Method
Description
Checks if the Run is waiting for this execution to complete via the
Returns
  • true if the waiting.

log

Signature
cp.spec.Run.This:log(message[, ...])
Type
Method
Description
When the current Run is in debug mode, output the message to the console.
Parameters
  • message - the text message to output.
  • ... - optional parameters, to be injected into the message, ala string.format.

prepare

Signature
cp.spec.Run.This:prepare()
Type
Method
Description
Prepares this to run.

run

Signature
cp.spec.Run.This:run() -> cp.spec.Run
Type
Method
Description
Returns the current Run
Signature
cp.spec.Run.This:toObserver([onNext[, onError[, onCompleted]]) -> cp.rx.Observer
Type
Method
Description
Creates an Observer. If the onNext/onError/onCompleted functions are
Parameters
  • onNext - The next handler.
  • onError - The error handler.
  • onCompleted - The completed handler.

wait

Signature
cp.spec.Run.This:wait([timeout])
Type
Method
Description
Indicates that the test is continuing asynchronously, and will
Parameters
  • timeout - (optional) The number of seconds to wait before timing out.
Notes
Last modified 1mo ago