@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
|
@@ -3,7 +3,7 @@ import type { JSONObject } from 'tiny-types';
|
|
|
3
3
|
import { JSONData } from './JSONData';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* The value of the
|
|
6
|
+
* The value of the `HTTPRequestResponse` artifact describing an HTTP request/response pair.
|
|
7
7
|
*/
|
|
8
8
|
export interface RequestAndResponse extends JSONObject {
|
|
9
9
|
request: {
|
|
@@ -22,7 +22,7 @@ export interface RequestAndResponse extends JSONObject {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* An
|
|
25
|
+
* An artifact describing a HTTP request/response pair.
|
|
26
26
|
*/
|
|
27
27
|
export class HTTPRequestResponse extends JSONData {
|
|
28
28
|
static fromJSON(value: RequestAndResponse): HTTPRequestResponse {
|
|
@@ -9,12 +9,12 @@ import type { AnswersQuestions } from './questions/AnswersQuestions';
|
|
|
9
9
|
import { Describable } from './questions/Describable';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* **Activities** represents
|
|
12
|
+
* **Activities** represents [tasks](https://serenity-js.org/api/core/class/Task/) and [interactions](https://serenity-js.org/api/core/class/Interaction/) to be performed by an [actor](https://serenity-js.org/api/core/class/Actor/).
|
|
13
13
|
*
|
|
14
14
|
* Learn more about:
|
|
15
|
-
* - [Performing activities at multiple levels](/handbook/design/screenplay-pattern#performing-activities-at-multiple-levels)
|
|
16
|
-
* -
|
|
17
|
-
* -
|
|
15
|
+
* - [Performing activities at multiple levels](https://serenity-js.org/handbook/design/screenplay-pattern#performing-activities-at-multiple-levels)
|
|
16
|
+
* - [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
17
|
+
* - [`PerformsActivities`](https://serenity-js.org/api/core/interface/PerformsActivities/)
|
|
18
18
|
* - [Command design pattern on Wikipedia](https://en.wikipedia.org/wiki/Command_pattern)
|
|
19
19
|
*
|
|
20
20
|
* @group Screenplay Pattern
|
|
@@ -33,22 +33,22 @@ export abstract class Activity extends Describable {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* Returns the location where this
|
|
36
|
+
* Returns the location where this [`Activity`](https://serenity-js.org/api/core/class/Activity/) was instantiated.
|
|
37
37
|
*/
|
|
38
38
|
instantiationLocation(): FileSystemLocation {
|
|
39
39
|
return this.#location;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* Instructs the provided
|
|
43
|
+
* Instructs the provided [`Actor`](https://serenity-js.org/api/core/class/Actor/) to perform this [`Activity`](https://serenity-js.org/api/core/class/Activity/).
|
|
44
44
|
*
|
|
45
45
|
* @param actor
|
|
46
46
|
*
|
|
47
47
|
* #### Learn more
|
|
48
|
-
* -
|
|
49
|
-
* -
|
|
50
|
-
* -
|
|
51
|
-
* -
|
|
48
|
+
* - [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
49
|
+
* - [`PerformsActivities`](https://serenity-js.org/api/core/interface/PerformsActivities/)
|
|
50
|
+
* - [`UsesAbilities`](https://serenity-js.org/api/core/interface/UsesAbilities/)
|
|
51
|
+
* - [`AnswersQuestions`](https://serenity-js.org/api/core/interface/AnswersQuestions/)
|
|
52
52
|
*/
|
|
53
53
|
abstract performAs(actor: PerformsActivities | UsesAbilities | AnswersQuestions): Promise<any>;
|
|
54
54
|
|
package/src/screenplay/Actor.ts
CHANGED
|
@@ -25,26 +25,26 @@ import type { TellsTime, Timestamp } from './time';
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* **Actors** represent **people** and **external systems** interacting with the system under test.
|
|
28
|
-
* Their role is to perform
|
|
28
|
+
* Their role is to perform [activities](https://serenity-js.org/api/core/class/Activity/) that demonstrate how to accomplish a given goal.
|
|
29
29
|
*
|
|
30
|
-
* Actors are the core building block of the [Screenplay Pattern](/handbook/design/screenplay-pattern),
|
|
31
|
-
* along with
|
|
30
|
+
* Actors are the core building block of the [Screenplay Pattern](https://serenity-js.org/handbook/design/screenplay-pattern),
|
|
31
|
+
* 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/).
|
|
32
32
|
* Actors are also the first thing you see in a typical Serenity/JS test scenario.
|
|
33
33
|
*
|
|
34
|
-
* 
|
|
34
|
+
* 
|
|
35
35
|
*
|
|
36
36
|
* Learn more about:
|
|
37
|
-
* -
|
|
38
|
-
* -
|
|
39
|
-
* -
|
|
40
|
-
* -
|
|
41
|
-
* -
|
|
42
|
-
* -
|
|
43
|
-
* -
|
|
37
|
+
* - [`Cast`](https://serenity-js.org/api/core/class/Cast/)
|
|
38
|
+
* - [`Stage`](https://serenity-js.org/api/core/class/Stage/)
|
|
39
|
+
* - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
|
|
40
|
+
* - [`Activity`](https://serenity-js.org/api/core/class/Activity/)
|
|
41
|
+
* - [`Interaction`](https://serenity-js.org/api/core/class/Interaction/)
|
|
42
|
+
* - [`Task`](https://serenity-js.org/api/core/class/Task/)
|
|
43
|
+
* - [`Question`](https://serenity-js.org/api/core/class/Question/)
|
|
44
44
|
*
|
|
45
45
|
* ## Representing people and systems as actors
|
|
46
46
|
*
|
|
47
|
-
* To use a Serenity/JS
|
|
47
|
+
* To use a Serenity/JS [`Actor`](https://serenity-js.org/api/core/class/Actor/), all you need is to say their name:
|
|
48
48
|
*
|
|
49
49
|
* ```typescript
|
|
50
50
|
* import { actorCalled } from '@serenity-js/core'
|
|
@@ -53,8 +53,8 @@ import type { TellsTime, Timestamp } from './time';
|
|
|
53
53
|
* // returns: Actor
|
|
54
54
|
* ```
|
|
55
55
|
*
|
|
56
|
-
* Serenity/JS actors perform within the scope of a test scenario, so the first time you invoke
|
|
57
|
-
* Serenity/JS instantiates a new actor from the default
|
|
56
|
+
* 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/),
|
|
57
|
+
* 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/)).
|
|
58
58
|
* Any subsequent invocations of this function within the scope of the same test scenario retrieve the already instantiated actor, identified by their name.
|
|
59
59
|
*
|
|
60
60
|
* ```typescript
|
|
@@ -104,12 +104,12 @@ export class Actor implements PerformsActivities,
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* Retrieves actor's
|
|
107
|
+
* Retrieves actor's [`Ability`](https://serenity-js.org/api/core/class/Ability/) of `abilityType`, or one that extends `abilityType`.
|
|
108
108
|
*
|
|
109
|
-
* Please note that this method performs an
|
|
110
|
-
* given to this actor via
|
|
109
|
+
* Please note that this method performs an [`instanceof`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof) check against abilities
|
|
110
|
+
* given to this actor via [`Actor.whoCan`](https://serenity-js.org/api/core/class/Actor/#whoCan).
|
|
111
111
|
*
|
|
112
|
-
* Please also note that
|
|
112
|
+
* 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
|
|
113
113
|
* to ensure the actor has at most one instance of a given ability type.
|
|
114
114
|
*
|
|
115
115
|
* @param abilityType
|
|
@@ -129,8 +129,8 @@ export class Actor implements PerformsActivities,
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
|
-
* Instructs the actor to attempt to perform a number of
|
|
133
|
-
* so either
|
|
132
|
+
* Instructs the actor to attempt to perform a number of [activities](https://serenity-js.org/api/core/class/Activity/),
|
|
133
|
+
* so either [tasks](https://serenity-js.org/api/core/class/Task/) or [interactions](https://serenity-js.org/api/core/class/Interaction/)),
|
|
134
134
|
* one by one.
|
|
135
135
|
*
|
|
136
136
|
* @param {...activities: Activity[]} activities
|
|
@@ -144,7 +144,7 @@ export class Actor implements PerformsActivities,
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
|
-
* Gives this Actor a list of
|
|
147
|
+
* Gives this Actor a list of [abilities](https://serenity-js.org/api/core/class/Ability/) they can use
|
|
148
148
|
* to interact with the system under test or the test environment.
|
|
149
149
|
*
|
|
150
150
|
* @param abilities
|
|
@@ -153,7 +153,7 @@ export class Actor implements PerformsActivities,
|
|
|
153
153
|
* @returns
|
|
154
154
|
* The actor with newly gained abilities
|
|
155
155
|
*
|
|
156
|
-
* @throws
|
|
156
|
+
* @throws [`ConfigurationError`](https://serenity-js.org/api/core/class/ConfigurationError/)
|
|
157
157
|
* Throws a ConfigurationError if the actor already has an ability of this type.
|
|
158
158
|
*/
|
|
159
159
|
whoCan(...abilities: Ability[]): Actor {
|
|
@@ -164,7 +164,7 @@ export class Actor implements PerformsActivities,
|
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
166
|
* @param answerable -
|
|
167
|
-
* An
|
|
167
|
+
* An [`Answerable`](https://serenity-js.org/api/core/#Answerable) to answer (resolve the value of).
|
|
168
168
|
*
|
|
169
169
|
* @returns
|
|
170
170
|
* The answer to the Answerable
|
|
@@ -194,8 +194,8 @@ export class Actor implements PerformsActivities,
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
/**
|
|
197
|
-
* Instructs the actor to invoke
|
|
198
|
-
*
|
|
197
|
+
* Instructs the actor to invoke [`Discardable.discard`](https://serenity-js.org/api/core/interface/Discardable/#discard) method on any
|
|
198
|
+
* [discardable](https://serenity-js.org/api/core/interface/Discardable/) [ability](https://serenity-js.org/api/core/class/Ability/) it's been configured with.
|
|
199
199
|
*/
|
|
200
200
|
dismiss(): Promise<void> {
|
|
201
201
|
return this.findAbilitiesOfType<Discardable>('discard')
|
|
@@ -209,7 +209,7 @@ export class Actor implements PerformsActivities,
|
|
|
209
209
|
/**
|
|
210
210
|
* Returns a human-readable, string representation of this actor and their abilities.
|
|
211
211
|
*
|
|
212
|
-
* **PRO TIP:** To get the name of the actor, use
|
|
212
|
+
* **PRO TIP:** To get the name of the actor, use [`Actor.name`](https://serenity-js.org/api/core/class/Actor/#name)
|
|
213
213
|
*/
|
|
214
214
|
toString(): string {
|
|
215
215
|
const abilities = Array.from(this.abilities.values()).map(ability => ability.constructor.name);
|
|
@@ -268,8 +268,8 @@ export class Actor implements PerformsActivities,
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
/**
|
|
271
|
-
* Instantiates a
|
|
272
|
-
* or returns the argument if it's already an instance of
|
|
271
|
+
* Instantiates a `Name` based on the string value of the parameter,
|
|
272
|
+
* or returns the argument if it's already an instance of `Name`.
|
|
273
273
|
*
|
|
274
274
|
* @param maybeName
|
|
275
275
|
*/
|
|
@@ -2,7 +2,7 @@ import type { Question } from './Question';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A union type that provides a convenient way to represent any value
|
|
5
|
-
* that can be resolved by
|
|
5
|
+
* that can be resolved by [`Actor.answer`](https://serenity-js.org/api/core/class/Actor/#answer).
|
|
6
6
|
*
|
|
7
7
|
* @group Questions
|
|
8
8
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Question } from './Question';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Describes the type of answer a given
|
|
5
|
-
* resolve to when given to
|
|
4
|
+
* Describes the type of answer a given [`Answerable`](https://serenity-js.org/api/core/#Answerable) would
|
|
5
|
+
* resolve to when given to [`Actor.answer`](https://serenity-js.org/api/core/class/Actor/#answer).
|
|
6
6
|
*
|
|
7
7
|
* ```ts
|
|
8
8
|
* Answered<Answerable<T>> === T
|
|
@@ -5,34 +5,34 @@ import type { CollectsArtifacts } from './artifacts';
|
|
|
5
5
|
import type { AnswersQuestions } from './questions';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* **Interactions** are low-level
|
|
9
|
-
* a handful of instructions for an
|
|
8
|
+
* **Interactions** are low-level [activities](https://serenity-js.org/api/core/class/Activity/) that encapsulate
|
|
9
|
+
* 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/)
|
|
10
10
|
* to perform an individual interaction with the given interface of the system under test.
|
|
11
11
|
*
|
|
12
12
|
* :::tip Tasks or interactions?
|
|
13
13
|
* 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/),
|
|
14
|
-
* and represent an individual interaction with the given interface, e.g.
|
|
14
|
+
* 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/).
|
|
15
15
|
*
|
|
16
16
|
* 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_.
|
|
17
17
|
* 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,
|
|
18
|
-
* consider using separate interactions for separate responsibilities and then composing them using a
|
|
18
|
+
* consider using separate interactions for separate responsibilities and then composing them using a [task](https://serenity-js.org/api/core/class/Task/).
|
|
19
19
|
* :::
|
|
20
20
|
*
|
|
21
|
-
* Interactions are the core building block of the [Screenplay Pattern](/handbook/design/screenplay-pattern),
|
|
22
|
-
* along with
|
|
21
|
+
* Interactions are the core building block of the [Screenplay Pattern](https://serenity-js.org/handbook/design/screenplay-pattern),
|
|
22
|
+
* 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/).
|
|
23
23
|
*
|
|
24
|
-
* 
|
|
24
|
+
* 
|
|
25
25
|
*
|
|
26
26
|
* Learn more about:
|
|
27
|
-
* -
|
|
28
|
-
* -
|
|
29
|
-
* -
|
|
27
|
+
* - [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
28
|
+
* - [Abilities](https://serenity-js.org/api/core/class/Ability/)
|
|
29
|
+
* - [Activities](https://serenity-js.org/api/core/class/Activity/)
|
|
30
30
|
*
|
|
31
31
|
* ## Writing a custom interaction
|
|
32
32
|
*
|
|
33
|
-
* [Serenity/JS modules](/handbook/
|
|
33
|
+
* [Serenity/JS modules](https://serenity-js.org/handbook/getting-started/architecture) ship with dozens of interactions to help you compose your test scenarios.
|
|
34
34
|
* 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,
|
|
35
|
-
* you can easily create your own implementations using the
|
|
35
|
+
* you can easily create your own implementations using the [`Interaction.where`](https://serenity-js.org/api/core/class/Interaction/#where) factory method.
|
|
36
36
|
*
|
|
37
37
|
* ```ts
|
|
38
38
|
* import { Actor, Interaction, the } from '@serenity-js/core'
|
|
@@ -84,13 +84,13 @@ export abstract class Interaction extends Activity {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
* Instructs the provided
|
|
87
|
+
* Instructs the provided [`Actor`](https://serenity-js.org/api/core/class/Actor/) to perform this [`Interaction`](https://serenity-js.org/api/core/class/Interaction/).
|
|
88
88
|
*
|
|
89
89
|
* #### Learn more
|
|
90
|
-
* -
|
|
91
|
-
* -
|
|
92
|
-
* -
|
|
93
|
-
* -
|
|
90
|
+
* - [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
91
|
+
* - [`PerformsActivities`](https://serenity-js.org/api/core/interface/PerformsActivities/)
|
|
92
|
+
* - [`UsesAbilities`](https://serenity-js.org/api/core/interface/UsesAbilities/)
|
|
93
|
+
* - [`AnswersQuestions`](https://serenity-js.org/api/core/interface/AnswersQuestions/)
|
|
94
94
|
*
|
|
95
95
|
* @param actor
|
|
96
96
|
*/
|
|
@@ -19,7 +19,7 @@ import type { Answerable } from './Answerable';
|
|
|
19
19
|
*/
|
|
20
20
|
export interface Optional {
|
|
21
21
|
/**
|
|
22
|
-
* Returns an
|
|
22
|
+
* Returns an [`Answerable`](https://serenity-js.org/api/core/#Answerable) that resolves to `true` when the optional value
|
|
23
23
|
* is present, `false` otherwise.
|
|
24
24
|
*/
|
|
25
25
|
isPresent(): Answerable<boolean>;
|
|
@@ -18,18 +18,20 @@ import type { RecursivelyAnswered } from './RecursivelyAnswered';
|
|
|
18
18
|
import type { WithAnswerableProperties } from './WithAnswerableProperties';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* **Questions** describe how
|
|
21
|
+
* **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.
|
|
22
22
|
*
|
|
23
|
-
* Questions are the core building block of the [Screenplay Pattern](/handbook/design/screenplay-pattern),
|
|
24
|
-
* along with
|
|
23
|
+
* Questions are the core building block of the [Screenplay Pattern](https://serenity-js.org/handbook/design/screenplay-pattern),
|
|
24
|
+
* along with [actors](https://serenity-js.org/api/core/class/Actor/), [abilities](https://serenity-js.org/api/core/class/Ability/),
|
|
25
|
+
* [interactions](https://serenity-js.org/api/core/class/Interaction/),
|
|
26
|
+
* and [tasks](https://serenity-js.org/api/core/class/Task/).
|
|
25
27
|
*
|
|
26
|
-
* 
|
|
28
|
+
* 
|
|
27
29
|
*
|
|
28
30
|
* Learn more about:
|
|
29
|
-
* -
|
|
30
|
-
* -
|
|
31
|
-
* -
|
|
32
|
-
* -
|
|
31
|
+
* - [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
32
|
+
* - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
|
|
33
|
+
* - [`Interaction`](https://serenity-js.org/api/core/class/Interaction/)
|
|
34
|
+
* - [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter)
|
|
33
35
|
*
|
|
34
36
|
* ## Implementing a basic custom Question
|
|
35
37
|
*
|
|
@@ -49,10 +51,10 @@ import type { WithAnswerableProperties } from './WithAnswerableProperties';
|
|
|
49
51
|
*
|
|
50
52
|
* ## Implementing a Question that uses an Ability
|
|
51
53
|
*
|
|
52
|
-
* Just like the
|
|
53
|
-
* also can use
|
|
54
|
+
* Just like the [interactions](https://serenity-js.org/api/core/class/Interaction/), a [`Question`](https://serenity-js.org/api/core/class/Question/)
|
|
55
|
+
* also can use [actor's](https://serenity-js.org/api/core/class/Actor/) [abilities](https://serenity-js.org/api/core/class/Ability/).
|
|
54
56
|
*
|
|
55
|
-
* Here, we use the ability to
|
|
57
|
+
* Here, we use the ability to [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/) to retrieve a property of
|
|
56
58
|
* an HTTP response.
|
|
57
59
|
*
|
|
58
60
|
* ```ts
|
|
@@ -66,15 +68,15 @@ import type { WithAnswerableProperties } from './WithAnswerableProperties';
|
|
|
66
68
|
* ```
|
|
67
69
|
*
|
|
68
70
|
* #### Learn more
|
|
69
|
-
* -
|
|
70
|
-
* -
|
|
71
|
+
* - [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/)
|
|
72
|
+
* - [`LastResponse`](https://serenity-js.org/api/rest/class/LastResponse/)
|
|
71
73
|
*
|
|
72
74
|
* ## Mapping answers to other questions
|
|
73
75
|
*
|
|
74
|
-
* Apart from retrieving information,
|
|
76
|
+
* Apart from retrieving information, [questions](https://serenity-js.org/api/core/class/Question/) can be used to transform information retrieved by other questions.
|
|
75
77
|
*
|
|
76
|
-
* Here, we use the factory method
|
|
77
|
-
* answer
|
|
78
|
+
* 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/)
|
|
79
|
+
* answer [`LastResponse.status`](https://serenity-js.org/api/rest/class/LastResponse/#status) and then compare it against some expected value.
|
|
78
80
|
*
|
|
79
81
|
* ```ts
|
|
80
82
|
* import { actorCalled, AnswersQuestions, UsesAbilities, Question } from '@serenity-js/core'
|
|
@@ -97,7 +99,7 @@ import type { WithAnswerableProperties } from './WithAnswerableProperties';
|
|
|
97
99
|
* ```
|
|
98
100
|
*
|
|
99
101
|
* Note that the above example is for demonstration purposes only, Serenity/JS provides an easier way to
|
|
100
|
-
* verify the response status of the
|
|
102
|
+
* verify the response status of the [`LastResponse`](https://serenity-js.org/api/rest/class/LastResponse/):
|
|
101
103
|
*
|
|
102
104
|
* ```ts
|
|
103
105
|
* import { actorCalled } from '@serenity-js/core'
|
|
@@ -157,9 +159,10 @@ export abstract class Question<T> extends Describable {
|
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
/**
|
|
160
|
-
* Generates a
|
|
161
|
-
* any
|
|
162
|
-
* including
|
|
162
|
+
* Generates a [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter) that recursively resolves
|
|
163
|
+
* any [`Answerable`](https://serenity-js.org/api/core/#Answerable) fields of the provided object,
|
|
164
|
+
* including [`Answerable`](https://serenity-js.org/api/core/#Answerable) fields
|
|
165
|
+
* of [nested objects](https://serenity-js.org/api/core/#WithAnswerableProperties).
|
|
163
166
|
*
|
|
164
167
|
* Optionally, the method accepts `overrides` to be shallow-merged with the fields of the original `source`,
|
|
165
168
|
* producing a new merged object.
|
|
@@ -212,9 +215,9 @@ export abstract class Question<T> extends Describable {
|
|
|
212
215
|
* ```
|
|
213
216
|
*
|
|
214
217
|
* #### Learn more
|
|
215
|
-
* -
|
|
216
|
-
* -
|
|
217
|
-
* -
|
|
218
|
+
* - [`WithAnswerableProperties`](https://serenity-js.org/api/core/#WithAnswerableProperties)
|
|
219
|
+
* - [`RecursivelyAnswered`](https://serenity-js.org/api/core/#RecursivelyAnswered)
|
|
220
|
+
* - [`Answerable`](https://serenity-js.org/api/core/#Answerable)
|
|
218
221
|
*
|
|
219
222
|
* @param source
|
|
220
223
|
* @param overrides
|
|
@@ -241,8 +244,8 @@ export abstract class Question<T> extends Describable {
|
|
|
241
244
|
}
|
|
242
245
|
|
|
243
246
|
/**
|
|
244
|
-
* Generates a
|
|
245
|
-
* any
|
|
247
|
+
* Generates a [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter) that resolves
|
|
248
|
+
* any [`Answerable`](https://serenity-js.org/api/core/#Answerable) elements of the provided array.
|
|
246
249
|
*/
|
|
247
250
|
static fromArray<Source_Type>(source: Array<Answerable<Source_Type>>, options?: DescriptionFormattingOptions): QuestionAdapter<Source_Type[]> {
|
|
248
251
|
const formatter = new ValueFormatter(ValueFormatter.defaultOptions);
|
|
@@ -265,7 +268,7 @@ export abstract class Question<T> extends Describable {
|
|
|
265
268
|
}
|
|
266
269
|
|
|
267
270
|
/**
|
|
268
|
-
* Checks if the value is a
|
|
271
|
+
* Checks if the value is a [`Question`](https://serenity-js.org/api/core/class/Question/).
|
|
269
272
|
*
|
|
270
273
|
* @param maybeQuestion
|
|
271
274
|
* The value to check
|
|
@@ -276,7 +279,7 @@ export abstract class Question<T> extends Describable {
|
|
|
276
279
|
}
|
|
277
280
|
|
|
278
281
|
/**
|
|
279
|
-
* Checks if the value is a
|
|
282
|
+
* Checks if the value is a [`MetaQuestion`](https://serenity-js.org/api/core/interface/MetaQuestion/).
|
|
280
283
|
*
|
|
281
284
|
* @param maybeMetaQuestion
|
|
282
285
|
* The value to check
|
|
@@ -288,7 +291,7 @@ export abstract class Question<T> extends Describable {
|
|
|
288
291
|
}
|
|
289
292
|
|
|
290
293
|
/**
|
|
291
|
-
* Creates a
|
|
294
|
+
* 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)
|
|
292
295
|
* to produce a single-line description of its value.
|
|
293
296
|
*
|
|
294
297
|
* ```ts
|
|
@@ -313,11 +316,11 @@ export abstract class Question<T> extends Describable {
|
|
|
313
316
|
}
|
|
314
317
|
|
|
315
318
|
/**
|
|
316
|
-
* Creates a
|
|
317
|
-
* to return its value when the answerable is a
|
|
319
|
+
* 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)
|
|
320
|
+
* to return its value when the answerable is a [`Question`](https://serenity-js.org/api/core/class/Question/),
|
|
318
321
|
* or the answerable itself otherwise.
|
|
319
322
|
*
|
|
320
|
-
* The description of the resulting question is produced by calling
|
|
323
|
+
* The description of the resulting question is produced by calling [`Question.describedBy`](https://serenity-js.org/api/core/class/Question/#describedBy) on the
|
|
321
324
|
* provided answerable.
|
|
322
325
|
*
|
|
323
326
|
* ```ts
|
|
@@ -474,19 +477,19 @@ export abstract class Question<T> extends Describable {
|
|
|
474
477
|
}
|
|
475
478
|
|
|
476
479
|
/**
|
|
477
|
-
* Instructs the provided
|
|
480
|
+
* Instructs the provided [`Actor`](https://serenity-js.org/api/core/class/Actor/) to use their [abilities](https://serenity-js.org/api/core/class/Ability/)
|
|
478
481
|
* to answer this question.
|
|
479
482
|
*/
|
|
480
483
|
abstract answeredBy(actor: AnswersQuestions & UsesAbilities): T;
|
|
481
484
|
|
|
482
485
|
/**
|
|
483
|
-
* Changes the description of this object, as returned by
|
|
484
|
-
* and
|
|
486
|
+
* Changes the description of this object, as returned by [`Describable.describedBy`](https://serenity-js.org/api/core/class/Describable/#describedBy)
|
|
487
|
+
* and [`Describable.toString`](https://serenity-js.org/api/core/class/Describable/#toString).
|
|
485
488
|
*
|
|
486
489
|
* @param description
|
|
487
490
|
* Replaces the current description according to the following rules:
|
|
488
|
-
* - If `description` is an
|
|
489
|
-
* - If `description` is a
|
|
491
|
+
* - If `description` is an [`Answerable`](https://serenity-js.org/api/core/#Answerable), it replaces the current description
|
|
492
|
+
* - 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
|
|
490
493
|
*/
|
|
491
494
|
describedAs(description: Answerable<string> | MetaQuestion<Awaited<T>, Question<Promise<string>>>): this {
|
|
492
495
|
super.setDescription(
|
|
@@ -525,9 +528,9 @@ declare global {
|
|
|
525
528
|
/* eslint-disable @typescript-eslint/indent */
|
|
526
529
|
|
|
527
530
|
/**
|
|
528
|
-
* Describes an object recursively wrapped in
|
|
529
|
-
* - both methods and fields of the wrapped object can be used as
|
|
530
|
-
* - method parameters of the wrapped object will accept
|
|
531
|
+
* Describes an object recursively wrapped in [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter) proxies, so that:
|
|
532
|
+
* - 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/)
|
|
533
|
+
* - method parameters of the wrapped object will accept [`Answerable<T>`](https://serenity-js.org/api/core/#Answerable)
|
|
531
534
|
*
|
|
532
535
|
* @group Questions
|
|
533
536
|
*/
|
|
@@ -548,10 +551,10 @@ export type QuestionAdapterFieldDecorator<Original_Type> = {
|
|
|
548
551
|
/* eslint-enable @typescript-eslint/indent */
|
|
549
552
|
|
|
550
553
|
/**
|
|
551
|
-
* A union type representing a proxy object returned by
|
|
554
|
+
* A union type representing a proxy object returned by [`Question.about`](https://serenity-js.org/api/core/class/Question/#about).
|
|
552
555
|
*
|
|
553
|
-
*
|
|
554
|
-
* allowing them to be used as either a
|
|
556
|
+
* [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter) proxies the methods and fields of the wrapped object recursively,
|
|
557
|
+
* 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/).
|
|
555
558
|
*
|
|
556
559
|
* @group Questions
|
|
557
560
|
*/
|
|
@@ -562,8 +565,8 @@ export type QuestionAdapter<Answer_Type> =
|
|
|
562
565
|
& QuestionAdapterFieldDecorator<Answer_Type>;
|
|
563
566
|
|
|
564
567
|
/**
|
|
565
|
-
* An extension of
|
|
566
|
-
* of the wrapped object can also act as a
|
|
568
|
+
* An extension of [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter), that in addition to proxying methods and fields
|
|
569
|
+
* of the wrapped object can also act as a [`MetaQuestion`](https://serenity-js.org/api/core/interface/MetaQuestion/).
|
|
567
570
|
*
|
|
568
571
|
* @group Questions
|
|
569
572
|
*/
|
|
@@ -587,7 +590,7 @@ class QuestionStatement<Answer_Type> extends Interaction implements Question<Pro
|
|
|
587
590
|
}
|
|
588
591
|
|
|
589
592
|
/**
|
|
590
|
-
* Returns a Question that resolves to `true` if resolving the
|
|
593
|
+
* Returns a Question that resolves to `true` if resolving the `QuestionStatement`
|
|
591
594
|
* returns a value other than `null` or `undefined`, and doesn't throw errors.
|
|
592
595
|
*/
|
|
593
596
|
isPresent(): Question<Promise<boolean>> {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Question } from './Question';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Describes a recursively resolved plain JavaScript
|
|
4
|
+
* Describes a recursively resolved plain JavaScript object with [answerable properties](https://serenity-js.org/api/core/#WithAnswerableProperties).
|
|
5
5
|
*
|
|
6
|
-
* Typically, used in conjunction with
|
|
6
|
+
* Typically, used in conjunction with [`Question.fromObject`](https://serenity-js.org/api/core/class/Question/#fromObject).
|
|
7
7
|
*
|
|
8
8
|
* ## Using `RecursivelyAnswered`
|
|
9
9
|
*
|