Mixin: TimerSteps

TimerSteps

Steps to measure time.

These methods will be mixed with glacejs Steps class and available via its instance $ in tests.

Source:

Methods


checkTimer(condition)

Step to check timer.

Parameters:
Name Type Description
condition string | object

chaijs condition.

Source:
Throws:

If timer verification was failed.

Type
AssertionError
Example
$.startTimer();
$.checkTimer("to exist");

$.startTimer();
await $.pause(1, "sleep a bit");
$.checkTimer({ "to be gte": 1 });

getTimer()

Step to get timer.

Source:
Throws:

If timer is not started.

Type
AssertionError
Returns:

Number of seconds since timer starts.

Type
number
Example
$.startTimer();
await $.pause(1, "sleep a bit");
var elapsedSeconds = $.getTimer();

<async> pause(timeout, message)

Step to make pause in another step or test case. Good style is to not use directly in test case, only inside another step.

Parameters:
Name Type Description
timeout number

Pause time, sec.

message string

Pause reason.

Source:
Throws:

If pause message is not defined.

Type
AssertionError
Returns:
Type
Promise.<void>
Example
await $.pause(1, "wait for server start");

startTimer()

Step to start timer. Each time when it will be called, timer will be reset.

Source:
Example
$.startTimer();
await $.pause(1, "sleep a bit");
var elapsedSeconds = $.getTimer();

stopTimer()

Step to stop timer.

Source:
Example
$.stopTimer();