TakeNote
Extends:
Indirect Implements:
Examples:
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)))),
);
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'))),
);
Tests:
- TakeNotes usingAnEmptyNotepad enables the actor to take note of an answer to a given question and recall it later
- TakeNotes usingAnEmptyNotepad enables the actor to take note of an answer to a given question under a custom name
- TakeNotes usingAnEmptyNotepad
- TakeNotes usingAnEmptyNotepad
- TakeNotes usingASharedNotepad enables the actor to take note of an answer to a given question and recall it later
- TakeNotes usingASharedNotepad
- TakeNotes usingASharedNotepad
Static Method Summary
Static Public Methods | ||
public static |
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 |
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 Constructors
Public Methods
public as(subject: string): TakeNote<Answer> source
Sets a custom subject name to remember the answer as.
Params:
Name | Type | Attribute | Description |
subject | string |
public performAs(actor: UsesAbilities & AnswersQuestions): Promise<void> source
Makes the provided Actor perform this Interaction.
Params:
Name | Type | Attribute | Description |
actor | UsesAbilities & AnswersQuestions |
Returns:
Promise<void> |