@serenity-js/core 3.25.0 → 3.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +1 -1
- package/lib/Serenity.d.ts +22 -22
- package/lib/Serenity.js +22 -22
- package/lib/adapter/OutputStream.d.ts +5 -4
- package/lib/adapter/OutputStream.d.ts.map +1 -1
- package/lib/adapter/TestRunnerAdapter.d.ts +2 -2
- package/lib/config/ClassDescription.d.ts +1 -1
- package/lib/config/SerenityConfig.d.ts +22 -20
- package/lib/config/SerenityConfig.d.ts.map +1 -1
- package/lib/config/SerenityConfig.js +22 -20
- package/lib/config/SerenityConfig.js.map +1 -1
- package/lib/errors/ErrorFactory.d.ts +2 -1
- package/lib/errors/ErrorFactory.d.ts.map +1 -1
- package/lib/errors/ErrorFactory.js +2 -1
- package/lib/errors/ErrorFactory.js.map +1 -1
- package/lib/errors/RaiseErrors.d.ts +9 -9
- package/lib/errors/RaiseErrors.js +9 -9
- package/lib/errors/diff/AnsiDiffFormatter.d.ts +1 -1
- package/lib/errors/diff/AnsiDiffFormatter.js +1 -1
- package/lib/errors/diff/DiffFormatter.d.ts +1 -1
- package/lib/errors/diff/NoOpDiffFormatter.d.ts +1 -1
- package/lib/errors/diff/NoOpDiffFormatter.js +1 -1
- package/lib/errors/model/AssertionError.d.ts +1 -1
- package/lib/errors/model/AssertionError.js +1 -1
- package/lib/errors/model/ConfigurationError.d.ts +1 -1
- package/lib/errors/model/ConfigurationError.js +1 -1
- package/lib/errors/model/ImplementationPendingError.d.ts +3 -3
- package/lib/errors/model/ImplementationPendingError.js +3 -3
- package/lib/errors/model/ListItemNotFoundError.d.ts +2 -2
- package/lib/errors/model/ListItemNotFoundError.js +2 -2
- package/lib/errors/model/LogicError.d.ts +2 -2
- package/lib/errors/model/LogicError.js +2 -2
- package/lib/errors/model/OperationInterruptedError.d.ts +2 -2
- package/lib/errors/model/OperationInterruptedError.js +2 -2
- package/lib/errors/model/RuntimeError.d.ts +2 -2
- package/lib/errors/model/RuntimeError.js +2 -2
- package/lib/errors/model/TestCompromisedError.d.ts +1 -1
- package/lib/errors/model/TestCompromisedError.js +1 -1
- package/lib/errors/model/TimeoutExpiredError.d.ts +2 -2
- package/lib/errors/model/TimeoutExpiredError.js +2 -2
- package/lib/errors/model/UnknownError.d.ts +1 -1
- package/lib/errors/model/UnknownError.js +1 -1
- package/lib/events/ActivityFinished.d.ts +1 -1
- package/lib/events/ActivityFinished.js +1 -1
- package/lib/events/ActivityStarts.d.ts +1 -1
- package/lib/events/ActivityStarts.js +1 -1
- package/lib/events/BusinessRuleDetected.d.ts +1 -1
- package/lib/events/BusinessRuleDetected.js +1 -1
- package/lib/events/SceneFinishes.d.ts +2 -1
- package/lib/events/SceneFinishes.d.ts.map +1 -1
- package/lib/events/SceneFinishes.js +2 -1
- package/lib/events/SceneFinishes.js.map +1 -1
- package/lib/instance.d.ts +30 -30
- package/lib/instance.js +30 -30
- package/lib/io/format.d.ts +15 -6
- package/lib/io/format.d.ts.map +1 -1
- package/lib/io/format.js +15 -6
- package/lib/io/format.js.map +1 -1
- package/lib/io/loader/ModuleLoader.d.ts +1 -1
- package/lib/io/loader/ModuleLoader.js +1 -1
- package/lib/io/reflection/ValueInspector.d.ts +1 -1
- package/lib/io/reflection/ValueInspector.js +2 -2
- package/lib/io/reflection/ValueInspector.js.map +1 -1
- package/lib/io/stringified.d.ts +1 -1
- package/lib/io/stringified.js +1 -1
- package/lib/io/trimmed.d.ts +1 -1
- package/lib/io/trimmed.js +1 -1
- package/lib/model/artifacts/HTTPRequestResponse.d.ts +2 -2
- package/lib/model/artifacts/HTTPRequestResponse.js +1 -1
- package/lib/screenplay/Activity.d.ts +10 -10
- package/lib/screenplay/Activity.js +5 -5
- package/lib/screenplay/Actor.d.ts +28 -28
- package/lib/screenplay/Actor.js +28 -28
- package/lib/screenplay/Answerable.d.ts +1 -1
- package/lib/screenplay/Answered.d.ts +2 -2
- package/lib/screenplay/Interaction.d.ts +17 -17
- package/lib/screenplay/Interaction.js +12 -12
- package/lib/screenplay/Optional.d.ts +1 -1
- package/lib/screenplay/Question.d.ts +48 -45
- package/lib/screenplay/Question.d.ts.map +1 -1
- package/lib/screenplay/Question.js +39 -36
- package/lib/screenplay/Question.js.map +1 -1
- package/lib/screenplay/RecursivelyAnswered.d.ts +2 -2
- package/lib/screenplay/Task.d.ts +19 -19
- package/lib/screenplay/Task.js +15 -15
- package/lib/screenplay/WithAnswerableProperties.d.ts +2 -2
- package/lib/screenplay/abilities/Ability.d.ts +48 -46
- package/lib/screenplay/abilities/Ability.d.ts.map +1 -1
- package/lib/screenplay/abilities/Ability.js +48 -46
- package/lib/screenplay/abilities/Ability.js.map +1 -1
- package/lib/screenplay/abilities/AbilityType.d.ts +5 -5
- package/lib/screenplay/abilities/AnswerQuestions.d.ts +3 -3
- package/lib/screenplay/abilities/AnswerQuestions.js +3 -3
- package/lib/screenplay/abilities/CanHaveAbilities.d.ts +4 -4
- package/lib/screenplay/abilities/Discardable.d.ts +8 -8
- package/lib/screenplay/abilities/Initialisable.d.ts +11 -11
- package/lib/screenplay/abilities/PerformActivities.d.ts +3 -3
- package/lib/screenplay/abilities/PerformActivities.js +3 -3
- package/lib/screenplay/abilities/UsesAbilities.d.ts +6 -6
- package/lib/screenplay/activities/PerformsActivities.d.ts +7 -7
- package/lib/screenplay/artifacts/CollectsArtifacts.d.ts +4 -5
- package/lib/screenplay/artifacts/CollectsArtifacts.d.ts.map +1 -1
- package/lib/screenplay/debugging/Debug.d.ts +7 -6
- package/lib/screenplay/debugging/Debug.d.ts.map +1 -1
- package/lib/screenplay/debugging/Debug.js +7 -6
- package/lib/screenplay/debugging/Debug.js.map +1 -1
- package/lib/screenplay/debugging/DebuggingResult.d.ts +1 -1
- package/lib/screenplay/debugging/Log.d.ts +7 -5
- package/lib/screenplay/debugging/Log.d.ts.map +1 -1
- package/lib/screenplay/debugging/Log.js +7 -5
- package/lib/screenplay/debugging/Log.js.map +1 -1
- package/lib/screenplay/notes/Notepad.d.ts +13 -13
- package/lib/screenplay/notes/Notepad.js +13 -13
- package/lib/screenplay/notes/NotepadAdapter.d.ts +16 -16
- package/lib/screenplay/notes/NotepadAdapter.js +16 -16
- package/lib/screenplay/notes/TakeNotes.d.ts +9 -9
- package/lib/screenplay/notes/TakeNotes.js +9 -9
- package/lib/screenplay/notes/notes.d.ts +6 -6
- package/lib/screenplay/notes/notes.js +6 -6
- package/lib/screenplay/questions/AnswersQuestions.d.ts +4 -4
- package/lib/screenplay/questions/ChainableMetaQuestion.d.ts +6 -6
- package/lib/screenplay/questions/Check.d.ts +2 -2
- package/lib/screenplay/questions/Check.js +2 -2
- package/lib/screenplay/questions/DescriptionFormattingOptions.d.ts +2 -2
- package/lib/screenplay/questions/Expectation.d.ts +17 -14
- package/lib/screenplay/questions/Expectation.d.ts.map +1 -1
- package/lib/screenplay/questions/Expectation.js +17 -14
- package/lib/screenplay/questions/Expectation.js.map +1 -1
- package/lib/screenplay/questions/List.d.ts +5 -5
- package/lib/screenplay/questions/List.js +5 -5
- package/lib/screenplay/questions/Masked.d.ts +4 -2
- package/lib/screenplay/questions/Masked.d.ts.map +1 -1
- package/lib/screenplay/questions/Masked.js +4 -2
- package/lib/screenplay/questions/Masked.js.map +1 -1
- package/lib/screenplay/questions/MetaQuestion.d.ts +9 -9
- package/lib/screenplay/questions/Unanswered.d.ts +2 -2
- package/lib/screenplay/questions/Unanswered.js +2 -2
- package/lib/screenplay/questions/expectations/ExpectationDetails.d.ts +1 -1
- package/lib/screenplay/questions/expectations/ExpectationDetails.js +1 -1
- package/lib/screenplay/questions/expectations/ExpectationMet.d.ts +1 -1
- package/lib/screenplay/questions/expectations/ExpectationMet.js +1 -1
- package/lib/screenplay/questions/expectations/ExpectationNotMet.d.ts +1 -1
- package/lib/screenplay/questions/expectations/ExpectationNotMet.js +1 -1
- package/lib/screenplay/questions/expectations/ExpectationOutcome.d.ts +2 -2
- package/lib/screenplay/questions/expectations/ExpectationOutcome.js +2 -2
- package/lib/screenplay/questions/tag-functions.d.ts +23 -21
- package/lib/screenplay/questions/tag-functions.d.ts.map +1 -1
- package/lib/screenplay/questions/tag-functions.js +5 -5
- package/lib/screenplay/questions/tag-functions.js.map +1 -1
- package/lib/screenplay/time/TellsTime.d.ts +4 -4
- package/lib/screenplay/time/abilities/ScheduleWork.d.ts +2 -2
- package/lib/screenplay/time/abilities/ScheduleWork.js +2 -2
- package/lib/screenplay/time/activities/Wait.d.ts +29 -27
- package/lib/screenplay/time/activities/Wait.d.ts.map +1 -1
- package/lib/screenplay/time/activities/Wait.js +29 -27
- package/lib/screenplay/time/activities/Wait.js.map +1 -1
- package/lib/screenplay/time/models/Clock.d.ts +4 -4
- package/lib/screenplay/time/models/Clock.js +4 -4
- package/lib/screenplay/time/models/Duration.d.ts +1 -1
- package/lib/screenplay/time/models/Duration.js +1 -1
- package/lib/screenplay/time/models/Timestamp.d.ts +2 -2
- package/lib/screenplay/time/models/Timestamp.js +2 -2
- package/lib/stage/Cast.d.ts +21 -21
- package/lib/stage/Cast.js +19 -19
- package/lib/stage/Extras.d.ts +1 -1
- package/lib/stage/Extras.js +1 -1
- package/lib/stage/ListensToDomainEvents.d.ts +7 -7
- package/lib/stage/Stage.d.ts +30 -30
- package/lib/stage/Stage.d.ts.map +1 -1
- package/lib/stage/Stage.js +30 -30
- package/lib/stage/Stage.js.map +1 -1
- package/lib/stage/StageCrewMember.d.ts +11 -11
- package/lib/stage/StageCrewMemberBuilder.d.ts +7 -7
- package/lib/stage/StageCrewMemberBuilderDependencies.d.ts +2 -2
- package/lib/stage/crew/artifact-archiver/ArtifactArchiver.d.ts +4 -4
- package/lib/stage/crew/artifact-archiver/ArtifactArchiver.js +4 -4
- package/lib/stage/crew/stream-reporter/StreamReporter.d.ts +7 -7
- package/lib/stage/crew/stream-reporter/StreamReporter.js +7 -7
- package/package.json +4 -4
- package/src/Serenity.ts +22 -22
- package/src/adapter/OutputStream.ts +5 -4
- package/src/adapter/TestRunnerAdapter.ts +2 -2
- package/src/config/ClassDescription.ts +1 -1
- package/src/config/SerenityConfig.ts +22 -20
- package/src/errors/ErrorFactory.ts +2 -1
- package/src/errors/ErrorSerialiser.ts +3 -3
- package/src/errors/RaiseErrors.ts +9 -9
- package/src/errors/diff/AnsiDiffFormatter.ts +1 -1
- package/src/errors/diff/DiffFormatter.ts +1 -1
- package/src/errors/diff/NoOpDiffFormatter.ts +1 -1
- package/src/errors/model/AssertionError.ts +1 -1
- package/src/errors/model/ConfigurationError.ts +1 -1
- package/src/errors/model/ImplementationPendingError.ts +3 -3
- package/src/errors/model/ListItemNotFoundError.ts +2 -2
- package/src/errors/model/LogicError.ts +2 -2
- package/src/errors/model/OperationInterruptedError.ts +2 -2
- package/src/errors/model/RuntimeError.ts +2 -2
- package/src/errors/model/TestCompromisedError.ts +1 -1
- package/src/errors/model/TimeoutExpiredError.ts +2 -2
- package/src/errors/model/UnknownError.ts +1 -1
- package/src/events/ActivityFinished.ts +1 -1
- package/src/events/ActivityStarts.ts +1 -1
- package/src/events/BusinessRuleDetected.ts +1 -1
- package/src/events/SceneFinishes.ts +2 -1
- package/src/instance.ts +30 -30
- package/src/io/format.ts +15 -6
- package/src/io/loader/ModuleLoader.ts +1 -1
- package/src/io/reflection/ValueInspector.ts +3 -3
- package/src/io/stringified.ts +1 -1
- package/src/io/trimmed.ts +1 -1
- package/src/model/artifacts/HTTPRequestResponse.ts +2 -2
- package/src/screenplay/Activity.ts +10 -10
- package/src/screenplay/Actor.ts +28 -28
- package/src/screenplay/Answerable.ts +1 -1
- package/src/screenplay/Answered.ts +2 -2
- package/src/screenplay/Interaction.ts +17 -17
- package/src/screenplay/Optional.ts +1 -1
- package/src/screenplay/Question.ts +48 -45
- package/src/screenplay/RecursivelyAnswered.ts +2 -2
- package/src/screenplay/Task.ts +19 -19
- package/src/screenplay/WithAnswerableProperties.ts +2 -2
- package/src/screenplay/abilities/Ability.ts +48 -46
- package/src/screenplay/abilities/AbilityType.ts +5 -5
- package/src/screenplay/abilities/AnswerQuestions.ts +3 -3
- package/src/screenplay/abilities/CanHaveAbilities.ts +4 -4
- package/src/screenplay/abilities/Discardable.ts +8 -8
- package/src/screenplay/abilities/Initialisable.ts +11 -11
- package/src/screenplay/abilities/PerformActivities.ts +3 -3
- package/src/screenplay/abilities/UsesAbilities.ts +6 -6
- package/src/screenplay/activities/PerformsActivities.ts +7 -7
- package/src/screenplay/artifacts/CollectsArtifacts.ts +4 -5
- package/src/screenplay/debugging/Debug.ts +7 -6
- package/src/screenplay/debugging/DebuggingResult.ts +1 -1
- package/src/screenplay/debugging/Log.ts +7 -5
- package/src/screenplay/notes/Notepad.ts +13 -13
- package/src/screenplay/notes/NotepadAdapter.ts +16 -16
- package/src/screenplay/notes/TakeNotes.ts +9 -9
- package/src/screenplay/notes/notes.ts +6 -6
- package/src/screenplay/questions/AnswersQuestions.ts +4 -4
- package/src/screenplay/questions/ChainableMetaQuestion.ts +6 -6
- package/src/screenplay/questions/Check.ts +2 -2
- package/src/screenplay/questions/DescriptionFormattingOptions.ts +2 -2
- package/src/screenplay/questions/Expectation.ts +17 -14
- package/src/screenplay/questions/List.ts +5 -5
- package/src/screenplay/questions/Masked.ts +4 -2
- package/src/screenplay/questions/MetaQuestion.ts +9 -9
- package/src/screenplay/questions/Unanswered.ts +2 -2
- package/src/screenplay/questions/expectations/ExpectationDetails.ts +1 -1
- package/src/screenplay/questions/expectations/ExpectationMet.ts +1 -1
- package/src/screenplay/questions/expectations/ExpectationNotMet.ts +1 -1
- package/src/screenplay/questions/expectations/ExpectationOutcome.ts +2 -2
- package/src/screenplay/questions/tag-functions.ts +23 -21
- package/src/screenplay/time/TellsTime.ts +4 -4
- package/src/screenplay/time/abilities/ScheduleWork.ts +2 -2
- package/src/screenplay/time/activities/Wait.ts +29 -27
- package/src/screenplay/time/models/Clock.ts +4 -4
- package/src/screenplay/time/models/Duration.ts +1 -1
- package/src/screenplay/time/models/Timestamp.ts +2 -2
- package/src/stage/Cast.ts +21 -21
- package/src/stage/Extras.ts +1 -1
- package/src/stage/ListensToDomainEvents.ts +7 -7
- package/src/stage/Stage.ts +30 -30
- package/src/stage/StageCrewMember.ts +11 -11
- package/src/stage/StageCrewMemberBuilder.ts +7 -7
- package/src/stage/StageCrewMemberBuilderDependencies.ts +2 -2
- package/src/stage/crew/artifact-archiver/ArtifactArchiver.ts +4 -4
- package/src/stage/crew/stream-reporter/StreamReporter.ts +7 -7
package/lib/screenplay/Actor.js
CHANGED
|
@@ -8,26 +8,26 @@ const model_1 = require("../model");
|
|
|
8
8
|
const abilities_1 = require("./abilities");
|
|
9
9
|
/**
|
|
10
10
|
* **Actors** represent **people** and **external systems** interacting with the system under test.
|
|
11
|
-
* Their role is to perform
|
|
11
|
+
* Their role is to perform [activities](https://serenity-js.org/api/core/class/Activity/) that demonstrate how to accomplish a given goal.
|
|
12
12
|
*
|
|
13
|
-
* Actors are the core building block of the [Screenplay Pattern](/handbook/design/screenplay-pattern),
|
|
14
|
-
* along with
|
|
13
|
+
* Actors are the core building block of the [Screenplay Pattern](https://serenity-js.org/handbook/design/screenplay-pattern),
|
|
14
|
+
* along with [abilities](https://serenity-js.org/api/core/class/Ability/), [interactions](https://serenity-js.org/api/core/class/Interaction/), [tasks](https://serenity-js.org/api/core/class/Task/), and [questions](https://serenity-js.org/api/core/class/Question/).
|
|
15
15
|
* Actors are also the first thing you see in a typical Serenity/JS test scenario.
|
|
16
16
|
*
|
|
17
|
-
* 
|
|
17
|
+
* 
|
|
18
18
|
*
|
|
19
19
|
* Learn more about:
|
|
20
|
-
* -
|
|
21
|
-
* -
|
|
22
|
-
* -
|
|
23
|
-
* -
|
|
24
|
-
* -
|
|
25
|
-
* -
|
|
26
|
-
* -
|
|
20
|
+
* - [`Cast`](https://serenity-js.org/api/core/class/Cast/)
|
|
21
|
+
* - [`Stage`](https://serenity-js.org/api/core/class/Stage/)
|
|
22
|
+
* - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
|
|
23
|
+
* - [`Activity`](https://serenity-js.org/api/core/class/Activity/)
|
|
24
|
+
* - [`Interaction`](https://serenity-js.org/api/core/class/Interaction/)
|
|
25
|
+
* - [`Task`](https://serenity-js.org/api/core/class/Task/)
|
|
26
|
+
* - [`Question`](https://serenity-js.org/api/core/class/Question/)
|
|
27
27
|
*
|
|
28
28
|
* ## Representing people and systems as actors
|
|
29
29
|
*
|
|
30
|
-
* To use a Serenity/JS
|
|
30
|
+
* To use a Serenity/JS [`Actor`](https://serenity-js.org/api/core/class/Actor/), all you need is to say their name:
|
|
31
31
|
*
|
|
32
32
|
* ```typescript
|
|
33
33
|
* import { actorCalled } from '@serenity-js/core'
|
|
@@ -36,8 +36,8 @@ const abilities_1 = require("./abilities");
|
|
|
36
36
|
* // returns: Actor
|
|
37
37
|
* ```
|
|
38
38
|
*
|
|
39
|
-
* Serenity/JS actors perform within the scope of a test scenario, so the first time you invoke
|
|
40
|
-
* Serenity/JS instantiates a new actor from the default
|
|
39
|
+
* Serenity/JS actors perform within the scope of a test scenario, so the first time you invoke [`actorCalled`](https://serenity-js.org/api/core/function/actorCalled/),
|
|
40
|
+
* Serenity/JS instantiates a new actor from the default [cast](https://serenity-js.org/api/core/class/Cast/) of actors (or any custom cast you might have [configured](https://serenity-js.org/api/core/function/configure/)).
|
|
41
41
|
* Any subsequent invocations of this function within the scope of the same test scenario retrieve the already instantiated actor, identified by their name.
|
|
42
42
|
*
|
|
43
43
|
* ```typescript
|
|
@@ -79,12 +79,12 @@ class Actor {
|
|
|
79
79
|
].forEach(ability => this.acquireAbility(ability));
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
|
-
* Retrieves actor's
|
|
82
|
+
* Retrieves actor's [`Ability`](https://serenity-js.org/api/core/class/Ability/) of `abilityType`, or one that extends `abilityType`.
|
|
83
83
|
*
|
|
84
|
-
* Please note that this method performs an
|
|
85
|
-
* given to this actor via
|
|
84
|
+
* Please note that this method performs an [`instanceof`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof) check against abilities
|
|
85
|
+
* given to this actor via [`Actor.whoCan`](https://serenity-js.org/api/core/class/Actor/#whoCan).
|
|
86
86
|
*
|
|
87
|
-
* Please also note that
|
|
87
|
+
* Please also note that [`Actor.whoCan`](https://serenity-js.org/api/core/class/Actor/#whoCan) performs the same check when abilities are assigned to the actor
|
|
88
88
|
* to ensure the actor has at most one instance of a given ability type.
|
|
89
89
|
*
|
|
90
90
|
* @param abilityType
|
|
@@ -99,8 +99,8 @@ class Actor {
|
|
|
99
99
|
return found;
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
-
* Instructs the actor to attempt to perform a number of
|
|
103
|
-
* so either
|
|
102
|
+
* Instructs the actor to attempt to perform a number of [activities](https://serenity-js.org/api/core/class/Activity/),
|
|
103
|
+
* so either [tasks](https://serenity-js.org/api/core/class/Task/) or [interactions](https://serenity-js.org/api/core/class/Interaction/)),
|
|
104
104
|
* one by one.
|
|
105
105
|
*
|
|
106
106
|
* @param {...activities: Activity[]} activities
|
|
@@ -113,7 +113,7 @@ class Actor {
|
|
|
113
113
|
}, this.initialiseAbilities());
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
|
-
* Gives this Actor a list of
|
|
116
|
+
* Gives this Actor a list of [abilities](https://serenity-js.org/api/core/class/Ability/) they can use
|
|
117
117
|
* to interact with the system under test or the test environment.
|
|
118
118
|
*
|
|
119
119
|
* @param abilities
|
|
@@ -122,7 +122,7 @@ class Actor {
|
|
|
122
122
|
* @returns
|
|
123
123
|
* The actor with newly gained abilities
|
|
124
124
|
*
|
|
125
|
-
* @throws
|
|
125
|
+
* @throws [`ConfigurationError`](https://serenity-js.org/api/core/class/ConfigurationError/)
|
|
126
126
|
* Throws a ConfigurationError if the actor already has an ability of this type.
|
|
127
127
|
*/
|
|
128
128
|
whoCan(...abilities) {
|
|
@@ -131,7 +131,7 @@ class Actor {
|
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
133
|
* @param answerable -
|
|
134
|
-
* An
|
|
134
|
+
* An [`Answerable`](https://serenity-js.org/api/core/#Answerable) to answer (resolve the value of).
|
|
135
135
|
*
|
|
136
136
|
* @returns
|
|
137
137
|
* The answer to the Answerable
|
|
@@ -152,8 +152,8 @@ class Actor {
|
|
|
152
152
|
return this.stage.currentTime();
|
|
153
153
|
}
|
|
154
154
|
/**
|
|
155
|
-
* Instructs the actor to invoke
|
|
156
|
-
*
|
|
155
|
+
* Instructs the actor to invoke [`Discardable.discard`](https://serenity-js.org/api/core/interface/Discardable/#discard) method on any
|
|
156
|
+
* [discardable](https://serenity-js.org/api/core/interface/Discardable/) [ability](https://serenity-js.org/api/core/class/Ability/) it's been configured with.
|
|
157
157
|
*/
|
|
158
158
|
dismiss() {
|
|
159
159
|
return this.findAbilitiesOfType('discard')
|
|
@@ -162,7 +162,7 @@ class Actor {
|
|
|
162
162
|
/**
|
|
163
163
|
* Returns a human-readable, string representation of this actor and their abilities.
|
|
164
164
|
*
|
|
165
|
-
* **PRO TIP:** To get the name of the actor, use
|
|
165
|
+
* **PRO TIP:** To get the name of the actor, use [`Actor.name`](https://serenity-js.org/api/core/class/Actor/#name)
|
|
166
166
|
*/
|
|
167
167
|
toString() {
|
|
168
168
|
const abilities = Array.from(this.abilities.values()).map(ability => ability.constructor.name);
|
|
@@ -201,8 +201,8 @@ class Actor {
|
|
|
201
201
|
: this.mostGenericTypeOf(parentType);
|
|
202
202
|
}
|
|
203
203
|
/**
|
|
204
|
-
* Instantiates a
|
|
205
|
-
* or returns the argument if it's already an instance of
|
|
204
|
+
* Instantiates a `Name` based on the string value of the parameter,
|
|
205
|
+
* or returns the argument if it's already an instance of `Name`.
|
|
206
206
|
*
|
|
207
207
|
* @param maybeName
|
|
208
208
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Question } from './Question';
|
|
2
2
|
/**
|
|
3
3
|
* A union type that provides a convenient way to represent any value
|
|
4
|
-
* that can be resolved by
|
|
4
|
+
* that can be resolved by [`Actor.answer`](https://serenity-js.org/api/core/class/Actor/#answer).
|
|
5
5
|
*
|
|
6
6
|
* @group Questions
|
|
7
7
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Question } from './Question';
|
|
2
2
|
/**
|
|
3
|
-
* Describes the type of answer a given
|
|
4
|
-
* resolve to when given to
|
|
3
|
+
* Describes the type of answer a given [`Answerable`](https://serenity-js.org/api/core/#Answerable) would
|
|
4
|
+
* resolve to when given to [`Actor.answer`](https://serenity-js.org/api/core/class/Actor/#answer).
|
|
5
5
|
*
|
|
6
6
|
* ```ts
|
|
7
7
|
* Answered<Answerable<T>> === T
|
|
@@ -4,34 +4,34 @@ import type { Answerable } from './Answerable';
|
|
|
4
4
|
import type { CollectsArtifacts } from './artifacts';
|
|
5
5
|
import type { AnswersQuestions } from './questions';
|
|
6
6
|
/**
|
|
7
|
-
* **Interactions** are low-level
|
|
8
|
-
* a handful of instructions for an
|
|
7
|
+
* **Interactions** are low-level [activities](https://serenity-js.org/api/core/class/Activity/) that encapsulate
|
|
8
|
+
* a handful of instructions for an [actor](https://serenity-js.org/api/core/class/Actor/) on how to use their [abilities](https://serenity-js.org/api/core/class/Ability/)
|
|
9
9
|
* to perform an individual interaction with the given interface of the system under test.
|
|
10
10
|
*
|
|
11
11
|
* :::tip Tasks or interactions?
|
|
12
12
|
* Because of their low-level nature, interactions are named using the vocabulary of the [solution domain](https://blog.mattwynne.net/2013/01/17/the-problem-with-solutions/),
|
|
13
|
-
* and represent an individual interaction with the given interface, e.g.
|
|
13
|
+
* and represent an individual interaction with the given interface, e.g. [`Click`](https://serenity-js.org/api/web/class/Click/), [`Enter`](https://serenity-js.org/api/web/class/Enter/), or [`Send`](https://serenity-js.org/api/rest/class/Send/).
|
|
14
14
|
*
|
|
15
15
|
* Interactions follow the [Single Responsibility Principle](https://en.wikipedia.org/wiki/Single_responsibility_principle) which means that they do _one thing and one thing only_.
|
|
16
16
|
* If you're considering implementing an "interaction" that performs more than one logical activity, e.g. checks if the button is visible and then clicks on it if is,
|
|
17
|
-
* consider using separate interactions for separate responsibilities and then composing them using a
|
|
17
|
+
* consider using separate interactions for separate responsibilities and then composing them using a [task](https://serenity-js.org/api/core/class/Task/).
|
|
18
18
|
* :::
|
|
19
19
|
*
|
|
20
|
-
* Interactions are the core building block of the [Screenplay Pattern](/handbook/design/screenplay-pattern),
|
|
21
|
-
* along with
|
|
20
|
+
* Interactions are the core building block of the [Screenplay Pattern](https://serenity-js.org/handbook/design/screenplay-pattern),
|
|
21
|
+
* along with [actors](https://serenity-js.org/api/core/class/Actor/), [abilities](https://serenity-js.org/api/core/class/Ability/), [questions](https://serenity-js.org/api/core/class/Question/), and [tasks](https://serenity-js.org/api/core/class/Task/).
|
|
22
22
|
*
|
|
23
|
-
* 
|
|
23
|
+
* 
|
|
24
24
|
*
|
|
25
25
|
* Learn more about:
|
|
26
|
-
* -
|
|
27
|
-
* -
|
|
28
|
-
* -
|
|
26
|
+
* - [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
27
|
+
* - [Abilities](https://serenity-js.org/api/core/class/Ability/)
|
|
28
|
+
* - [Activities](https://serenity-js.org/api/core/class/Activity/)
|
|
29
29
|
*
|
|
30
30
|
* ## Writing a custom interaction
|
|
31
31
|
*
|
|
32
|
-
* [Serenity/JS modules](/handbook/
|
|
32
|
+
* [Serenity/JS modules](https://serenity-js.org/handbook/getting-started/architecture) ship with dozens of interactions to help you compose your test scenarios.
|
|
33
33
|
* However, if you need to interact with a non-standard interface, or want to create a flavour of a given interaction that behaves slightly differently than the built-in version,
|
|
34
|
-
* you can easily create your own implementations using the
|
|
34
|
+
* you can easily create your own implementations using the [`Interaction.where`](https://serenity-js.org/api/core/class/Interaction/#where) factory method.
|
|
35
35
|
*
|
|
36
36
|
* ```ts
|
|
37
37
|
* import { Actor, Interaction, the } from '@serenity-js/core'
|
|
@@ -76,13 +76,13 @@ export declare abstract class Interaction extends Activity {
|
|
|
76
76
|
*/
|
|
77
77
|
static where(description: Answerable<string>, interaction: (actor: UsesAbilities & AnswersQuestions & CollectsArtifacts) => Promise<void> | void): Interaction;
|
|
78
78
|
/**
|
|
79
|
-
* Instructs the provided
|
|
79
|
+
* Instructs the provided [`Actor`](https://serenity-js.org/api/core/class/Actor/) to perform this [`Interaction`](https://serenity-js.org/api/core/class/Interaction/).
|
|
80
80
|
*
|
|
81
81
|
* #### Learn more
|
|
82
|
-
* -
|
|
83
|
-
* -
|
|
84
|
-
* -
|
|
85
|
-
* -
|
|
82
|
+
* - [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
83
|
+
* - [`PerformsActivities`](https://serenity-js.org/api/core/interface/PerformsActivities/)
|
|
84
|
+
* - [`UsesAbilities`](https://serenity-js.org/api/core/interface/UsesAbilities/)
|
|
85
|
+
* - [`AnswersQuestions`](https://serenity-js.org/api/core/interface/AnswersQuestions/)
|
|
86
86
|
*
|
|
87
87
|
* @param actor
|
|
88
88
|
*/
|
|
@@ -3,34 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Interaction = void 0;
|
|
4
4
|
const Activity_1 = require("./Activity");
|
|
5
5
|
/**
|
|
6
|
-
* **Interactions** are low-level
|
|
7
|
-
* a handful of instructions for an
|
|
6
|
+
* **Interactions** are low-level [activities](https://serenity-js.org/api/core/class/Activity/) that encapsulate
|
|
7
|
+
* a handful of instructions for an [actor](https://serenity-js.org/api/core/class/Actor/) on how to use their [abilities](https://serenity-js.org/api/core/class/Ability/)
|
|
8
8
|
* to perform an individual interaction with the given interface of the system under test.
|
|
9
9
|
*
|
|
10
10
|
* :::tip Tasks or interactions?
|
|
11
11
|
* Because of their low-level nature, interactions are named using the vocabulary of the [solution domain](https://blog.mattwynne.net/2013/01/17/the-problem-with-solutions/),
|
|
12
|
-
* and represent an individual interaction with the given interface, e.g.
|
|
12
|
+
* and represent an individual interaction with the given interface, e.g. [`Click`](https://serenity-js.org/api/web/class/Click/), [`Enter`](https://serenity-js.org/api/web/class/Enter/), or [`Send`](https://serenity-js.org/api/rest/class/Send/).
|
|
13
13
|
*
|
|
14
14
|
* Interactions follow the [Single Responsibility Principle](https://en.wikipedia.org/wiki/Single_responsibility_principle) which means that they do _one thing and one thing only_.
|
|
15
15
|
* If you're considering implementing an "interaction" that performs more than one logical activity, e.g. checks if the button is visible and then clicks on it if is,
|
|
16
|
-
* consider using separate interactions for separate responsibilities and then composing them using a
|
|
16
|
+
* consider using separate interactions for separate responsibilities and then composing them using a [task](https://serenity-js.org/api/core/class/Task/).
|
|
17
17
|
* :::
|
|
18
18
|
*
|
|
19
|
-
* Interactions are the core building block of the [Screenplay Pattern](/handbook/design/screenplay-pattern),
|
|
20
|
-
* along with
|
|
19
|
+
* Interactions are the core building block of the [Screenplay Pattern](https://serenity-js.org/handbook/design/screenplay-pattern),
|
|
20
|
+
* along with [actors](https://serenity-js.org/api/core/class/Actor/), [abilities](https://serenity-js.org/api/core/class/Ability/), [questions](https://serenity-js.org/api/core/class/Question/), and [tasks](https://serenity-js.org/api/core/class/Task/).
|
|
21
21
|
*
|
|
22
|
-
* 
|
|
22
|
+
* 
|
|
23
23
|
*
|
|
24
24
|
* Learn more about:
|
|
25
|
-
* -
|
|
26
|
-
* -
|
|
27
|
-
* -
|
|
25
|
+
* - [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
26
|
+
* - [Abilities](https://serenity-js.org/api/core/class/Ability/)
|
|
27
|
+
* - [Activities](https://serenity-js.org/api/core/class/Activity/)
|
|
28
28
|
*
|
|
29
29
|
* ## Writing a custom interaction
|
|
30
30
|
*
|
|
31
|
-
* [Serenity/JS modules](/handbook/
|
|
31
|
+
* [Serenity/JS modules](https://serenity-js.org/handbook/getting-started/architecture) ship with dozens of interactions to help you compose your test scenarios.
|
|
32
32
|
* However, if you need to interact with a non-standard interface, or want to create a flavour of a given interaction that behaves slightly differently than the built-in version,
|
|
33
|
-
* you can easily create your own implementations using the
|
|
33
|
+
* you can easily create your own implementations using the [`Interaction.where`](https://serenity-js.org/api/core/class/Interaction/#where) factory method.
|
|
34
34
|
*
|
|
35
35
|
* ```ts
|
|
36
36
|
* import { Actor, Interaction, the } from '@serenity-js/core'
|
|
@@ -18,7 +18,7 @@ import type { Answerable } from './Answerable';
|
|
|
18
18
|
*/
|
|
19
19
|
export interface Optional {
|
|
20
20
|
/**
|
|
21
|
-
* Returns an
|
|
21
|
+
* Returns an [`Answerable`](https://serenity-js.org/api/core/#Answerable) that resolves to `true` when the optional value
|
|
22
22
|
* is present, `false` otherwise.
|
|
23
23
|
*/
|
|
24
24
|
isPresent(): Answerable<boolean>;
|
|
@@ -12,18 +12,20 @@ import type { MetaQuestion } from './questions/MetaQuestion';
|
|
|
12
12
|
import type { RecursivelyAnswered } from './RecursivelyAnswered';
|
|
13
13
|
import type { WithAnswerableProperties } from './WithAnswerableProperties';
|
|
14
14
|
/**
|
|
15
|
-
* **Questions** describe how
|
|
15
|
+
* **Questions** describe how [actors](https://serenity-js.org/api/core/class/Actor/) should query the system under test or the test environment to retrieve some information.
|
|
16
16
|
*
|
|
17
|
-
* Questions are the core building block of the [Screenplay Pattern](/handbook/design/screenplay-pattern),
|
|
18
|
-
* along with
|
|
17
|
+
* Questions are the core building block of the [Screenplay Pattern](https://serenity-js.org/handbook/design/screenplay-pattern),
|
|
18
|
+
* along with [actors](https://serenity-js.org/api/core/class/Actor/), [abilities](https://serenity-js.org/api/core/class/Ability/),
|
|
19
|
+
* [interactions](https://serenity-js.org/api/core/class/Interaction/),
|
|
20
|
+
* and [tasks](https://serenity-js.org/api/core/class/Task/).
|
|
19
21
|
*
|
|
20
|
-
* 
|
|
22
|
+
* 
|
|
21
23
|
*
|
|
22
24
|
* Learn more about:
|
|
23
|
-
* -
|
|
24
|
-
* -
|
|
25
|
-
* -
|
|
26
|
-
* -
|
|
25
|
+
* - [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
26
|
+
* - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
|
|
27
|
+
* - [`Interaction`](https://serenity-js.org/api/core/class/Interaction/)
|
|
28
|
+
* - [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter)
|
|
27
29
|
*
|
|
28
30
|
* ## Implementing a basic custom Question
|
|
29
31
|
*
|
|
@@ -43,10 +45,10 @@ import type { WithAnswerableProperties } from './WithAnswerableProperties';
|
|
|
43
45
|
*
|
|
44
46
|
* ## Implementing a Question that uses an Ability
|
|
45
47
|
*
|
|
46
|
-
* Just like the
|
|
47
|
-
* also can use
|
|
48
|
+
* Just like the [interactions](https://serenity-js.org/api/core/class/Interaction/), a [`Question`](https://serenity-js.org/api/core/class/Question/)
|
|
49
|
+
* also can use [actor's](https://serenity-js.org/api/core/class/Actor/) [abilities](https://serenity-js.org/api/core/class/Ability/).
|
|
48
50
|
*
|
|
49
|
-
* Here, we use the ability to
|
|
51
|
+
* Here, we use the ability to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) to retrieve a property of
|
|
50
52
|
* an HTTP response.
|
|
51
53
|
*
|
|
52
54
|
* ```ts
|
|
@@ -60,15 +62,15 @@ import type { WithAnswerableProperties } from './WithAnswerableProperties';
|
|
|
60
62
|
* ```
|
|
61
63
|
*
|
|
62
64
|
* #### Learn more
|
|
63
|
-
* -
|
|
64
|
-
* -
|
|
65
|
+
* - [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/)
|
|
66
|
+
* - [`LastResponse`](https://serenity-js.org/api/rest/class/LastResponse/)
|
|
65
67
|
*
|
|
66
68
|
* ## Mapping answers to other questions
|
|
67
69
|
*
|
|
68
|
-
* Apart from retrieving information,
|
|
70
|
+
* Apart from retrieving information, [questions](https://serenity-js.org/api/core/class/Question/) can be used to transform information retrieved by other questions.
|
|
69
71
|
*
|
|
70
|
-
* Here, we use the factory method
|
|
71
|
-
* answer
|
|
72
|
+
* Here, we use the factory method [`Question.about`](https://serenity-js.org/api/core/class/Question/#about) to produce a question that makes the received [actor](https://serenity-js.org/api/core/class/Actor/)
|
|
73
|
+
* answer [`LastResponse.status`](https://serenity-js.org/api/rest/class/LastResponse/#status) and then compare it against some expected value.
|
|
72
74
|
*
|
|
73
75
|
* ```ts
|
|
74
76
|
* import { actorCalled, AnswersQuestions, UsesAbilities, Question } from '@serenity-js/core'
|
|
@@ -91,7 +93,7 @@ import type { WithAnswerableProperties } from './WithAnswerableProperties';
|
|
|
91
93
|
* ```
|
|
92
94
|
*
|
|
93
95
|
* Note that the above example is for demonstration purposes only, Serenity/JS provides an easier way to
|
|
94
|
-
* verify the response status of the
|
|
96
|
+
* verify the response status of the [`LastResponse`](https://serenity-js.org/api/rest/class/LastResponse/):
|
|
95
97
|
*
|
|
96
98
|
* ```ts
|
|
97
99
|
* import { actorCalled } from '@serenity-js/core'
|
|
@@ -128,9 +130,10 @@ export declare abstract class Question<T> extends Describable {
|
|
|
128
130
|
static about<Answer_Type, Supported_Context_Type>(description: Answerable<string>, body: (actor: AnswersQuestions & UsesAbilities) => Promise<Answer_Type> | Answer_Type, metaQuestionBody: (answerable: Answerable<Supported_Context_Type>) => Question<Promise<Answer_Type>> | Question<Answer_Type>): MetaQuestionAdapter<Supported_Context_Type, Awaited<Answer_Type>>;
|
|
129
131
|
static about<Answer_Type>(description: Answerable<string>, body: (actor: AnswersQuestions & UsesAbilities) => Promise<Answer_Type> | Answer_Type): QuestionAdapter<Awaited<Answer_Type>>;
|
|
130
132
|
/**
|
|
131
|
-
* Generates a
|
|
132
|
-
* any
|
|
133
|
-
* including
|
|
133
|
+
* Generates a [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter) that recursively resolves
|
|
134
|
+
* any [`Answerable`](https://serenity-js.org/api/core/#Answerable) fields of the provided object,
|
|
135
|
+
* including [`Answerable`](https://serenity-js.org/api/core/#Answerable) fields
|
|
136
|
+
* of [nested objects](https://serenity-js.org/api/core/#WithAnswerableProperties).
|
|
134
137
|
*
|
|
135
138
|
* Optionally, the method accepts `overrides` to be shallow-merged with the fields of the original `source`,
|
|
136
139
|
* producing a new merged object.
|
|
@@ -183,35 +186,35 @@ export declare abstract class Question<T> extends Describable {
|
|
|
183
186
|
* ```
|
|
184
187
|
*
|
|
185
188
|
* #### Learn more
|
|
186
|
-
* -
|
|
187
|
-
* -
|
|
188
|
-
* -
|
|
189
|
+
* - [`WithAnswerableProperties`](https://serenity-js.org/api/core/#WithAnswerableProperties)
|
|
190
|
+
* - [`RecursivelyAnswered`](https://serenity-js.org/api/core/#RecursivelyAnswered)
|
|
191
|
+
* - [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
189
192
|
*
|
|
190
193
|
* @param source
|
|
191
194
|
* @param overrides
|
|
192
195
|
*/
|
|
193
196
|
static fromObject<Source_Type extends object>(source: Answerable<WithAnswerableProperties<Source_Type>>, ...overrides: Array<Answerable<Partial<WithAnswerableProperties<Source_Type>>>>): QuestionAdapter<RecursivelyAnswered<Source_Type>>;
|
|
194
197
|
/**
|
|
195
|
-
* Generates a
|
|
196
|
-
* any
|
|
198
|
+
* Generates a [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter) that resolves
|
|
199
|
+
* any [`Answerable`](https://serenity-js.org/api/core/#Answerable) elements of the provided array.
|
|
197
200
|
*/
|
|
198
201
|
static fromArray<Source_Type>(source: Array<Answerable<Source_Type>>, options?: DescriptionFormattingOptions): QuestionAdapter<Source_Type[]>;
|
|
199
202
|
/**
|
|
200
|
-
* Checks if the value is a
|
|
203
|
+
* Checks if the value is a [`Question`](https://serenity-js.org/api/core/class/Question/).
|
|
201
204
|
*
|
|
202
205
|
* @param maybeQuestion
|
|
203
206
|
* The value to check
|
|
204
207
|
*/
|
|
205
208
|
static isAQuestion<T>(maybeQuestion: unknown): maybeQuestion is Question<T>;
|
|
206
209
|
/**
|
|
207
|
-
* Checks if the value is a
|
|
210
|
+
* Checks if the value is a [`MetaQuestion`](https://serenity-js.org/api/core/interface/MetaQuestion/).
|
|
208
211
|
*
|
|
209
212
|
* @param maybeMetaQuestion
|
|
210
213
|
* The value to check
|
|
211
214
|
*/
|
|
212
215
|
static isAMetaQuestion<CT, RQT extends Question<unknown>>(maybeMetaQuestion: unknown): maybeMetaQuestion is MetaQuestion<CT, RQT>;
|
|
213
216
|
/**
|
|
214
|
-
* Creates a
|
|
217
|
+
* Creates a [`MetaQuestion`](https://serenity-js.org/api/core/interface/MetaQuestion/) that can be composed with any [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
215
218
|
* to produce a single-line description of its value.
|
|
216
219
|
*
|
|
217
220
|
* ```ts
|
|
@@ -233,11 +236,11 @@ export declare abstract class Question<T> extends Describable {
|
|
|
233
236
|
*/
|
|
234
237
|
static formattedValue(options?: DescriptionFormattingOptions): MetaQuestion<any, Question<Promise<string>>>;
|
|
235
238
|
/**
|
|
236
|
-
* Creates a
|
|
237
|
-
* to return its value when the answerable is a
|
|
239
|
+
* Creates a [`MetaQuestion`](https://serenity-js.org/api/core/interface/MetaQuestion/) that can be composed with any [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
240
|
+
* to return its value when the answerable is a [`Question`](https://serenity-js.org/api/core/class/Question/),
|
|
238
241
|
* or the answerable itself otherwise.
|
|
239
242
|
*
|
|
240
|
-
* The description of the resulting question is produced by calling
|
|
243
|
+
* The description of the resulting question is produced by calling [`Question.describedBy`](https://serenity-js.org/api/core/class/Question/#describedBy) on the
|
|
241
244
|
* provided answerable.
|
|
242
245
|
*
|
|
243
246
|
* ```ts
|
|
@@ -264,18 +267,18 @@ export declare abstract class Question<T> extends Describable {
|
|
|
264
267
|
private static staticFieldDescription;
|
|
265
268
|
private static methodDescription;
|
|
266
269
|
/**
|
|
267
|
-
* Instructs the provided
|
|
270
|
+
* Instructs the provided [`Actor`](https://serenity-js.org/api/core/class/Actor/) to use their [abilities](https://serenity-js.org/api/core/class/Ability/)
|
|
268
271
|
* to answer this question.
|
|
269
272
|
*/
|
|
270
273
|
abstract answeredBy(actor: AnswersQuestions & UsesAbilities): T;
|
|
271
274
|
/**
|
|
272
|
-
* Changes the description of this object, as returned by
|
|
273
|
-
* and
|
|
275
|
+
* Changes the description of this object, as returned by [`Describable.describedBy`](https://serenity-js.org/api/core/class/Describable/#describedBy)
|
|
276
|
+
* and [`Describable.toString`](https://serenity-js.org/api/core/class/Describable/#toString).
|
|
274
277
|
*
|
|
275
278
|
* @param description
|
|
276
279
|
* Replaces the current description according to the following rules:
|
|
277
|
-
* - If `description` is an
|
|
278
|
-
* - If `description` is a
|
|
280
|
+
* - If `description` is an [`Answerable`](https://serenity-js.org/api/core/#Answerable), it replaces the current description
|
|
281
|
+
* - If `description` is a [`MetaQuestion`](https://serenity-js.org/api/core/interface/MetaQuestion/), the current description is passed as `context` to `description.of(context)`, and the result replaces the current description
|
|
279
282
|
*/
|
|
280
283
|
describedAs(description: Answerable<string> | MetaQuestion<Awaited<T>, Question<Promise<string>>>): this;
|
|
281
284
|
/**
|
|
@@ -296,9 +299,9 @@ declare global {
|
|
|
296
299
|
}
|
|
297
300
|
}
|
|
298
301
|
/**
|
|
299
|
-
* Describes an object recursively wrapped in
|
|
300
|
-
* - both methods and fields of the wrapped object can be used as
|
|
301
|
-
* - method parameters of the wrapped object will accept
|
|
302
|
+
* Describes an object recursively wrapped in [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter) proxies, so that:
|
|
303
|
+
* - both methods and fields of the wrapped object can be used as [questions](https://serenity-js.org/api/core/class/Question/) or [interactions](https://serenity-js.org/api/core/class/Interaction/)
|
|
304
|
+
* - method parameters of the wrapped object will accept [`Answerable<T>`](https://serenity-js.org/api/core/#Answerable)
|
|
302
305
|
*
|
|
303
306
|
* @group Questions
|
|
304
307
|
*/
|
|
@@ -308,10 +311,10 @@ export type QuestionAdapterFieldDecorator<Original_Type> = {
|
|
|
308
311
|
}) => QuestionAdapter<Awaited<OriginalMethodResult>> : Original_Type[Field] extends number | bigint | boolean | string | symbol | object ? QuestionAdapter<Awaited<Original_Type[Field]>> : any;
|
|
309
312
|
};
|
|
310
313
|
/**
|
|
311
|
-
* A union type representing a proxy object returned by
|
|
314
|
+
* A union type representing a proxy object returned by [`Question.about`](https://serenity-js.org/api/core/class/Question/#about).
|
|
312
315
|
*
|
|
313
|
-
*
|
|
314
|
-
* allowing them to be used as either a
|
|
316
|
+
* [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter) proxies the methods and fields of the wrapped object recursively,
|
|
317
|
+
* allowing them to be used as either a [`Question`](https://serenity-js.org/api/core/class/Question/) or an [`Interaction`](https://serenity-js.org/api/core/class/Interaction/).
|
|
315
318
|
*
|
|
316
319
|
* @group Questions
|
|
317
320
|
*/
|
|
@@ -319,8 +322,8 @@ export type QuestionAdapter<Answer_Type> = Question<Promise<Answer_Type>> & Inte
|
|
|
319
322
|
isPresent(): Question<Promise<boolean>>;
|
|
320
323
|
} & QuestionAdapterFieldDecorator<Answer_Type>;
|
|
321
324
|
/**
|
|
322
|
-
* An extension of
|
|
323
|
-
* of the wrapped object can also act as a
|
|
325
|
+
* An extension of [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter), that in addition to proxying methods and fields
|
|
326
|
+
* of the wrapped object can also act as a [`MetaQuestion`](https://serenity-js.org/api/core/interface/MetaQuestion/).
|
|
324
327
|
*
|
|
325
328
|
* @group Questions
|
|
326
329
|
*/
|
|
@@ -333,7 +336,7 @@ declare class QuestionStatement<Answer_Type> extends Interaction implements Ques
|
|
|
333
336
|
private answer;
|
|
334
337
|
constructor(subject: Answerable<string>, body: (actor: AnswersQuestions & UsesAbilities, ...Parameters: any[]) => Promise<Answer_Type> | Answer_Type, location?: FileSystemLocation);
|
|
335
338
|
/**
|
|
336
|
-
* Returns a Question that resolves to `true` if resolving the
|
|
339
|
+
* Returns a Question that resolves to `true` if resolving the `QuestionStatement`
|
|
337
340
|
* returns a value other than `null` or `undefined`, and doesn't throw errors.
|
|
338
341
|
*/
|
|
339
342
|
isPresent(): Question<Promise<boolean>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Question.d.ts","sourceRoot":"","sources":["../../src/screenplay/Question.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AAC7F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAE3E
|
|
1
|
+
{"version":3,"file":"Question.d.ts","sourceRoot":"","sources":["../../src/screenplay/Question.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO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