import {Actor} from '@serenity-js/core/lib/screenplay/actor'
public class | source

Constructor Summary

Public Constructor
public

Method Summary

Public Methods
public

abilityTo(doSomething: *): *

Retrieves actor's Ability to doSomething.

Please note that this method performs an instancepf check against abilities given to this actor via Actor#whoCan. Please also note that Actor#whoCan performs the same check when abilities are assigned to the actor to ensure the actor has at most one instance of a given ability type.

public

answer(answerable: Answerable<T>): Promise<T>

public

attemptsTo(activities: ...activities: Activity[]): Promise<void>

Instructs the actor to attempt to perform a number of activities (see Activity, so either Tasks or Interactions) one by one.

public

collect(artifact: Artifact, name: string | Name): void

Announce collection of an Artifact so that it can be picked up by a StageCrewMember.

public

dismiss(): Promise<void>

Instructs the actor to invoke Discardable#discard method on any Discardable Ability it's been configured with.

public

toString(): string

Returns a human-readable, string representation of this Actor

public

whoCan(abilities: ...Ability[]): Actor

Gives this Actor a list of abilities (see Ability) they can use to interact with the system under test or the test environment.

Public Constructors

public constructor() source

Public Methods

public abilityTo(doSomething: *): * source

Retrieves actor's Ability to doSomething.

Please note that this method performs an instancepf check against abilities given to this actor via Actor#whoCan. Please also note that Actor#whoCan performs the same check when abilities are assigned to the actor to ensure the actor has at most one instance of a given ability type.

Params:

NameTypeAttributeDescription
doSomething *

Returns:

*

public answer(answerable: Answerable<T>): Promise<T> source

Params:

NameTypeAttributeDescription
answerable Answerable<T>

a Question<Promise<T>>, Question<T>, Promise<T> or T

Returns:

Promise<T>

The answer to the Answerable

public attemptsTo(activities: ...activities: Activity[]): Promise<void> source

Instructs the actor to attempt to perform a number of activities (see Activity, so either Tasks or Interactions) one by one.

Params:

NameTypeAttributeDescription
activities ...activities: Activity[]

Returns:

Promise<void>

public collect(artifact: Artifact, name: string | Name): void source

Announce collection of an Artifact so that it can be picked up by a StageCrewMember.

Params:

NameTypeAttributeDescription
artifact Artifact
name string | Name
  • nullable: true

Returns:

void

public dismiss(): Promise<void> source

Instructs the actor to invoke Discardable#discard method on any Discardable Ability it's been configured with.

Returns:

Promise<void>

public toString(): string source

Returns a human-readable, string representation of this Actor

Returns:

string

public whoCan(abilities: ...Ability[]): Actor source

Gives this Actor a list of abilities (see Ability) they can use to interact with the system under test or the test environment.

Params:

NameTypeAttributeDescription
abilities ...Ability[]

A vararg list of abilities to give the actor

Returns:

Actor

The actor with newly gained abilities

Throws:

ConfigurationError

Throws a ConfigurationError if the actor already has an ability of this type.