Skip to main content

externalCheck <Actual>

A flow control statement that enables an Actor to decide between two alternate series of activities.

Think of it as a Screenplay Pattern equivalent of the traditional if statement.

Choose between two alternative sequences of activities

import { equals } from '@serenity-js/assertions'
import { actorCalled, Check } from '@serenity-js/core'

await actorCalled('Chuck').attemptsTo(
Check.whether(process.env.MODE, equals('prod'))
.andIfSo(
LogInAsProdUser(),
)
.otherwise(
LogInAsTestUser(),
)
)

Perform a sequence of activities when a condition is met

import { actorCalled, Check } from '@serenity-js/core'
import { isVisible } from '@serenity-js/web'

await actorCalled('Chuck').attemptsTo(
Check.whether(CookieConsentBanner(), isVisible())
.andIfSo(
AcceptNecessaryCookies(),
)
)

Hierarchy

Index

Methods

staticexternalwhether

  • Type parameters

    • Actual_Type

    Parameters

    Returns { andIfSo: (...activities: Activity[]) => Check<Actual_Type> }

externalinstantiationLocation

  • instantiationLocation(): FileSystemLocation
  • Returns the location where this Activity was instantiated.


    Returns FileSystemLocation

externalotherwise

externalperformAs

externaldescribedBy

  • Resolves the description of this object in the context of the provided actor.


    Parameters

    Returns Promise<string>

externaltoString

  • toString(): string
  • Returns a human-readable description of this object.


    Returns string