API Docs for: 0.0.9
Show:

Dalek.Unit Class

Defined in: lib/dalek/unit.js:68
Module: DalekJS

Generates an test instance

Methods

_emitAssertionStatus

() private chainable

Emits an event that describes the current state of all assertions

_emitConcreteTestFinished

() private chainable

Emits an event, that the current test run has been finished

_emitTestFinished

() private chainable

Emits an event that describes the current state of all assertions. The event should be fired when a test is finished

_inheritAssertions

(
  • test
)
private chainable

Copies assertion helper methods

Parameters:

  • test Test

    Instacne of test

_inheritAssertions

(
  • test
  • opts
)
private chainable

Set up the instance

Parameters:

  • test Test

    Instacne of test

  • opts Object

    Options

_inheritAssertions

(
  • test
)
private chainable

Copies assertion methods

Parameters:

  • test Test

    Instacne of test

_onDriverMessage

(
  • data
)
private chainable

Checks if the test run is complete & emits/resolves all the needed events/promises when the run is complete

Parameters:

  • data Object

    Data that is returned by the driver:message event

_reportTestStarted

(
  • name
)
private chainable

Emits the test started event

Parameters:

  • name String

    Name of the test

_testFin

() Object private

Kicks off the test & binds all promises/events

Returns:

Object:

promise A promise

_testFinished

(
  • result
)
Object private

Emits the test finished events & resolves all promises when its done

Parameters:

  • result Object

    Promised result var

Returns:

Object:

result Promised result var

_testStatus

() Bool private chainable

Get the overall test status (assertions & expectation)

Returns:

Bool:

status The test status

andThen

(
  • a
)
chainable

Allow to use custom functions in order to embrace code reuse across multiple files (for example for use in Page Objects).

Parameters:

  • a Function

    function, where 'this' references the test

checkAssertions

() Bool

Checks if all runned assertions passed

Returns:

Bool:

assertionFailed Any expectation failed

checkExpectations

() Bool

Checks if the runned tests fullfill the set expectations or if no expectations were raised

Returns:

Bool:

checkedExpectations Expectations match

data

(
  • key
  • value
)
Mixed chainable

Global data store (works between the node & browser envs)

Parameters:

  • key String | Number

    Key to store or fetch data

  • value Mixed

    optional Data that should be stored

Returns:

Mixed:

Data that has been stored

done

() Object private

Sets up all the bindings needed for a test to run

Returns:

Object:

result A promise

expect

(
  • expecatation
)
chainable

Specify how many assertions are expected to run within a test. Very useful for ensuring that all your callbacks and assertions are run.

Parameters:

  • expecatation Integer

    Number of assertions that should be run

incrementExpectations

() chainable

Increment the number of executed assertions

incrementFailedAssertions

() chainable

Increment the number of failed assertions

node

(
  • a
)
chainable

Adds a node style function (with node err callback) style to the test.

Parameters:

  • a Function

    node function that is executed in the context of the test.

promise

(
  • a
)
chainable

Adds a promise to the chain of tests.

Parameters:

  • a Promise

    q promise

start

() chainable

Alias for 'andThen'; use if it is the first function called in the test case.