@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
|
@@ -5,41 +5,41 @@ import type { Cast, StageCrewMember, StageCrewMemberBuilder } from '../stage';
|
|
|
5
5
|
import type { ClassDescription } from './ClassDescription';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Describes the configuration object accepted by the
|
|
8
|
+
* Describes the configuration object accepted by the [`configure`](https://serenity-js.org/api/core/function/configure/) function.
|
|
9
9
|
*
|
|
10
10
|
* ## Learn more
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
11
|
+
* - [`configure`](https://serenity-js.org/api/core/function/configure/)
|
|
12
|
+
* - [`Cast`](https://serenity-js.org/api/core/class/Cast/)
|
|
13
|
+
* - [`StageCrewMember`](https://serenity-js.org/api/core/interface/StageCrewMember/)
|
|
14
|
+
* - [`StageCrewMember`](https://serenity-js.org/api/core/interface/StageCrewMemberBuilder/)
|
|
15
|
+
* - [`ClassDescription`](https://serenity-js.org/api/core/#ClassDescription)
|
|
16
|
+
* - [`Stage.waitForNextCue`](https://serenity-js.org/api/core/class/Stage/#waitForNextCue)
|
|
17
17
|
*
|
|
18
18
|
* @group Serenity
|
|
19
19
|
*/
|
|
20
20
|
export abstract class SerenityConfig {
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* A
|
|
24
|
-
* and
|
|
23
|
+
* A [cast](https://serenity-js.org/api/core/class/Cast/) of [actors](https://serenity-js.org/api/core/class/Actor/) to be used when [`actorCalled`](https://serenity-js.org/api/core/function/actorCalled/)
|
|
24
|
+
* and [`actorInTheSpotlight`](https://serenity-js.org/api/core/function/actorInTheSpotlight/) functions are called.
|
|
25
25
|
*/
|
|
26
26
|
actors?: Cast;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* A list of
|
|
30
|
-
* to be notified of
|
|
29
|
+
* A list of [stage crew member builders](https://serenity-js.org/api/core/interface/StageCrewMemberBuilder/) or [stage crew members](https://serenity-js.org/api/core/interface/StageCrewMember/)
|
|
30
|
+
* to be notified of [Serenity/JS domain events](https://serenity-js.org/api/core-events/class/DomainEvent/) that occur during the scenario execution.
|
|
31
31
|
*
|
|
32
|
-
* Note that the `crew` can also be configured using
|
|
32
|
+
* Note that the `crew` can also be configured using [class descriptions](https://serenity-js.org/api/core/#ClassDescription).
|
|
33
33
|
* This is useful when you need to load the configuration from a static `json` file, or when the test runner doesn't support
|
|
34
34
|
* providing class instances in configuration (e.g. Playwright Test).
|
|
35
35
|
*/
|
|
36
36
|
crew?: Array<StageCrewMember | StageCrewMemberBuilder | ClassDescription>;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* The maximum amount of time between
|
|
39
|
+
* The maximum amount of time between [SceneFinishes](https://serenity-js.org/api/core-events/class/SceneFinishes/) and [SceneFinished](https://serenity-js.org/api/core-events/class/SceneFinished/) events
|
|
40
40
|
* that Serenity/JS should wait for any post-scenario
|
|
41
41
|
* async operations to complete. Those include generating the screenshots,
|
|
42
|
-
* saving reports to disk,
|
|
42
|
+
* saving reports to disk, [dismissing the actors](https://serenity-js.org/api/core/interface/Discardable/), and so on.
|
|
43
43
|
*
|
|
44
44
|
* Defaults to 5 seconds.
|
|
45
45
|
*
|
|
@@ -49,7 +49,7 @@ export abstract class SerenityConfig {
|
|
|
49
49
|
cueTimeout?: Duration;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
* The maximum default amount of time allowed for interactions such as
|
|
52
|
+
* The maximum default amount of time allowed for interactions such as [`Wait.until`](https://serenity-js.org/api/core/class/Wait/#until)
|
|
53
53
|
* to complete.
|
|
54
54
|
*
|
|
55
55
|
* Defaults to 5 seconds, can be overridden per interaction.
|
|
@@ -58,20 +58,22 @@ export abstract class SerenityConfig {
|
|
|
58
58
|
* a scenario timeout, which should be configured in your test runner.
|
|
59
59
|
*
|
|
60
60
|
* #### Learn more
|
|
61
|
-
* -
|
|
61
|
+
* - [`Wait.until`](https://serenity-js.org/api/core/class/Wait/#until)
|
|
62
62
|
*/
|
|
63
63
|
interactionTimeout?: Duration;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
66
|
+
* [`DiffFormatter`](https://serenity-js.org/api/core/interface/DiffFormatter/) that
|
|
67
|
+
* should be used by the [`ErrorFactory`](https://serenity-js.org/api/core/class/ErrorFactory/) and the ability
|
|
68
|
+
* to [`RaiseErrors`](https://serenity-js.org/api/core/class/RaiseErrors/)
|
|
69
|
+
* when generating diffs included in [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/) objects.
|
|
68
70
|
*
|
|
69
|
-
* By default, Serenity/JS uses
|
|
71
|
+
* By default, Serenity/JS uses [`NoOpDiffFormatter`](https://serenity-js.org/api/core/class/NoOpDiffFormatter/)
|
|
70
72
|
*/
|
|
71
73
|
diffFormatter?: DiffFormatter;
|
|
72
74
|
|
|
73
75
|
/**
|
|
74
|
-
* An output stream to be injected into
|
|
76
|
+
* An output stream to be injected into [stage crew member builders](https://serenity-js.org/api/core/interface/StageCrewMemberBuilder/)
|
|
75
77
|
*
|
|
76
78
|
* Defaults to [`process.stdout`](https://nodejs.org/api/process.html#process_process_stdout).
|
|
77
79
|
*/
|
|
@@ -11,7 +11,8 @@ import type { ErrorOptions } from './ErrorOptions';
|
|
|
11
11
|
import type { RuntimeError } from './model';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Generates Serenity/JS
|
|
14
|
+
* Generates Serenity/JS [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/) objects based
|
|
15
|
+
* on the provided [configuration](https://serenity-js.org/api/core/interface/ErrorOptions/).
|
|
15
16
|
*
|
|
16
17
|
* @group Errors
|
|
17
18
|
*/
|
|
@@ -91,17 +91,17 @@ export class ErrorSerialiser {
|
|
|
91
91
|
interface SerialisedError extends JSONObject {
|
|
92
92
|
/**
|
|
93
93
|
* Name of the constructor function used to instantiate
|
|
94
|
-
* the original
|
|
94
|
+
* the original [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object.
|
|
95
95
|
*/
|
|
96
96
|
name: string;
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* Message of the original
|
|
99
|
+
* Message of the original [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object
|
|
100
100
|
*/
|
|
101
101
|
message: string;
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
|
-
* Stack trace of the original
|
|
104
|
+
* Stack trace of the original [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object
|
|
105
105
|
*/
|
|
106
106
|
stack: string;
|
|
107
107
|
}
|
|
@@ -4,8 +4,8 @@ import type { ErrorOptions } from './ErrorOptions';
|
|
|
4
4
|
import type { RuntimeError } from './model/RuntimeError';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* An
|
|
8
|
-
* from within a custom
|
|
7
|
+
* An [`Ability`](https://serenity-js.org/api/core/class/Ability/) that enables an [`Actor`](https://serenity-js.org/api/core/class/Actor/) to create a Serenity/JS [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/)
|
|
8
|
+
* from within a custom [`Interaction`](https://serenity-js.org/api/core/class/Interaction/).
|
|
9
9
|
*
|
|
10
10
|
* The stack trace of an error created this way includes the filesystem location pointing to where the interaction was invoked,
|
|
11
11
|
* which makes debugging any failures easier.
|
|
@@ -40,13 +40,13 @@ import type { RuntimeError } from './model/RuntimeError';
|
|
|
40
40
|
* ```
|
|
41
41
|
*
|
|
42
42
|
* ## Learn more
|
|
43
|
-
* -
|
|
44
|
-
* -
|
|
45
|
-
* -
|
|
46
|
-
* -
|
|
47
|
-
* -
|
|
48
|
-
* -
|
|
49
|
-
* -
|
|
43
|
+
* - [`ErrorOptions`](https://serenity-js.org/api/core/interface/ErrorOptions/)
|
|
44
|
+
* - [`ErrorFactory`](https://serenity-js.org/api/core/class/ErrorFactory/)
|
|
45
|
+
* - [`AssertionError`](https://serenity-js.org/api/core/class/AssertionError/)
|
|
46
|
+
* - [`ConfigurationError`](https://serenity-js.org/api/core/class/ConfigurationError/)
|
|
47
|
+
* - [`LogicError`](https://serenity-js.org/api/core/class/LogicError/)
|
|
48
|
+
* - [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/)
|
|
49
|
+
* - [`TestCompromisedError`](https://serenity-js.org/api/core/class/TestCompromisedError/)
|
|
50
50
|
*
|
|
51
51
|
* @group Errors
|
|
52
52
|
*/
|
|
@@ -4,7 +4,7 @@ import { Instance as ChalkInstance } from 'chalk'; // eslint-disable-line unic
|
|
|
4
4
|
import type { DiffFormatter } from './DiffFormatter';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* A
|
|
7
|
+
* A [`DiffFormatter`](https://serenity-js.org/api/core/interface/DiffFormatter/) that uses [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
|
|
8
8
|
* to format the output.
|
|
9
9
|
*
|
|
10
10
|
* @group Errors
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Formats text representing expected, received, and unchanged lines of a diff
|
|
3
|
-
* produced by the
|
|
3
|
+
* produced by the [`ErrorFactory`](https://serenity-js.org/api/core/class/ErrorFactory/), so that they can be presented to a developer
|
|
4
4
|
* in a visually distinctive way.
|
|
5
5
|
*
|
|
6
6
|
* @group Errors
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DiffFormatter } from './DiffFormatter';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* A no-op
|
|
4
|
+
* A no-op [`DiffFormatter`](https://serenity-js.org/api/core/interface/DiffFormatter/) that produces output identical to input.
|
|
5
5
|
*
|
|
6
6
|
* @group Errors
|
|
7
7
|
*/
|
|
@@ -23,7 +23,7 @@ export class AssertionError extends RuntimeError {
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* @param message - Human-readable description of the error and the difference between the expected and actual values
|
|
26
|
-
* @param [cause] - The root cause of this
|
|
26
|
+
* @param [cause] - The root cause of this [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/), if any
|
|
27
27
|
*/
|
|
28
28
|
constructor(message: string, cause?: Error) {
|
|
29
29
|
super(AssertionError, message, cause);
|
|
@@ -23,7 +23,7 @@ export class ConfigurationError extends RuntimeError {
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* @param message - Human-readable description of the error
|
|
26
|
-
* @param [cause] - The root cause of this
|
|
26
|
+
* @param [cause] - The root cause of this [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/), if any
|
|
27
27
|
*/
|
|
28
28
|
constructor(message: string, cause?: Error) {
|
|
29
29
|
super(ConfigurationError, message, cause);
|
|
@@ -4,8 +4,8 @@ import { ErrorSerialiser } from '../ErrorSerialiser';
|
|
|
4
4
|
import { RuntimeError } from './RuntimeError';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Thrown to indicate that the
|
|
8
|
-
* a
|
|
7
|
+
* Thrown to indicate that the [`Actor`](https://serenity-js.org/api/core/class/Actor/) attempted to perform
|
|
8
|
+
* a [`Task`](https://serenity-js.org/api/core/class/Task/) or [`Interaction`](https://serenity-js.org/api/core/class/Interaction/) that hasn't been implemented yet.
|
|
9
9
|
*
|
|
10
10
|
* ## A pending Task
|
|
11
11
|
*
|
|
@@ -44,7 +44,7 @@ export class ImplementationPendingError extends RuntimeError {
|
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* @param {string} message - Human-readable description of the error
|
|
47
|
-
* @param {Error} [cause] - The root cause of this
|
|
47
|
+
* @param {Error} [cause] - The root cause of this [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/), if any
|
|
48
48
|
*/
|
|
49
49
|
constructor(message: string, cause?: Error) {
|
|
50
50
|
super(ImplementationPendingError, message, cause);
|
|
@@ -4,7 +4,7 @@ import { ErrorSerialiser } from '../ErrorSerialiser';
|
|
|
4
4
|
import { RuntimeError } from './RuntimeError';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Thrown to indicate that an
|
|
7
|
+
* Thrown to indicate that an [`Interaction`](https://serenity-js.org/api/core/class/Interaction/), a [`Task`](https://serenity-js.org/api/core/class/Task/) or a test scenario
|
|
8
8
|
* can't be executed due to no items are found in a list.
|
|
9
9
|
*
|
|
10
10
|
* For example, it's not possible to get the first() or the last() item of a list
|
|
@@ -27,7 +27,7 @@ export class ListItemNotFoundError extends RuntimeError {
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @param message - Human-readable description of the error
|
|
30
|
-
* @param [cause] - The root cause of this
|
|
30
|
+
* @param [cause] - The root cause of this [`ListItemNotFoundError`](https://serenity-js.org/api/core/class/ListItemNotFoundError/), if any
|
|
31
31
|
*/
|
|
32
32
|
constructor(message: string, cause?: Error) {
|
|
33
33
|
super(ListItemNotFoundError, message, cause);
|
|
@@ -4,7 +4,7 @@ import { ErrorSerialiser } from '../ErrorSerialiser';
|
|
|
4
4
|
import { RuntimeError } from './RuntimeError';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Thrown to indicate that an
|
|
7
|
+
* Thrown to indicate that an [`Interaction`](https://serenity-js.org/api/core/class/Interaction/), a [`Task`](https://serenity-js.org/api/core/class/Task/) or a test scenario
|
|
8
8
|
* can't be executed due to a logical error.
|
|
9
9
|
*
|
|
10
10
|
* For example, it's not possible to assert on the last HTTP Response if the request
|
|
@@ -27,7 +27,7 @@ export class LogicError extends RuntimeError {
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @param message - Human-readable description of the error
|
|
30
|
-
* @param [cause] - The root cause of this
|
|
30
|
+
* @param [cause] - The root cause of this [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/), if any
|
|
31
31
|
*/
|
|
32
32
|
constructor(message: string, cause?: Error) {
|
|
33
33
|
super(LogicError, message, cause);
|
|
@@ -4,7 +4,7 @@ import { ErrorSerialiser } from '../ErrorSerialiser';
|
|
|
4
4
|
import { RuntimeError } from './RuntimeError';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Thrown to indicate that a
|
|
7
|
+
* Thrown to indicate that a [scheduled operation](https://serenity-js.org/api/core/class/Scheduler/)
|
|
8
8
|
* has been stopped before it was completed.
|
|
9
9
|
*
|
|
10
10
|
* @group Errors
|
|
@@ -27,7 +27,7 @@ export class OperationInterruptedError extends RuntimeError {
|
|
|
27
27
|
* Human-readable description of the error
|
|
28
28
|
*
|
|
29
29
|
* @param [cause]
|
|
30
|
-
* The root cause of this
|
|
30
|
+
* The root cause of this [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/), if any
|
|
31
31
|
*/
|
|
32
32
|
constructor(
|
|
33
33
|
message: string,
|
|
@@ -36,7 +36,7 @@ import { TinyType } from 'tiny-types';
|
|
|
36
36
|
* })
|
|
37
37
|
* ```
|
|
38
38
|
*
|
|
39
|
-
* ## Registering a custom error with
|
|
39
|
+
* ## Registering a custom error with [`ErrorSerialiser`](https://serenity-js.org/api/core/class/ErrorSerialiser/)
|
|
40
40
|
*
|
|
41
41
|
* ```ts
|
|
42
42
|
* import { RuntimeError } from '@serenity-js/core'
|
|
@@ -70,7 +70,7 @@ export abstract class RuntimeError extends Error {
|
|
|
70
70
|
/**
|
|
71
71
|
* @param type - Constructor function used to instantiate a subclass of a RuntimeError
|
|
72
72
|
* @param message - Human-readable description of the error
|
|
73
|
-
* @param [cause] - The root cause of this
|
|
73
|
+
* @param [cause] - The root cause of this [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/), if any
|
|
74
74
|
*/
|
|
75
75
|
protected constructor(
|
|
76
76
|
type: new (...args: any[]) => RuntimeError,
|
|
@@ -38,7 +38,7 @@ export class TestCompromisedError extends RuntimeError {
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* @param message - Human-readable description of the error
|
|
41
|
-
* @param [cause] - The root cause of this
|
|
41
|
+
* @param [cause] - The root cause of this [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/), if any
|
|
42
42
|
*/
|
|
43
43
|
constructor(message: string, cause?: Error) {
|
|
44
44
|
super(TestCompromisedError, message, cause);
|
|
@@ -4,7 +4,7 @@ import { ErrorSerialiser } from '../ErrorSerialiser';
|
|
|
4
4
|
import { RuntimeError } from './RuntimeError';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Thrown to indicate that an
|
|
7
|
+
* Thrown to indicate that an [`Interaction`](https://serenity-js.org/api/core/class/Interaction/), a [`Task`](https://serenity-js.org/api/core/class/Task/) or a test scenario
|
|
8
8
|
* took longer to execute than the expected timeout.
|
|
9
9
|
*
|
|
10
10
|
* @group Errors
|
|
@@ -27,7 +27,7 @@ export class TimeoutExpiredError extends RuntimeError {
|
|
|
27
27
|
* Human-readable description of the error
|
|
28
28
|
*
|
|
29
29
|
* @param [cause]
|
|
30
|
-
* The root cause of this
|
|
30
|
+
* The root cause of this [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/), if any
|
|
31
31
|
*/
|
|
32
32
|
constructor(
|
|
33
33
|
message: string,
|
|
@@ -23,7 +23,7 @@ export class UnknownError extends RuntimeError {
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* @param message - Human-readable description of the error
|
|
26
|
-
* @param [cause] - The root cause of this
|
|
26
|
+
* @param [cause] - The root cause of this [`RuntimeError`](https://serenity-js.org/api/core/class/RuntimeError/), if any
|
|
27
27
|
*/
|
|
28
28
|
constructor(message: string, cause?: Error) {
|
|
29
29
|
super(UnknownError, message, cause);
|
|
@@ -5,7 +5,7 @@ import type { Timestamp } from '../screenplay';
|
|
|
5
5
|
import { DomainEvent } from './DomainEvent';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Emitted when an
|
|
8
|
+
* Emitted when an [`Activity`](https://serenity-js.org/api/core/class/Activity/) is finished.
|
|
9
9
|
*
|
|
10
10
|
* @group Events
|
|
11
11
|
*/
|
|
@@ -5,7 +5,7 @@ import type { Timestamp } from '../screenplay';
|
|
|
5
5
|
import { DomainEvent } from './DomainEvent';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Emitted when an
|
|
8
|
+
* Emitted when an [`Activity`](https://serenity-js.org/api/core/class/Activity/) starts.
|
|
9
9
|
*
|
|
10
10
|
* @group Events
|
|
11
11
|
*/
|
|
@@ -6,7 +6,7 @@ import { Timestamp } from '../screenplay';
|
|
|
6
6
|
import { DomainEvent } from './DomainEvent';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Emitted by [@serenity-js/cucumber](/api/cucumber)
|
|
9
|
+
* Emitted by [@serenity-js/cucumber](https://serenity-js.org/api/cucumber)
|
|
10
10
|
* when a [business rule](https://cucumber.io/docs/gherkin/reference/#rule) is detected.
|
|
11
11
|
*
|
|
12
12
|
* @group Events
|
|
@@ -7,7 +7,8 @@ import { DomainEvent } from './DomainEvent';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Emitted by a Serenity/JS test runner adapter, right before a test and all its associated test hooks finish.
|
|
10
|
-
* Triggers any clean-up operations that might be required, such as discarding of
|
|
10
|
+
* Triggers any clean-up operations that might be required, such as discarding of
|
|
11
|
+
* the [discardable](https://serenity-js.org/api/core/interface/Discardable/) abilities.
|
|
11
12
|
*
|
|
12
13
|
* @group Events
|
|
13
14
|
*/
|
package/src/instance.ts
CHANGED
|
@@ -19,10 +19,10 @@ export const serenity = new Serenity(clock);
|
|
|
19
19
|
* so this function should be called exactly once
|
|
20
20
|
* in your test suite.
|
|
21
21
|
*
|
|
22
|
-
* This function is an alias for
|
|
22
|
+
* This function is an alias for [`Serenity.configure`](https://serenity-js.org/api/core/class/Serenity/#configure).
|
|
23
23
|
*
|
|
24
24
|
* :::tip configure vs engage
|
|
25
|
-
* If you want to retain the configuration but reset the
|
|
25
|
+
* If you want to retain the configuration but reset the [cast of actors](https://serenity-js.org/api/core/class/Cast/), use [`engage`](https://serenity-js.org/api/core/function/engage/) instead.
|
|
26
26
|
* :::
|
|
27
27
|
*
|
|
28
28
|
* @param config
|
|
@@ -34,26 +34,26 @@ export function configure(config: SerenityConfig): void {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* Re-configures Serenity/JS with a new
|
|
38
|
-
* you want to use in any subsequent calls to
|
|
37
|
+
* Re-configures Serenity/JS with a new [cast](https://serenity-js.org/api/core/class/Cast/) of [actors](https://serenity-js.org/api/core/class/Actor/)
|
|
38
|
+
* you want to use in any subsequent calls to [`actorCalled`](https://serenity-js.org/api/core/function/actorCalled/).
|
|
39
39
|
*
|
|
40
|
-
* This function is an alias for
|
|
41
|
-
* which provides an alternative to calling
|
|
40
|
+
* This function is an alias for [`Serenity.engage`](https://serenity-js.org/api/core/class/Serenity/#engage),
|
|
41
|
+
* which provides an alternative to calling [`Actor.whoCan`](https://serenity-js.org/api/core/class/Actor/#whoCan) directly in your tests
|
|
42
42
|
* and is typically invoked in a "before all" or "before each" hook of your test runner of choice.
|
|
43
43
|
*
|
|
44
44
|
* :::tip configure vs engage
|
|
45
|
-
* Calling
|
|
45
|
+
* Calling [`engage`](https://serenity-js.org/api/core/function/engage/) replaces the currently configured [cast of actors](https://serenity-js.org/api/core/class/Cast/),
|
|
46
46
|
* but doesn't affect any other configuration.
|
|
47
|
-
* If you want to reset the Serenity/JS configuration completely, use
|
|
47
|
+
* If you want to reset the Serenity/JS configuration completely, use [`configure`](https://serenity-js.org/api/core/function/configure/) instead.
|
|
48
48
|
* :::
|
|
49
49
|
*
|
|
50
|
-
* If your implementation of the
|
|
50
|
+
* If your implementation of the [cast](https://serenity-js.org/api/core/class/Cast/) interface is stateless,
|
|
51
51
|
* you can invoke this function just once before your entire test suite is executed, see
|
|
52
52
|
* - [`beforeAll`](https://jasmine.github.io/api/3.6/global.html#beforeAll) in Jasmine,
|
|
53
53
|
* - [`before`](https://mochajs.org/#hooks) in Mocha,
|
|
54
54
|
* - [`BeforeAll`](https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/hooks.md#beforeall--afterall) in Cucumber.js
|
|
55
55
|
*
|
|
56
|
-
* However, if your
|
|
56
|
+
* However, if your [cast](https://serenity-js.org/api/core/class/Cast/) holds state that you want to reset before each scenario,
|
|
57
57
|
* it's better to invoke `engage` before each test using:
|
|
58
58
|
* - [`beforeEach`](https://jasmine.github.io/api/3.6/global.html#beforeEach) in Jasmine
|
|
59
59
|
* - [`beforeEach`](https://mochajs.org/#hooks) in Mocha,
|
|
@@ -116,8 +116,8 @@ export function configure(config: SerenityConfig): void {
|
|
|
116
116
|
*
|
|
117
117
|
* ### Using with Playwright Test runner
|
|
118
118
|
*
|
|
119
|
-
* [Serenity/JS Playwright Test module](/api/playwright-test) will configure the cast on your behalf,
|
|
120
|
-
* so you don't need to call
|
|
119
|
+
* [Serenity/JS Playwright Test module](https://serenity-js.org/api/playwright-test) will configure the cast on your behalf,
|
|
120
|
+
* so you don't need to call [`engage`](https://serenity-js.org/api/core/function/engage/).
|
|
121
121
|
*
|
|
122
122
|
* ```ts
|
|
123
123
|
* import { describe, it, test } from '@serenity-js/playwright-test'
|
|
@@ -134,9 +134,9 @@ export function configure(config: SerenityConfig): void {
|
|
|
134
134
|
* ```
|
|
135
135
|
*
|
|
136
136
|
* ## Learn more
|
|
137
|
-
* -
|
|
138
|
-
* -
|
|
139
|
-
* -
|
|
137
|
+
* - [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
138
|
+
* - [`Cast`](https://serenity-js.org/api/core/class/Cast/)
|
|
139
|
+
* - [`Serenity.engage`](https://serenity-js.org/api/core/class/Serenity/#engage)
|
|
140
140
|
*
|
|
141
141
|
* @param actors
|
|
142
142
|
*
|
|
@@ -147,10 +147,10 @@ export function engage(actors: Cast): void {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
|
-
* Instantiates or retrieves an
|
|
150
|
+
* Instantiates or retrieves an [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
151
151
|
* called `name` if one has already been instantiated.
|
|
152
152
|
*
|
|
153
|
-
* This method is an alias for
|
|
153
|
+
* This method is an alias for [`Serenity.theActorCalled`](https://serenity-js.org/api/core/class/Serenity/#theActorCalled).
|
|
154
154
|
*
|
|
155
155
|
* ## Usage with Cucumber
|
|
156
156
|
*
|
|
@@ -199,9 +199,9 @@ export function engage(actors: Cast): void {
|
|
|
199
199
|
*
|
|
200
200
|
* ## Usage with Playwright Test
|
|
201
201
|
*
|
|
202
|
-
* When using [Serenity/JS with Playwright Test](/api/playwright-test/), you should use either
|
|
203
|
-
* the default [`actor`](/api/playwright-test/interface/SerenityFixtures/#actorCalled) fixture
|
|
204
|
-
* or the injected [`actorCalled`](/api/playwright-test/interface/SerenityFixtures/#actorCalled) function
|
|
202
|
+
* When using [Serenity/JS with Playwright Test](https://serenity-js.org/api/playwright-test/), you should use either
|
|
203
|
+
* the default [`actor`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/#actorCalled) fixture
|
|
204
|
+
* or the injected [`actorCalled`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/#actorCalled) function
|
|
205
205
|
* instead of importing it from `@serenity-js/core`.
|
|
206
206
|
*
|
|
207
207
|
* ```typescript
|
|
@@ -219,10 +219,10 @@ export function engage(actors: Cast): void {
|
|
|
219
219
|
*
|
|
220
220
|
* ## Learn more
|
|
221
221
|
*
|
|
222
|
-
* -
|
|
223
|
-
* -
|
|
224
|
-
* -
|
|
225
|
-
* -
|
|
222
|
+
* - [`engage`](https://serenity-js.org/api/core/function/engage/)
|
|
223
|
+
* - [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
224
|
+
* - [`Cast`](https://serenity-js.org/api/core/class/Cast/)
|
|
225
|
+
* - [`Serenity.theActorCalled`](https://serenity-js.org/api/core/class/Serenity/#theActorCalled)
|
|
226
226
|
*
|
|
227
227
|
* @param name
|
|
228
228
|
* The name of the actor to instantiate or retrieve
|
|
@@ -235,11 +235,11 @@ export function actorCalled(name: string): Actor {
|
|
|
235
235
|
|
|
236
236
|
/**
|
|
237
237
|
* Retrieves an actor who was last instantiated or retrieved
|
|
238
|
-
* using
|
|
238
|
+
* using [`actorCalled`](https://serenity-js.org/api/core/function/actorCalled/).
|
|
239
239
|
*
|
|
240
240
|
* This function is particularly useful when automating Cucumber scenarios.
|
|
241
241
|
*
|
|
242
|
-
* This function is an alias for
|
|
242
|
+
* This function is an alias for [`Serenity.theActorInTheSpotlight`](https://serenity-js.org/api/core/class/Serenity/#theActorInTheSpotlight).
|
|
243
243
|
*
|
|
244
244
|
* ## Usage with Cucumber
|
|
245
245
|
*
|
|
@@ -260,10 +260,10 @@ export function actorCalled(name: string): Actor {
|
|
|
260
260
|
*
|
|
261
261
|
* ## Learn more
|
|
262
262
|
*
|
|
263
|
-
* -
|
|
264
|
-
* -
|
|
265
|
-
* -
|
|
266
|
-
* -
|
|
263
|
+
* - [`engage`](https://serenity-js.org/api/core/function/engage/)
|
|
264
|
+
* - [`actorCalled`](https://serenity-js.org/api/core/function/actorCalled/)
|
|
265
|
+
* - [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
266
|
+
* - [`Cast`](https://serenity-js.org/api/core/class/Cast/)
|
|
267
267
|
*
|
|
268
268
|
* @group Actors
|
|
269
269
|
*/
|
package/src/io/format.ts
CHANGED
|
@@ -2,14 +2,23 @@ import type { Answerable } from '../screenplay';
|
|
|
2
2
|
import { stringified } from './stringified';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* `format` is a factory function returning
|
|
6
6
|
* a [tag function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals)
|
|
7
|
-
* that produces a human-readable description of a template containing
|
|
8
|
-
* one or more
|
|
7
|
+
* that produces a human-readable `string` description of a template containing
|
|
8
|
+
* one or more [answerables](https://serenity-js.org/api/core/#Answerable).
|
|
9
9
|
*
|
|
10
|
-
* Typically, you'll want to use
|
|
11
|
-
* - the
|
|
12
|
-
* - the
|
|
10
|
+
* Typically, you'll want to use `d` and `f` shorthands instead, or the modern alternative - `the`:
|
|
11
|
+
* - the [`d`](https://serenity-js.org/api/core/function/d/) function works best for generating a **static description** of a parameterised [`Activity`](https://serenity-js.org/api/core/class/Activity/)
|
|
12
|
+
* - the [`f`](https://serenity-js.org/api/core/function/f/) function is better suited for debugging
|
|
13
|
+
* - the [`the`](https://serenity-js.org/api/core/function/f/) function works best for generating a **dynamic description** of a parameterised [`Activity`](https://serenity-js.org/api/core/class/Activity/)
|
|
14
|
+
*
|
|
15
|
+
* :::tip Use `the` instead of `format`
|
|
16
|
+
* `format`, `d` and `f` are the original Serenity/JS string formatting functions,
|
|
17
|
+
* still present in the framework for backwards compatibility purposes.
|
|
18
|
+
*
|
|
19
|
+
* To generate a dynamic description of a `Question` or `Interaction`,
|
|
20
|
+
* use [`the`](https://serenity-js.org/api/core/function/the/) function instead.
|
|
21
|
+
* :::
|
|
13
22
|
*
|
|
14
23
|
* ## Using `format`
|
|
15
24
|
*
|
|
@@ -11,7 +11,7 @@ export class ValueInspector {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Checks if the value is a named
|
|
14
|
+
* Checks if the value is a named [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)
|
|
15
15
|
*
|
|
16
16
|
* @param value
|
|
17
17
|
*/
|
|
@@ -115,8 +115,8 @@ export class ValueInspector {
|
|
|
115
115
|
static isNative(value: unknown): value is Function { // eslint-disable-line @typescript-eslint/ban-types
|
|
116
116
|
|
|
117
117
|
const
|
|
118
|
-
toString = Object.prototype.toString,
|
|
119
|
-
fnToString = Function.prototype.toString,
|
|
118
|
+
toString = Object.prototype.toString, // Used to resolve the internal `Class` of values
|
|
119
|
+
fnToString = Function.prototype.toString, // Used to resolve the decompiled source of functions
|
|
120
120
|
hostConstructor = /^\[object .+?Constructor]$/; // Used to detect host constructors (Safari > 4; really typed array specific)
|
|
121
121
|
|
|
122
122
|
// Compile a regexp using a common native method as a template.
|
package/src/io/stringified.ts
CHANGED
|
@@ -13,7 +13,7 @@ interface StringifyConfig {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Provides a human-readable description of the
|
|
16
|
+
* Provides a human-readable description of the [`Answerable<T>`](https://serenity-js.org/api/core/#Answerable).
|
|
17
17
|
* Similar to [Node util~inspect](https://nodejs.org/api/util.html#utilinspectobject-options).
|
|
18
18
|
*
|
|
19
19
|
* @param value
|
package/src/io/trimmed.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A tag function trimming the leading and trailing whitespace from multi-line strings.
|
|
3
3
|
*
|
|
4
|
-
* @
|
|
4
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals
|
|
5
5
|
*
|
|
6
6
|
* @param templates
|
|
7
7
|
* @param placeholders
|