externalTakeNotes <Notes_Type>
Hierarchy
- Ability
- TakeNotes
Index
Constructors
externalconstructor
Properties
publicexternalreadonlynotepad
Methods
staticexternalusingAnEmptyNotepad
Initialises an
Ability
toTakeNotes
withNotepad.empty
.Type parameters
- N: Record<any, any>
Returns TakeNotes<N>
staticexternalusing
Initialises an
Ability
toTakeNotes
using aNotepad.with
some initial state.Type parameters
- N: Record<any, any>
Parameters
externalnotepad: Notepad<N>
Returns TakeNotes<N>
externalabilityType
Returns the most abstract type of this Ability instance, specifically the first class in the inheritance hierarchy that directly extends the
Ability
class.import { Ability } from '@serenity-js/core';
class MyAbility extends Ability {}
class MySpecialisedAbility extends MyAbility {}
new MyAbility().abilityType(); // returns MyAbility
new MySpecialisedAbility().abilityType(); // returns MyAbilityReturns AbilityType<Ability>
externaltoJSON
Returns a JSON representation of the ability and its current state, if available. The purpose of this method is to enable reporting the state of the ability in a human-readable format, rather than to serialise and deserialise the ability itself.
Returns SerialisedAbility
An
Ability
that enables anActor
to remember information to be recalled during a test scenario.Under the hood,
TakeNotes
uses aNotepad
, which state can be populated both during initialisation or while the test scenario is executed. Populating the notepad when it's initialised can be useful to associate authentication credentials or personal details with a given actor, while dynamic recording of notes during a test scenario can be useful when the data to be recorded is not known upfront - for example when we want the actor to remember a JWT stored in the browser and then use it when sending API requests.Pro tip:
TakeNotes
,Notepad
andnotes
can be typed using TypeScript generics to help you avoid typos when specifying note names.See notes and
Notepad
for more usage examples.Remembering and retrieving a value
Using generics
Populating the notepad with initial state
Recording a dynamic note
Clearing a notepad before each test scenario (Mocha)
Clearing a notepad before each test scenario (Cucumber)
Importing notes from an API response
Using the QuestionAdapter
Learn more
Notepad