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

Task

Aggregates Interactions so that they represents logical steps of a business process an Actor can perform.

Direct Subclasses:

src/screenplay/Task.ts~DynamicallyGeneratedTask, src/screenplay/Task.ts~NotImplementedTask

Implements:

Static Method Summary

Static Public Methods
public static

where(description: string, activities: Activity[]): Task

A factory method to make defining the Tasks more convenient.

Static Public Methods

public static where(description: string, activities: Activity[]): Task source

A factory method to make defining the Tasks more convenient. Please note that calling this method without providing the list of Activity objects will result in producing a Task that's marked as "pending" in the test report.

This feature is useful when you want to quickly write down a task that will be needed in the scenario, but you're not yet sure what activities will constitute it.

Params:

NameTypeAttributeDescription
description string

A description to be used when reporting this task

activities Activity[]

A list of lower-level activities that constitute the task

Returns:

Task

Examples:

Modelling a task
import { Log, Task } from '@serenity-js/core';

const Debug = (something: Answerable<any>) =>
    Task.where(`#actor prints the answer to a question`,
         Log.the(something),
    );
Modelling a not implemented task
import { Task } from '@serenity-js/core';

const SignUp = () =>
    Task.where(`#actor signs up for a newsletter`); // no activities given
                                                    // => task marked as pending