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

Note

Enables the Actor to recall an answer to a given Question, recorded using TakeNote.

Extends:

Question → Note

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'))),
 );

Static Method Summary

Static Public Methods
public static

of(subject: Question<Promise<A>> | Question<A> | string): Note<A>

Retrieves the previously recorded answer to a given Question

Constructor Summary

Public Constructor
public

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

Method Summary

Public Methods
public

answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<Answer>

Makes the provided Actor answer this {Question}.

public

toString(): string

Description to be used when reporting this Question.

Inherited Summary

From class Question
public static

about(description: string, body: function(actor: AnswersQuestions & UsesAbilities): R): Question<R>

Factory method that simplifies the process of defining custom questions.

public static

isAQuestion(maybeQuestion: any): boolean

Checks if the value is a Question.

Static Public Methods

public static of(subject: Question<Promise<A>> | Question<A> | string): Note<A> source

Retrieves the previously recorded answer to a given Question

Params:

NameTypeAttributeDescription
subject Question<Promise<A>> | Question<A> | string

Returns:

Note<A>

Public Constructors

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

Params:

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

Public Methods

public answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<Answer> source

Makes the provided Actor answer this {Question}.

Params:

NameTypeAttributeDescription
actor AnswersQuestions & UsesAbilities

Returns:

Promise<Answer>

public toString(): string source

Description to be used when reporting this Question.

Returns:

string