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

TakeNote

Enables the Actor to remember an answer to a given Question, and recall it later.

Extends:

Interaction → TakeNote

Indirect Implements:

Examples:

Using default subject name based on the name of the question
 import { actorCalled, Note, TakeNote, TakeNotes } from '@serenity-js/core'
 import { BrowseTheWeb, Target, Text } from '@serenity-js/protractor'
 import { by, protractor } from 'protractor';

 class Vouchers {
     static code             = Target.the('voucher code').located(by.id('voucher'));
     static appliedVoucher   = Target.the('voucher code').located(by.id('applied-voucher'));
 }

 const actor = actorCalled('Noah').whoCan(
     TakeNotes.usingAnEmptyNotepad(),
     BrowseTheWeb.using(protractor.browser),
 );

 actor.attemptsTo(
     TakeNote.of(Text.of(Vouchers.code)),
     // ... add the product to a basket, go to checkout, etc.
     Ensure.that(Text.of(Vouchers.appliedVoucher), equals(Note.of(Text.of(Vouchers.code)))),
 );
Using custom subject name
 actor.attemptsTo(
     TakeNote.of(Text.of(Vouchers.code)).as('voucher code'),
     // ... add the product to a basket, go to checkout, etc.
     Ensure.that(Text.of(Vouchers.appliedVoucher), equals(Note.of('voucher code'))),
 );

See also:

Static Method Summary

Static Public Methods
public static

of(question: Question<Promise<A>>|Question<A>): TakeNote<A>

Instructs the Actor to remember the answer to a given question

Constructor Summary

Public Constructor
public

constructor(question: Question<Promise<Answer>>|Question<Answer>, subject: string)

Method Summary

Public Methods
public

as(subject: string): TakeNote<Answer>

Sets a custom subject name to remember the answer as.

public

performAs(actor: UsesAbilities & AnswersQuestions): Promise<void>

Makes the provided Actor perform this Interaction.

public

toString(): string

Generates a description to be used when reporting this Activity.

Inherited Summary

From class Interaction
public static

where(description: string, interaction: Function): Interaction

Static Public Methods

public static of(question: Question<Promise<A>>|Question<A>): TakeNote<A> source

Instructs the Actor to remember the answer to a given question

Params:

NameTypeAttributeDescription
question Question<Promise<A>>|Question<A>

Returns:

TakeNote<A>

Public Constructors

public constructor(question: Question<Promise<Answer>>|Question<Answer>, subject: string) source

Params:

NameTypeAttributeDescription
question Question<Promise<Answer>>|Question<Answer>
subject string

Public Methods

public as(subject: string): TakeNote<Answer> source

Sets a custom subject name to remember the answer as.

Params:

NameTypeAttributeDescription
subject string

Returns:

TakeNote<Answer>

public performAs(actor: UsesAbilities & AnswersQuestions): Promise<void> source

Makes the provided Actor perform this Interaction.

Params:

NameTypeAttributeDescription
actor UsesAbilities & AnswersQuestions

Returns:

Promise<void>

public toString(): string source

Generates a description to be used when reporting this Activity.

Returns:

string