Note
Extends:
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
- Note enables the actor to recall the answer to a given question
- Note enables the actor to recall the answer on a given subject
- Note complains if no answer to a given question has ever been remembered
- Note complains if no answer on a given subject has ever been remembered
Static Method Summary
Static Public Methods | ||
public static |
Retrieves the previously recorded answer to a given Question |
Constructor Summary
Public Constructor | ||
public |
constructor(topic: Question<Promise<Answer>> | Question<Answer> | string) |
Method Summary
Public Methods | ||
public |
answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<Answer> Makes the provided Actor answer this {Question}. |
Inherited Summary
From class Question | ||
public static |
Factory method that simplifies the process of defining custom questions. |
|
public static |
isAQuestion(maybeQuestion: any): boolean Checks if the value is a Question. |
|
public |
subject: * |
|
public |
describedAs(subject: string): Question<T> Changes the description of this question's subject. |
|
public | ||
public |
toString(): string Describes the subject of this Question. |
Static Public Methods
Public Constructors
public constructor(topic: Question<Promise<Answer>> | Question<Answer> | string) source
Override:
Question#constructorParams:
Name | Type | Attribute | Description |
topic | Question<Promise<Answer>> | Question<Answer> | string |