@serenity-js/core 3.43.0 → 3.43.1
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 +11 -0
- package/esm/config/SerenityConfig.d.ts +1 -1
- package/esm/config/SerenityConfig.js +1 -1
- package/esm/events/SceneFinishes.d.ts +1 -1
- package/esm/events/SceneFinishes.js +1 -1
- package/esm/events/actor/ActorStageExitCompleted.d.ts +1 -1
- package/esm/events/actor/ActorStageExitCompleted.js +1 -1
- package/esm/events/actor/ActorStageExitFailed.d.ts +1 -1
- package/esm/events/actor/ActorStageExitFailed.js +1 -1
- package/esm/events/actor/ActorStageExitStarts.d.ts +1 -1
- package/esm/events/actor/ActorStageExitStarts.js +1 -1
- package/esm/screenplay/Actor.d.ts +2 -2
- package/esm/screenplay/Actor.js +2 -2
- package/esm/screenplay/abilities/Ability.d.ts +6 -6
- package/esm/screenplay/abilities/Ability.js +6 -6
- package/esm/screenplay/abilities/Discardable.d.ts +2 -2
- package/esm/screenplay/abilities/Discardable.js +2 -2
- package/esm/screenplay/abilities/Initialisable.d.ts +5 -5
- package/esm/screenplay/abilities/Initialisable.js +3 -3
- package/esm/stage/ActorLifecycleManager.d.ts +1 -1
- package/esm/stage/ActorLifecycleManager.js +1 -1
- package/lib/config/SerenityConfig.d.ts +1 -1
- package/lib/config/SerenityConfig.js +1 -1
- package/lib/events/SceneFinishes.d.ts +1 -1
- package/lib/events/SceneFinishes.js +1 -1
- package/lib/events/actor/ActorStageExitCompleted.d.ts +1 -1
- package/lib/events/actor/ActorStageExitCompleted.js +1 -1
- package/lib/events/actor/ActorStageExitFailed.d.ts +1 -1
- package/lib/events/actor/ActorStageExitFailed.js +1 -1
- package/lib/events/actor/ActorStageExitStarts.d.ts +1 -1
- package/lib/events/actor/ActorStageExitStarts.js +1 -1
- package/lib/screenplay/Actor.d.ts +2 -2
- package/lib/screenplay/Actor.js +2 -2
- package/lib/screenplay/abilities/Ability.d.ts +6 -6
- package/lib/screenplay/abilities/Ability.js +6 -6
- package/lib/screenplay/abilities/Discardable.d.ts +2 -2
- package/lib/screenplay/abilities/Discardable.js +2 -2
- package/lib/screenplay/abilities/Initialisable.d.ts +5 -5
- package/lib/screenplay/abilities/Initialisable.js +3 -3
- package/lib/stage/ActorLifecycleManager.d.ts +1 -1
- package/lib/stage/ActorLifecycleManager.js +1 -1
- package/package.json +2 -2
- package/src/config/SerenityConfig.ts +1 -1
- package/src/events/SceneFinishes.ts +1 -1
- package/src/events/actor/ActorStageExitCompleted.ts +1 -1
- package/src/events/actor/ActorStageExitFailed.ts +1 -1
- package/src/events/actor/ActorStageExitStarts.ts +1 -1
- package/src/screenplay/Actor.ts +2 -2
- package/src/screenplay/abilities/Ability.ts +6 -6
- package/src/screenplay/abilities/Discardable.ts +2 -2
- package/src/screenplay/abilities/Initialisable.ts +5 -5
- package/src/stage/ActorLifecycleManager.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.43.1](https://github.com/serenity-js/serenity-js/compare/v3.43.0...v3.43.1) (2026-05-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **core:** updated API docs ([38b86f4](https://github.com/serenity-js/serenity-js/commit/38b86f4190b5d3c6a64fd0042c87ac187f847f89))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [3.43.0](https://github.com/serenity-js/serenity-js/compare/v3.42.2...v3.43.0) (2026-05-11)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -35,7 +35,7 @@ export declare abstract class SerenityConfig {
|
|
|
35
35
|
* 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
|
|
36
36
|
* that Serenity/JS should wait for any post-scenario
|
|
37
37
|
* async operations to complete. Those include generating the screenshots,
|
|
38
|
-
* saving reports to disk, [dismissing the actors](https://serenity-js.org/api/core/
|
|
38
|
+
* saving reports to disk, [dismissing the actors](https://serenity-js.org/api/core/class/Discardable/), and so on.
|
|
39
39
|
*
|
|
40
40
|
* Defaults to 5 seconds.
|
|
41
41
|
*
|
|
@@ -30,7 +30,7 @@ export class SerenityConfig {
|
|
|
30
30
|
* 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
|
|
31
31
|
* that Serenity/JS should wait for any post-scenario
|
|
32
32
|
* async operations to complete. Those include generating the screenshots,
|
|
33
|
-
* saving reports to disk, [dismissing the actors](https://serenity-js.org/api/core/
|
|
33
|
+
* saving reports to disk, [dismissing the actors](https://serenity-js.org/api/core/class/Discardable/), and so on.
|
|
34
34
|
*
|
|
35
35
|
* Defaults to 5 seconds.
|
|
36
36
|
*
|
|
@@ -5,7 +5,7 @@ import { DomainEvent } from './DomainEvent.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Emitted by a Serenity/JS test runner adapter, right before a test and all its associated test hooks finish.
|
|
7
7
|
* Triggers any clean-up operations that might be required, such as discarding of
|
|
8
|
-
* the [discardable](https://serenity-js.org/api/core/
|
|
8
|
+
* the [discardable](https://serenity-js.org/api/core/class/Discardable/) abilities.
|
|
9
9
|
*
|
|
10
10
|
* The `outcome` property contains the test outcome determined so far, before any cleanup operations.
|
|
11
11
|
* This allows stage crew members like the WebdriverIO notifier to invoke hooks with the test result
|
|
@@ -5,7 +5,7 @@ import { DomainEvent } from './DomainEvent.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Emitted by a Serenity/JS test runner adapter, right before a test and all its associated test hooks finish.
|
|
7
7
|
* Triggers any clean-up operations that might be required, such as discarding of
|
|
8
|
-
* the [discardable](https://serenity-js.org/api/core/
|
|
8
|
+
* the [discardable](https://serenity-js.org/api/core/class/Discardable/) abilities.
|
|
9
9
|
*
|
|
10
10
|
* The `outcome` property contains the test outcome determined so far, before any cleanup operations.
|
|
11
11
|
* This allows stage crew members like the WebdriverIO notifier to invoke hooks with the test result
|
|
@@ -4,7 +4,7 @@ import { Timestamp } from '../../screenplay/index.js';
|
|
|
4
4
|
import { AsyncOperationCompleted } from '../AsyncOperationCompleted.js';
|
|
5
5
|
/**
|
|
6
6
|
* Emitted when an [`Actor`](https://serenity-js.org/api/core/class/Actor/) and its abilities
|
|
7
|
-
* are correctly [released](https://serenity-js.org/api/core/
|
|
7
|
+
* are correctly [released](https://serenity-js.org/api/core/class/Discardable/) either
|
|
8
8
|
* upon the [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/) event
|
|
9
9
|
* for actors initialised within the scope of a test scenario,
|
|
10
10
|
* or upon the [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/) event
|
|
@@ -4,7 +4,7 @@ import { Timestamp } from '../../screenplay/index.js';
|
|
|
4
4
|
import { AsyncOperationCompleted } from '../AsyncOperationCompleted.js';
|
|
5
5
|
/**
|
|
6
6
|
* Emitted when an [`Actor`](https://serenity-js.org/api/core/class/Actor/) and its abilities
|
|
7
|
-
* are correctly [released](https://serenity-js.org/api/core/
|
|
7
|
+
* are correctly [released](https://serenity-js.org/api/core/class/Discardable/) either
|
|
8
8
|
* upon the [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/) event
|
|
9
9
|
* for actors initialised within the scope of a test scenario,
|
|
10
10
|
* or upon the [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/) event
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { JSONObject } from 'tiny-types';
|
|
2
2
|
import { AsyncOperationFailed } from '../AsyncOperationFailed.js';
|
|
3
3
|
/**
|
|
4
|
-
* Emitted when [releasing](https://serenity-js.org/api/core/
|
|
4
|
+
* Emitted when [releasing](https://serenity-js.org/api/core/class/Discardable/) an
|
|
5
5
|
* [`Actor`](https://serenity-js.org/api/core/class/Actor/) or its abilities
|
|
6
6
|
* resulted in an error either
|
|
7
7
|
* upon the [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/) event
|
|
@@ -3,7 +3,7 @@ import { CorrelationId } from '../../model/index.js';
|
|
|
3
3
|
import { Timestamp } from '../../screenplay/index.js';
|
|
4
4
|
import { AsyncOperationFailed } from '../AsyncOperationFailed.js';
|
|
5
5
|
/**
|
|
6
|
-
* Emitted when [releasing](https://serenity-js.org/api/core/
|
|
6
|
+
* Emitted when [releasing](https://serenity-js.org/api/core/class/Discardable/) an
|
|
7
7
|
* [`Actor`](https://serenity-js.org/api/core/class/Actor/) or its abilities
|
|
8
8
|
* resulted in an error either
|
|
9
9
|
* upon the [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/) event
|
|
@@ -7,7 +7,7 @@ import { DomainEvent } from '../DomainEvent.js';
|
|
|
7
7
|
* [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/) events
|
|
8
8
|
* to notify the [stage crew members](https://serenity-js.org/api/core/interface/StageCrewMember/)
|
|
9
9
|
* about the final state of the [actors](https://serenity-js.org/api/core/class/Actor/) and their abilities
|
|
10
|
-
* before they're [released](https://serenity-js.org/api/core/
|
|
10
|
+
* before they're [released](https://serenity-js.org/api/core/class/Discardable/).
|
|
11
11
|
*
|
|
12
12
|
* @group Events
|
|
13
13
|
*/
|
|
@@ -7,7 +7,7 @@ import { DomainEvent } from '../DomainEvent.js';
|
|
|
7
7
|
* [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/) events
|
|
8
8
|
* to notify the [stage crew members](https://serenity-js.org/api/core/interface/StageCrewMember/)
|
|
9
9
|
* about the final state of the [actors](https://serenity-js.org/api/core/class/Actor/) and their abilities
|
|
10
|
-
* before they're [released](https://serenity-js.org/api/core/
|
|
10
|
+
* before they're [released](https://serenity-js.org/api/core/class/Discardable/).
|
|
11
11
|
*
|
|
12
12
|
* @group Events
|
|
13
13
|
*/
|
|
@@ -130,8 +130,8 @@ export declare class Actor implements PerformsActivities, UsesAbilities, CanHave
|
|
|
130
130
|
*/
|
|
131
131
|
currentTime(): Timestamp;
|
|
132
132
|
/**
|
|
133
|
-
* Instructs the actor to invoke [`Discardable.discard`](https://serenity-js.org/api/core/
|
|
134
|
-
* [discardable](https://serenity-js.org/api/core/
|
|
133
|
+
* Instructs the actor to invoke [`Discardable.discard`](https://serenity-js.org/api/core/class/Discardable/#discard) method on any
|
|
134
|
+
* [discardable](https://serenity-js.org/api/core/class/Discardable/) [ability](https://serenity-js.org/api/core/class/Ability/) it's been configured with.
|
|
135
135
|
*/
|
|
136
136
|
dismiss(): Promise<void>;
|
|
137
137
|
/**
|
package/esm/screenplay/Actor.js
CHANGED
|
@@ -154,8 +154,8 @@ export class Actor {
|
|
|
154
154
|
return this.stage.currentTime();
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
157
|
-
* Instructs the actor to invoke [`Discardable.discard`](https://serenity-js.org/api/core/
|
|
158
|
-
* [discardable](https://serenity-js.org/api/core/
|
|
157
|
+
* Instructs the actor to invoke [`Discardable.discard`](https://serenity-js.org/api/core/class/Discardable/#discard) method on any
|
|
158
|
+
* [discardable](https://serenity-js.org/api/core/class/Discardable/) [ability](https://serenity-js.org/api/core/class/Ability/) it's been configured with.
|
|
159
159
|
*/
|
|
160
160
|
dismiss() {
|
|
161
161
|
return this.findAbilitiesWhere(Discardable.isDiscardable)
|
|
@@ -42,8 +42,8 @@ import type { UsesAbilities } from './UsesAbilities.js';
|
|
|
42
42
|
* From the technical perspective, an **ability** is an [adapter](https://en.wikipedia.org/wiki/Adapter_pattern)
|
|
43
43
|
* around an interface-specific integration library, such as a web browser driver, an HTTP client, a database client, and so on.
|
|
44
44
|
* You give an actor an ability, and it's the ability's responsibility to provide a consistent API around the integration library and deal with any of its quirks.
|
|
45
|
-
* Abilities **encapsulate integration libraries** and handle their [configuration and initialisation](https://serenity-js.org/api/core/
|
|
46
|
-
* the process of [freeing up any resources](https://serenity-js.org/api/core/
|
|
45
|
+
* Abilities **encapsulate integration libraries** and handle their [configuration and initialisation](https://serenity-js.org/api/core/class/Initialisable/),
|
|
46
|
+
* the process of [freeing up any resources](https://serenity-js.org/api/core/class/Discardable/) they hold,
|
|
47
47
|
* as well as managing any state associated with the library.
|
|
48
48
|
*
|
|
49
49
|
* ### Portable interactions with web interfaces
|
|
@@ -268,8 +268,8 @@ import type { UsesAbilities } from './UsesAbilities.js';
|
|
|
268
268
|
*
|
|
269
269
|
* Abilities that rely on resources that need to be initialised before they can be used,
|
|
270
270
|
* or discarded before the actor is dismissed can implement
|
|
271
|
-
* the [`Initialisable`](https://serenity-js.org/api/core/
|
|
272
|
-
* or [`Discardable`](https://serenity-js.org/api/core/
|
|
271
|
+
* the [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
272
|
+
* or [`Discardable`](https://serenity-js.org/api/core/class/Discardable/) interfaces, respectively.
|
|
273
273
|
*
|
|
274
274
|
* ### Defining a custom ability to `QueryPostgresDB`
|
|
275
275
|
*
|
|
@@ -351,8 +351,8 @@ import type { UsesAbilities } from './UsesAbilities.js';
|
|
|
351
351
|
*
|
|
352
352
|
* ## Learn more
|
|
353
353
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
354
|
-
* - [`Initialisable`](https://serenity-js.org/api/core/
|
|
355
|
-
* - [`Discardable`](https://serenity-js.org/api/core/
|
|
354
|
+
* - [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
355
|
+
* - [`Discardable`](https://serenity-js.org/api/core/class/Discardable/)
|
|
356
356
|
* - [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
357
357
|
* - [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/)
|
|
358
358
|
* - [`TakeNotes`](https://serenity-js.org/api/core/class/TakeNotes/)
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
* From the technical perspective, an **ability** is an [adapter](https://en.wikipedia.org/wiki/Adapter_pattern)
|
|
40
40
|
* around an interface-specific integration library, such as a web browser driver, an HTTP client, a database client, and so on.
|
|
41
41
|
* You give an actor an ability, and it's the ability's responsibility to provide a consistent API around the integration library and deal with any of its quirks.
|
|
42
|
-
* Abilities **encapsulate integration libraries** and handle their [configuration and initialisation](https://serenity-js.org/api/core/
|
|
43
|
-
* the process of [freeing up any resources](https://serenity-js.org/api/core/
|
|
42
|
+
* Abilities **encapsulate integration libraries** and handle their [configuration and initialisation](https://serenity-js.org/api/core/class/Initialisable/),
|
|
43
|
+
* the process of [freeing up any resources](https://serenity-js.org/api/core/class/Discardable/) they hold,
|
|
44
44
|
* as well as managing any state associated with the library.
|
|
45
45
|
*
|
|
46
46
|
* ### Portable interactions with web interfaces
|
|
@@ -265,8 +265,8 @@
|
|
|
265
265
|
*
|
|
266
266
|
* Abilities that rely on resources that need to be initialised before they can be used,
|
|
267
267
|
* or discarded before the actor is dismissed can implement
|
|
268
|
-
* the [`Initialisable`](https://serenity-js.org/api/core/
|
|
269
|
-
* or [`Discardable`](https://serenity-js.org/api/core/
|
|
268
|
+
* the [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
269
|
+
* or [`Discardable`](https://serenity-js.org/api/core/class/Discardable/) interfaces, respectively.
|
|
270
270
|
*
|
|
271
271
|
* ### Defining a custom ability to `QueryPostgresDB`
|
|
272
272
|
*
|
|
@@ -348,8 +348,8 @@
|
|
|
348
348
|
*
|
|
349
349
|
* ## Learn more
|
|
350
350
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
351
|
-
* - [`Initialisable`](https://serenity-js.org/api/core/
|
|
352
|
-
* - [`Discardable`](https://serenity-js.org/api/core/
|
|
351
|
+
* - [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
352
|
+
* - [`Discardable`](https://serenity-js.org/api/core/class/Discardable/)
|
|
353
353
|
* - [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
354
354
|
* - [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/)
|
|
355
355
|
* - [`TakeNotes`](https://serenity-js.org/api/core/class/TakeNotes/)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* An interface to be implemented by any [`Ability`](https://serenity-js.org/api/core/class/Ability/) that needs to free up
|
|
3
3
|
* the resources it uses, e.g. disconnect from a database.
|
|
4
4
|
*
|
|
5
|
-
* This [`Discardable.discard`](https://serenity-js.org/api/core/
|
|
5
|
+
* This [`Discardable.discard`](https://serenity-js.org/api/core/class/Discardable/#discard) method is invoked directly by the [actor](https://serenity-js.org/api/core/class/Actor/), and indirectly by the [stage](https://serenity-js.org/api/core/class/Stage/):
|
|
6
6
|
* - when [SceneFinishes](https://serenity-js.org/api/core-events/class/SceneFinishes/), for actors instantiated after [SceneStarts](https://serenity-js.org/api/core-events/class/SceneStarts/) - e.g. within a test scenario or in a "before each" hook
|
|
7
7
|
* - when [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/), for actors instantiated before [SceneStarts](https://serenity-js.org/api/core-events/class/SceneStarts/) - e.g. in a "before all" hook
|
|
8
8
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* ## Learn more
|
|
14
14
|
* - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
|
|
15
15
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
16
|
-
* - [`Initialisable`](https://serenity-js.org/api/core/
|
|
16
|
+
* - [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
17
17
|
*
|
|
18
18
|
* @group Abilities
|
|
19
19
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* An interface to be implemented by any [`Ability`](https://serenity-js.org/api/core/class/Ability/) that needs to free up
|
|
3
3
|
* the resources it uses, e.g. disconnect from a database.
|
|
4
4
|
*
|
|
5
|
-
* This [`Discardable.discard`](https://serenity-js.org/api/core/
|
|
5
|
+
* This [`Discardable.discard`](https://serenity-js.org/api/core/class/Discardable/#discard) method is invoked directly by the [actor](https://serenity-js.org/api/core/class/Actor/), and indirectly by the [stage](https://serenity-js.org/api/core/class/Stage/):
|
|
6
6
|
* - when [SceneFinishes](https://serenity-js.org/api/core-events/class/SceneFinishes/), for actors instantiated after [SceneStarts](https://serenity-js.org/api/core-events/class/SceneStarts/) - e.g. within a test scenario or in a "before each" hook
|
|
7
7
|
* - when [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/), for actors instantiated before [SceneStarts](https://serenity-js.org/api/core-events/class/SceneStarts/) - e.g. in a "before all" hook
|
|
8
8
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* ## Learn more
|
|
14
14
|
* - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
|
|
15
15
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
16
|
-
* - [`Initialisable`](https://serenity-js.org/api/core/
|
|
16
|
+
* - [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
17
17
|
*
|
|
18
18
|
* @group Abilities
|
|
19
19
|
*/
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* An interface to be implemented by any [`Ability`](https://serenity-js.org/api/core/class/Ability/) that needs to initialise
|
|
3
3
|
* the resources it uses, e.g. establish a database connection.
|
|
4
4
|
*
|
|
5
|
-
* The [`Initialisable.initialise`](https://serenity-js.org/api/core/
|
|
6
|
-
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/
|
|
5
|
+
* The [`Initialisable.initialise`](https://serenity-js.org/api/core/class/Initialisable/#initialise) method is invoked whenever [`Actor.attemptsTo`](https://serenity-js.org/api/core/class/Actor/#attemptsTo) method is called,
|
|
6
|
+
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/class/Initialisable/#isInitialised) returns false. This is to avoid initialising abilities more than once.
|
|
7
7
|
*
|
|
8
8
|
* ## Learn more
|
|
9
9
|
* - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
|
|
10
10
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
11
|
-
* - [`Discardable`](https://serenity-js.org/api/core/
|
|
11
|
+
* - [`Discardable`](https://serenity-js.org/api/core/class/Discardable/)
|
|
12
12
|
*
|
|
13
13
|
* @group Abilities
|
|
14
14
|
*/
|
|
@@ -16,9 +16,9 @@ export declare abstract class Initialisable {
|
|
|
16
16
|
static isInitialisable<T>(value: T): value is T & Initialisable;
|
|
17
17
|
/**
|
|
18
18
|
* Initialises the ability. Invoked whenever [`Actor.attemptsTo`](https://serenity-js.org/api/core/class/Actor/#attemptsTo) method is called,
|
|
19
|
-
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/
|
|
19
|
+
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/class/Initialisable/#isInitialised) returns false.
|
|
20
20
|
*
|
|
21
|
-
* Make sure to implement [`Initialisable.isInitialised`](https://serenity-js.org/api/core/
|
|
21
|
+
* Make sure to implement [`Initialisable.isInitialised`](https://serenity-js.org/api/core/class/Initialisable/#isInitialised) so that it returns `true`
|
|
22
22
|
* when the ability has been successfully initialised.
|
|
23
23
|
*/
|
|
24
24
|
abstract initialise(): Promise<void> | void;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* An interface to be implemented by any [`Ability`](https://serenity-js.org/api/core/class/Ability/) that needs to initialise
|
|
3
3
|
* the resources it uses, e.g. establish a database connection.
|
|
4
4
|
*
|
|
5
|
-
* The [`Initialisable.initialise`](https://serenity-js.org/api/core/
|
|
6
|
-
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/
|
|
5
|
+
* The [`Initialisable.initialise`](https://serenity-js.org/api/core/class/Initialisable/#initialise) method is invoked whenever [`Actor.attemptsTo`](https://serenity-js.org/api/core/class/Actor/#attemptsTo) method is called,
|
|
6
|
+
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/class/Initialisable/#isInitialised) returns false. This is to avoid initialising abilities more than once.
|
|
7
7
|
*
|
|
8
8
|
* ## Learn more
|
|
9
9
|
* - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
|
|
10
10
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
11
|
-
* - [`Discardable`](https://serenity-js.org/api/core/
|
|
11
|
+
* - [`Discardable`](https://serenity-js.org/api/core/class/Discardable/)
|
|
12
12
|
*
|
|
13
13
|
* @group Abilities
|
|
14
14
|
*/
|
|
@@ -27,7 +27,7 @@ export type StageFocus = 'foreground' | 'background';
|
|
|
27
27
|
* By default, actors created before the actual test scenario starts, e.g. in beforeAll hooks, are placed in the `'background'` focus area.
|
|
28
28
|
* When a [`SceneStarts`](https://serenity-js.org/api/core-events/class/SceneStarts/) event is announced,
|
|
29
29
|
* the focus switches to `'foreground'`. When a [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/)
|
|
30
|
-
* event is announced, foreground actors are dismissed, their abilities [discarded](https://serenity-js.org/api/core/
|
|
30
|
+
* event is announced, foreground actors are dismissed, their abilities [discarded](https://serenity-js.org/api/core/class/Discardable/)
|
|
31
31
|
* and focus returns to `'background'`.
|
|
32
32
|
*
|
|
33
33
|
* ## Custom lifecycle management
|
|
@@ -19,7 +19,7 @@ import { Actor, ScheduleWork } from '../screenplay/index.js';
|
|
|
19
19
|
* By default, actors created before the actual test scenario starts, e.g. in beforeAll hooks, are placed in the `'background'` focus area.
|
|
20
20
|
* When a [`SceneStarts`](https://serenity-js.org/api/core-events/class/SceneStarts/) event is announced,
|
|
21
21
|
* the focus switches to `'foreground'`. When a [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/)
|
|
22
|
-
* event is announced, foreground actors are dismissed, their abilities [discarded](https://serenity-js.org/api/core/
|
|
22
|
+
* event is announced, foreground actors are dismissed, their abilities [discarded](https://serenity-js.org/api/core/class/Discardable/)
|
|
23
23
|
* and focus returns to `'background'`.
|
|
24
24
|
*
|
|
25
25
|
* ## Custom lifecycle management
|
|
@@ -35,7 +35,7 @@ export declare abstract class SerenityConfig {
|
|
|
35
35
|
* 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
|
|
36
36
|
* that Serenity/JS should wait for any post-scenario
|
|
37
37
|
* async operations to complete. Those include generating the screenshots,
|
|
38
|
-
* saving reports to disk, [dismissing the actors](https://serenity-js.org/api/core/
|
|
38
|
+
* saving reports to disk, [dismissing the actors](https://serenity-js.org/api/core/class/Discardable/), and so on.
|
|
39
39
|
*
|
|
40
40
|
* Defaults to 5 seconds.
|
|
41
41
|
*
|
|
@@ -33,7 +33,7 @@ class SerenityConfig {
|
|
|
33
33
|
* 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
|
|
34
34
|
* that Serenity/JS should wait for any post-scenario
|
|
35
35
|
* async operations to complete. Those include generating the screenshots,
|
|
36
|
-
* saving reports to disk, [dismissing the actors](https://serenity-js.org/api/core/
|
|
36
|
+
* saving reports to disk, [dismissing the actors](https://serenity-js.org/api/core/class/Discardable/), and so on.
|
|
37
37
|
*
|
|
38
38
|
* Defaults to 5 seconds.
|
|
39
39
|
*
|
|
@@ -5,7 +5,7 @@ import { DomainEvent } from './DomainEvent.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Emitted by a Serenity/JS test runner adapter, right before a test and all its associated test hooks finish.
|
|
7
7
|
* Triggers any clean-up operations that might be required, such as discarding of
|
|
8
|
-
* the [discardable](https://serenity-js.org/api/core/
|
|
8
|
+
* the [discardable](https://serenity-js.org/api/core/class/Discardable/) abilities.
|
|
9
9
|
*
|
|
10
10
|
* The `outcome` property contains the test outcome determined so far, before any cleanup operations.
|
|
11
11
|
* This allows stage crew members like the WebdriverIO notifier to invoke hooks with the test result
|
|
@@ -8,7 +8,7 @@ const DomainEvent_js_1 = require("./DomainEvent.js");
|
|
|
8
8
|
/**
|
|
9
9
|
* Emitted by a Serenity/JS test runner adapter, right before a test and all its associated test hooks finish.
|
|
10
10
|
* Triggers any clean-up operations that might be required, such as discarding of
|
|
11
|
-
* the [discardable](https://serenity-js.org/api/core/
|
|
11
|
+
* the [discardable](https://serenity-js.org/api/core/class/Discardable/) abilities.
|
|
12
12
|
*
|
|
13
13
|
* The `outcome` property contains the test outcome determined so far, before any cleanup operations.
|
|
14
14
|
* This allows stage crew members like the WebdriverIO notifier to invoke hooks with the test result
|
|
@@ -4,7 +4,7 @@ import { Timestamp } from '../../screenplay/index.js';
|
|
|
4
4
|
import { AsyncOperationCompleted } from '../AsyncOperationCompleted.js';
|
|
5
5
|
/**
|
|
6
6
|
* Emitted when an [`Actor`](https://serenity-js.org/api/core/class/Actor/) and its abilities
|
|
7
|
-
* are correctly [released](https://serenity-js.org/api/core/
|
|
7
|
+
* are correctly [released](https://serenity-js.org/api/core/class/Discardable/) either
|
|
8
8
|
* upon the [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/) event
|
|
9
9
|
* for actors initialised within the scope of a test scenario,
|
|
10
10
|
* or upon the [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/) event
|
|
@@ -7,7 +7,7 @@ const index_js_2 = require("../../screenplay/index.js");
|
|
|
7
7
|
const AsyncOperationCompleted_js_1 = require("../AsyncOperationCompleted.js");
|
|
8
8
|
/**
|
|
9
9
|
* Emitted when an [`Actor`](https://serenity-js.org/api/core/class/Actor/) and its abilities
|
|
10
|
-
* are correctly [released](https://serenity-js.org/api/core/
|
|
10
|
+
* are correctly [released](https://serenity-js.org/api/core/class/Discardable/) either
|
|
11
11
|
* upon the [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/) event
|
|
12
12
|
* for actors initialised within the scope of a test scenario,
|
|
13
13
|
* or upon the [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/) event
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { JSONObject } from 'tiny-types';
|
|
2
2
|
import { AsyncOperationFailed } from '../AsyncOperationFailed.js';
|
|
3
3
|
/**
|
|
4
|
-
* Emitted when [releasing](https://serenity-js.org/api/core/
|
|
4
|
+
* Emitted when [releasing](https://serenity-js.org/api/core/class/Discardable/) an
|
|
5
5
|
* [`Actor`](https://serenity-js.org/api/core/class/Actor/) or its abilities
|
|
6
6
|
* resulted in an error either
|
|
7
7
|
* upon the [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/) event
|
|
@@ -6,7 +6,7 @@ const index_js_2 = require("../../model/index.js");
|
|
|
6
6
|
const index_js_3 = require("../../screenplay/index.js");
|
|
7
7
|
const AsyncOperationFailed_js_1 = require("../AsyncOperationFailed.js");
|
|
8
8
|
/**
|
|
9
|
-
* Emitted when [releasing](https://serenity-js.org/api/core/
|
|
9
|
+
* Emitted when [releasing](https://serenity-js.org/api/core/class/Discardable/) an
|
|
10
10
|
* [`Actor`](https://serenity-js.org/api/core/class/Actor/) or its abilities
|
|
11
11
|
* resulted in an error either
|
|
12
12
|
* upon the [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/) event
|
|
@@ -7,7 +7,7 @@ import { DomainEvent } from '../DomainEvent.js';
|
|
|
7
7
|
* [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/) events
|
|
8
8
|
* to notify the [stage crew members](https://serenity-js.org/api/core/interface/StageCrewMember/)
|
|
9
9
|
* about the final state of the [actors](https://serenity-js.org/api/core/class/Actor/) and their abilities
|
|
10
|
-
* before they're [released](https://serenity-js.org/api/core/
|
|
10
|
+
* before they're [released](https://serenity-js.org/api/core/class/Discardable/).
|
|
11
11
|
*
|
|
12
12
|
* @group Events
|
|
13
13
|
*/
|
|
@@ -10,7 +10,7 @@ const DomainEvent_js_1 = require("../DomainEvent.js");
|
|
|
10
10
|
* [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/) events
|
|
11
11
|
* to notify the [stage crew members](https://serenity-js.org/api/core/interface/StageCrewMember/)
|
|
12
12
|
* about the final state of the [actors](https://serenity-js.org/api/core/class/Actor/) and their abilities
|
|
13
|
-
* before they're [released](https://serenity-js.org/api/core/
|
|
13
|
+
* before they're [released](https://serenity-js.org/api/core/class/Discardable/).
|
|
14
14
|
*
|
|
15
15
|
* @group Events
|
|
16
16
|
*/
|
|
@@ -130,8 +130,8 @@ export declare class Actor implements PerformsActivities, UsesAbilities, CanHave
|
|
|
130
130
|
*/
|
|
131
131
|
currentTime(): Timestamp;
|
|
132
132
|
/**
|
|
133
|
-
* Instructs the actor to invoke [`Discardable.discard`](https://serenity-js.org/api/core/
|
|
134
|
-
* [discardable](https://serenity-js.org/api/core/
|
|
133
|
+
* Instructs the actor to invoke [`Discardable.discard`](https://serenity-js.org/api/core/class/Discardable/#discard) method on any
|
|
134
|
+
* [discardable](https://serenity-js.org/api/core/class/Discardable/) [ability](https://serenity-js.org/api/core/class/Ability/) it's been configured with.
|
|
135
135
|
*/
|
|
136
136
|
dismiss(): Promise<void>;
|
|
137
137
|
/**
|
package/lib/screenplay/Actor.js
CHANGED
|
@@ -157,8 +157,8 @@ class Actor {
|
|
|
157
157
|
return this.stage.currentTime();
|
|
158
158
|
}
|
|
159
159
|
/**
|
|
160
|
-
* Instructs the actor to invoke [`Discardable.discard`](https://serenity-js.org/api/core/
|
|
161
|
-
* [discardable](https://serenity-js.org/api/core/
|
|
160
|
+
* Instructs the actor to invoke [`Discardable.discard`](https://serenity-js.org/api/core/class/Discardable/#discard) method on any
|
|
161
|
+
* [discardable](https://serenity-js.org/api/core/class/Discardable/) [ability](https://serenity-js.org/api/core/class/Ability/) it's been configured with.
|
|
162
162
|
*/
|
|
163
163
|
dismiss() {
|
|
164
164
|
return this.findAbilitiesWhere(index_js_5.Discardable.isDiscardable)
|
|
@@ -42,8 +42,8 @@ import type { UsesAbilities } from './UsesAbilities.js';
|
|
|
42
42
|
* From the technical perspective, an **ability** is an [adapter](https://en.wikipedia.org/wiki/Adapter_pattern)
|
|
43
43
|
* around an interface-specific integration library, such as a web browser driver, an HTTP client, a database client, and so on.
|
|
44
44
|
* You give an actor an ability, and it's the ability's responsibility to provide a consistent API around the integration library and deal with any of its quirks.
|
|
45
|
-
* Abilities **encapsulate integration libraries** and handle their [configuration and initialisation](https://serenity-js.org/api/core/
|
|
46
|
-
* the process of [freeing up any resources](https://serenity-js.org/api/core/
|
|
45
|
+
* Abilities **encapsulate integration libraries** and handle their [configuration and initialisation](https://serenity-js.org/api/core/class/Initialisable/),
|
|
46
|
+
* the process of [freeing up any resources](https://serenity-js.org/api/core/class/Discardable/) they hold,
|
|
47
47
|
* as well as managing any state associated with the library.
|
|
48
48
|
*
|
|
49
49
|
* ### Portable interactions with web interfaces
|
|
@@ -268,8 +268,8 @@ import type { UsesAbilities } from './UsesAbilities.js';
|
|
|
268
268
|
*
|
|
269
269
|
* Abilities that rely on resources that need to be initialised before they can be used,
|
|
270
270
|
* or discarded before the actor is dismissed can implement
|
|
271
|
-
* the [`Initialisable`](https://serenity-js.org/api/core/
|
|
272
|
-
* or [`Discardable`](https://serenity-js.org/api/core/
|
|
271
|
+
* the [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
272
|
+
* or [`Discardable`](https://serenity-js.org/api/core/class/Discardable/) interfaces, respectively.
|
|
273
273
|
*
|
|
274
274
|
* ### Defining a custom ability to `QueryPostgresDB`
|
|
275
275
|
*
|
|
@@ -351,8 +351,8 @@ import type { UsesAbilities } from './UsesAbilities.js';
|
|
|
351
351
|
*
|
|
352
352
|
* ## Learn more
|
|
353
353
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
354
|
-
* - [`Initialisable`](https://serenity-js.org/api/core/
|
|
355
|
-
* - [`Discardable`](https://serenity-js.org/api/core/
|
|
354
|
+
* - [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
355
|
+
* - [`Discardable`](https://serenity-js.org/api/core/class/Discardable/)
|
|
356
356
|
* - [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
357
357
|
* - [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/)
|
|
358
358
|
* - [`TakeNotes`](https://serenity-js.org/api/core/class/TakeNotes/)
|
|
@@ -42,8 +42,8 @@ exports.Ability = void 0;
|
|
|
42
42
|
* From the technical perspective, an **ability** is an [adapter](https://en.wikipedia.org/wiki/Adapter_pattern)
|
|
43
43
|
* around an interface-specific integration library, such as a web browser driver, an HTTP client, a database client, and so on.
|
|
44
44
|
* You give an actor an ability, and it's the ability's responsibility to provide a consistent API around the integration library and deal with any of its quirks.
|
|
45
|
-
* Abilities **encapsulate integration libraries** and handle their [configuration and initialisation](https://serenity-js.org/api/core/
|
|
46
|
-
* the process of [freeing up any resources](https://serenity-js.org/api/core/
|
|
45
|
+
* Abilities **encapsulate integration libraries** and handle their [configuration and initialisation](https://serenity-js.org/api/core/class/Initialisable/),
|
|
46
|
+
* the process of [freeing up any resources](https://serenity-js.org/api/core/class/Discardable/) they hold,
|
|
47
47
|
* as well as managing any state associated with the library.
|
|
48
48
|
*
|
|
49
49
|
* ### Portable interactions with web interfaces
|
|
@@ -268,8 +268,8 @@ exports.Ability = void 0;
|
|
|
268
268
|
*
|
|
269
269
|
* Abilities that rely on resources that need to be initialised before they can be used,
|
|
270
270
|
* or discarded before the actor is dismissed can implement
|
|
271
|
-
* the [`Initialisable`](https://serenity-js.org/api/core/
|
|
272
|
-
* or [`Discardable`](https://serenity-js.org/api/core/
|
|
271
|
+
* the [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
272
|
+
* or [`Discardable`](https://serenity-js.org/api/core/class/Discardable/) interfaces, respectively.
|
|
273
273
|
*
|
|
274
274
|
* ### Defining a custom ability to `QueryPostgresDB`
|
|
275
275
|
*
|
|
@@ -351,8 +351,8 @@ exports.Ability = void 0;
|
|
|
351
351
|
*
|
|
352
352
|
* ## Learn more
|
|
353
353
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
354
|
-
* - [`Initialisable`](https://serenity-js.org/api/core/
|
|
355
|
-
* - [`Discardable`](https://serenity-js.org/api/core/
|
|
354
|
+
* - [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
355
|
+
* - [`Discardable`](https://serenity-js.org/api/core/class/Discardable/)
|
|
356
356
|
* - [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
357
357
|
* - [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/)
|
|
358
358
|
* - [`TakeNotes`](https://serenity-js.org/api/core/class/TakeNotes/)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* An interface to be implemented by any [`Ability`](https://serenity-js.org/api/core/class/Ability/) that needs to free up
|
|
3
3
|
* the resources it uses, e.g. disconnect from a database.
|
|
4
4
|
*
|
|
5
|
-
* This [`Discardable.discard`](https://serenity-js.org/api/core/
|
|
5
|
+
* This [`Discardable.discard`](https://serenity-js.org/api/core/class/Discardable/#discard) method is invoked directly by the [actor](https://serenity-js.org/api/core/class/Actor/), and indirectly by the [stage](https://serenity-js.org/api/core/class/Stage/):
|
|
6
6
|
* - when [SceneFinishes](https://serenity-js.org/api/core-events/class/SceneFinishes/), for actors instantiated after [SceneStarts](https://serenity-js.org/api/core-events/class/SceneStarts/) - e.g. within a test scenario or in a "before each" hook
|
|
7
7
|
* - when [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/), for actors instantiated before [SceneStarts](https://serenity-js.org/api/core-events/class/SceneStarts/) - e.g. in a "before all" hook
|
|
8
8
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* ## Learn more
|
|
14
14
|
* - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
|
|
15
15
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
16
|
-
* - [`Initialisable`](https://serenity-js.org/api/core/
|
|
16
|
+
* - [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
17
17
|
*
|
|
18
18
|
* @group Abilities
|
|
19
19
|
*/
|
|
@@ -5,7 +5,7 @@ exports.Discardable = void 0;
|
|
|
5
5
|
* An interface to be implemented by any [`Ability`](https://serenity-js.org/api/core/class/Ability/) that needs to free up
|
|
6
6
|
* the resources it uses, e.g. disconnect from a database.
|
|
7
7
|
*
|
|
8
|
-
* This [`Discardable.discard`](https://serenity-js.org/api/core/
|
|
8
|
+
* This [`Discardable.discard`](https://serenity-js.org/api/core/class/Discardable/#discard) method is invoked directly by the [actor](https://serenity-js.org/api/core/class/Actor/), and indirectly by the [stage](https://serenity-js.org/api/core/class/Stage/):
|
|
9
9
|
* - when [SceneFinishes](https://serenity-js.org/api/core-events/class/SceneFinishes/), for actors instantiated after [SceneStarts](https://serenity-js.org/api/core-events/class/SceneStarts/) - e.g. within a test scenario or in a "before each" hook
|
|
10
10
|
* - when [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/), for actors instantiated before [SceneStarts](https://serenity-js.org/api/core-events/class/SceneStarts/) - e.g. in a "before all" hook
|
|
11
11
|
*
|
|
@@ -16,7 +16,7 @@ exports.Discardable = void 0;
|
|
|
16
16
|
* ## Learn more
|
|
17
17
|
* - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
|
|
18
18
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
19
|
-
* - [`Initialisable`](https://serenity-js.org/api/core/
|
|
19
|
+
* - [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
20
20
|
*
|
|
21
21
|
* @group Abilities
|
|
22
22
|
*/
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* An interface to be implemented by any [`Ability`](https://serenity-js.org/api/core/class/Ability/) that needs to initialise
|
|
3
3
|
* the resources it uses, e.g. establish a database connection.
|
|
4
4
|
*
|
|
5
|
-
* The [`Initialisable.initialise`](https://serenity-js.org/api/core/
|
|
6
|
-
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/
|
|
5
|
+
* The [`Initialisable.initialise`](https://serenity-js.org/api/core/class/Initialisable/#initialise) method is invoked whenever [`Actor.attemptsTo`](https://serenity-js.org/api/core/class/Actor/#attemptsTo) method is called,
|
|
6
|
+
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/class/Initialisable/#isInitialised) returns false. This is to avoid initialising abilities more than once.
|
|
7
7
|
*
|
|
8
8
|
* ## Learn more
|
|
9
9
|
* - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
|
|
10
10
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
11
|
-
* - [`Discardable`](https://serenity-js.org/api/core/
|
|
11
|
+
* - [`Discardable`](https://serenity-js.org/api/core/class/Discardable/)
|
|
12
12
|
*
|
|
13
13
|
* @group Abilities
|
|
14
14
|
*/
|
|
@@ -16,9 +16,9 @@ export declare abstract class Initialisable {
|
|
|
16
16
|
static isInitialisable<T>(value: T): value is T & Initialisable;
|
|
17
17
|
/**
|
|
18
18
|
* Initialises the ability. Invoked whenever [`Actor.attemptsTo`](https://serenity-js.org/api/core/class/Actor/#attemptsTo) method is called,
|
|
19
|
-
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/
|
|
19
|
+
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/class/Initialisable/#isInitialised) returns false.
|
|
20
20
|
*
|
|
21
|
-
* Make sure to implement [`Initialisable.isInitialised`](https://serenity-js.org/api/core/
|
|
21
|
+
* Make sure to implement [`Initialisable.isInitialised`](https://serenity-js.org/api/core/class/Initialisable/#isInitialised) so that it returns `true`
|
|
22
22
|
* when the ability has been successfully initialised.
|
|
23
23
|
*/
|
|
24
24
|
abstract initialise(): Promise<void> | void;
|
|
@@ -5,13 +5,13 @@ exports.Initialisable = void 0;
|
|
|
5
5
|
* An interface to be implemented by any [`Ability`](https://serenity-js.org/api/core/class/Ability/) that needs to initialise
|
|
6
6
|
* the resources it uses, e.g. establish a database connection.
|
|
7
7
|
*
|
|
8
|
-
* The [`Initialisable.initialise`](https://serenity-js.org/api/core/
|
|
9
|
-
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/
|
|
8
|
+
* The [`Initialisable.initialise`](https://serenity-js.org/api/core/class/Initialisable/#initialise) method is invoked whenever [`Actor.attemptsTo`](https://serenity-js.org/api/core/class/Actor/#attemptsTo) method is called,
|
|
9
|
+
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/class/Initialisable/#isInitialised) returns false. This is to avoid initialising abilities more than once.
|
|
10
10
|
*
|
|
11
11
|
* ## Learn more
|
|
12
12
|
* - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
|
|
13
13
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
14
|
-
* - [`Discardable`](https://serenity-js.org/api/core/
|
|
14
|
+
* - [`Discardable`](https://serenity-js.org/api/core/class/Discardable/)
|
|
15
15
|
*
|
|
16
16
|
* @group Abilities
|
|
17
17
|
*/
|
|
@@ -27,7 +27,7 @@ export type StageFocus = 'foreground' | 'background';
|
|
|
27
27
|
* By default, actors created before the actual test scenario starts, e.g. in beforeAll hooks, are placed in the `'background'` focus area.
|
|
28
28
|
* When a [`SceneStarts`](https://serenity-js.org/api/core-events/class/SceneStarts/) event is announced,
|
|
29
29
|
* the focus switches to `'foreground'`. When a [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/)
|
|
30
|
-
* event is announced, foreground actors are dismissed, their abilities [discarded](https://serenity-js.org/api/core/
|
|
30
|
+
* event is announced, foreground actors are dismissed, their abilities [discarded](https://serenity-js.org/api/core/class/Discardable/)
|
|
31
31
|
* and focus returns to `'background'`.
|
|
32
32
|
*
|
|
33
33
|
* ## Custom lifecycle management
|
|
@@ -22,7 +22,7 @@ const index_js_4 = require("../screenplay/index.js");
|
|
|
22
22
|
* By default, actors created before the actual test scenario starts, e.g. in beforeAll hooks, are placed in the `'background'` focus area.
|
|
23
23
|
* When a [`SceneStarts`](https://serenity-js.org/api/core-events/class/SceneStarts/) event is announced,
|
|
24
24
|
* the focus switches to `'foreground'`. When a [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/)
|
|
25
|
-
* event is announced, foreground actors are dismissed, their abilities [discarded](https://serenity-js.org/api/core/
|
|
25
|
+
* event is announced, foreground actors are dismissed, their abilities [discarded](https://serenity-js.org/api/core/class/Discardable/)
|
|
26
26
|
* and focus returns to `'background'`.
|
|
27
27
|
*
|
|
28
28
|
* ## Custom lifecycle management
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/core",
|
|
3
|
-
"version": "3.43.
|
|
3
|
+
"version": "3.43.1",
|
|
4
4
|
"description": "The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
@@ -345,5 +345,5 @@
|
|
|
345
345
|
"engines": {
|
|
346
346
|
"node": "^20 || ^22 || ^24"
|
|
347
347
|
},
|
|
348
|
-
"gitHead": "
|
|
348
|
+
"gitHead": "b7cc8abc2e54e11707f1b3611df16c4bcdadcf62"
|
|
349
349
|
}
|
|
@@ -39,7 +39,7 @@ export abstract class SerenityConfig {
|
|
|
39
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, [dismissing the actors](https://serenity-js.org/api/core/
|
|
42
|
+
* saving reports to disk, [dismissing the actors](https://serenity-js.org/api/core/class/Discardable/), and so on.
|
|
43
43
|
*
|
|
44
44
|
* Defaults to 5 seconds.
|
|
45
45
|
*
|
|
@@ -9,7 +9,7 @@ import { DomainEvent } from './DomainEvent.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* Emitted by a Serenity/JS test runner adapter, right before a test and all its associated test hooks finish.
|
|
11
11
|
* Triggers any clean-up operations that might be required, such as discarding of
|
|
12
|
-
* the [discardable](https://serenity-js.org/api/core/
|
|
12
|
+
* the [discardable](https://serenity-js.org/api/core/class/Discardable/) abilities.
|
|
13
13
|
*
|
|
14
14
|
* The `outcome` property contains the test outcome determined so far, before any cleanup operations.
|
|
15
15
|
* This allows stage crew members like the WebdriverIO notifier to invoke hooks with the test result
|
|
@@ -6,7 +6,7 @@ import { AsyncOperationCompleted } from '../AsyncOperationCompleted.js';
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Emitted when an [`Actor`](https://serenity-js.org/api/core/class/Actor/) and its abilities
|
|
9
|
-
* are correctly [released](https://serenity-js.org/api/core/
|
|
9
|
+
* are correctly [released](https://serenity-js.org/api/core/class/Discardable/) either
|
|
10
10
|
* upon the [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/) event
|
|
11
11
|
* for actors initialised within the scope of a test scenario,
|
|
12
12
|
* or upon the [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/) event
|
|
@@ -6,7 +6,7 @@ import { Timestamp } from '../../screenplay/index.js';
|
|
|
6
6
|
import { AsyncOperationFailed } from '../AsyncOperationFailed.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Emitted when [releasing](https://serenity-js.org/api/core/
|
|
9
|
+
* Emitted when [releasing](https://serenity-js.org/api/core/class/Discardable/) an
|
|
10
10
|
* [`Actor`](https://serenity-js.org/api/core/class/Actor/) or its abilities
|
|
11
11
|
* resulted in an error either
|
|
12
12
|
* upon the [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/) event
|
|
@@ -10,7 +10,7 @@ import { DomainEvent } from '../DomainEvent.js';
|
|
|
10
10
|
* [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/) events
|
|
11
11
|
* to notify the [stage crew members](https://serenity-js.org/api/core/interface/StageCrewMember/)
|
|
12
12
|
* about the final state of the [actors](https://serenity-js.org/api/core/class/Actor/) and their abilities
|
|
13
|
-
* before they're [released](https://serenity-js.org/api/core/
|
|
13
|
+
* before they're [released](https://serenity-js.org/api/core/class/Discardable/).
|
|
14
14
|
*
|
|
15
15
|
* @group Events
|
|
16
16
|
*/
|
package/src/screenplay/Actor.ts
CHANGED
|
@@ -190,8 +190,8 @@ export class Actor implements PerformsActivities,
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
/**
|
|
193
|
-
* Instructs the actor to invoke [`Discardable.discard`](https://serenity-js.org/api/core/
|
|
194
|
-
* [discardable](https://serenity-js.org/api/core/
|
|
193
|
+
* Instructs the actor to invoke [`Discardable.discard`](https://serenity-js.org/api/core/class/Discardable/#discard) method on any
|
|
194
|
+
* [discardable](https://serenity-js.org/api/core/class/Discardable/) [ability](https://serenity-js.org/api/core/class/Ability/) it's been configured with.
|
|
195
195
|
*/
|
|
196
196
|
dismiss(): Promise<void> {
|
|
197
197
|
return this.findAbilitiesWhere(Discardable.isDiscardable)
|
|
@@ -43,8 +43,8 @@ import type { UsesAbilities } from './UsesAbilities.js';
|
|
|
43
43
|
* From the technical perspective, an **ability** is an [adapter](https://en.wikipedia.org/wiki/Adapter_pattern)
|
|
44
44
|
* around an interface-specific integration library, such as a web browser driver, an HTTP client, a database client, and so on.
|
|
45
45
|
* You give an actor an ability, and it's the ability's responsibility to provide a consistent API around the integration library and deal with any of its quirks.
|
|
46
|
-
* Abilities **encapsulate integration libraries** and handle their [configuration and initialisation](https://serenity-js.org/api/core/
|
|
47
|
-
* the process of [freeing up any resources](https://serenity-js.org/api/core/
|
|
46
|
+
* Abilities **encapsulate integration libraries** and handle their [configuration and initialisation](https://serenity-js.org/api/core/class/Initialisable/),
|
|
47
|
+
* the process of [freeing up any resources](https://serenity-js.org/api/core/class/Discardable/) they hold,
|
|
48
48
|
* as well as managing any state associated with the library.
|
|
49
49
|
*
|
|
50
50
|
* ### Portable interactions with web interfaces
|
|
@@ -269,8 +269,8 @@ import type { UsesAbilities } from './UsesAbilities.js';
|
|
|
269
269
|
*
|
|
270
270
|
* Abilities that rely on resources that need to be initialised before they can be used,
|
|
271
271
|
* or discarded before the actor is dismissed can implement
|
|
272
|
-
* the [`Initialisable`](https://serenity-js.org/api/core/
|
|
273
|
-
* or [`Discardable`](https://serenity-js.org/api/core/
|
|
272
|
+
* the [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
273
|
+
* or [`Discardable`](https://serenity-js.org/api/core/class/Discardable/) interfaces, respectively.
|
|
274
274
|
*
|
|
275
275
|
* ### Defining a custom ability to `QueryPostgresDB`
|
|
276
276
|
*
|
|
@@ -352,8 +352,8 @@ import type { UsesAbilities } from './UsesAbilities.js';
|
|
|
352
352
|
*
|
|
353
353
|
* ## Learn more
|
|
354
354
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
355
|
-
* - [`Initialisable`](https://serenity-js.org/api/core/
|
|
356
|
-
* - [`Discardable`](https://serenity-js.org/api/core/
|
|
355
|
+
* - [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
356
|
+
* - [`Discardable`](https://serenity-js.org/api/core/class/Discardable/)
|
|
357
357
|
* - [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
358
358
|
* - [`CallAnApi`](https://serenity-js.org/api/rest/class/CallAnApi/)
|
|
359
359
|
* - [`TakeNotes`](https://serenity-js.org/api/core/class/TakeNotes/)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* An interface to be implemented by any [`Ability`](https://serenity-js.org/api/core/class/Ability/) that needs to free up
|
|
3
3
|
* the resources it uses, e.g. disconnect from a database.
|
|
4
4
|
*
|
|
5
|
-
* This [`Discardable.discard`](https://serenity-js.org/api/core/
|
|
5
|
+
* This [`Discardable.discard`](https://serenity-js.org/api/core/class/Discardable/#discard) method is invoked directly by the [actor](https://serenity-js.org/api/core/class/Actor/), and indirectly by the [stage](https://serenity-js.org/api/core/class/Stage/):
|
|
6
6
|
* - when [SceneFinishes](https://serenity-js.org/api/core-events/class/SceneFinishes/), for actors instantiated after [SceneStarts](https://serenity-js.org/api/core-events/class/SceneStarts/) - e.g. within a test scenario or in a "before each" hook
|
|
7
7
|
* - when [`TestRunFinishes`](https://serenity-js.org/api/core-events/class/TestRunFinishes/), for actors instantiated before [SceneStarts](https://serenity-js.org/api/core-events/class/SceneStarts/) - e.g. in a "before all" hook
|
|
8
8
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* ## Learn more
|
|
14
14
|
* - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
|
|
15
15
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
16
|
-
* - [`Initialisable`](https://serenity-js.org/api/core/
|
|
16
|
+
* - [`Initialisable`](https://serenity-js.org/api/core/class/Initialisable/)
|
|
17
17
|
*
|
|
18
18
|
* @group Abilities
|
|
19
19
|
*/
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* An interface to be implemented by any [`Ability`](https://serenity-js.org/api/core/class/Ability/) that needs to initialise
|
|
3
3
|
* the resources it uses, e.g. establish a database connection.
|
|
4
4
|
*
|
|
5
|
-
* The [`Initialisable.initialise`](https://serenity-js.org/api/core/
|
|
6
|
-
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/
|
|
5
|
+
* The [`Initialisable.initialise`](https://serenity-js.org/api/core/class/Initialisable/#initialise) method is invoked whenever [`Actor.attemptsTo`](https://serenity-js.org/api/core/class/Actor/#attemptsTo) method is called,
|
|
6
|
+
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/class/Initialisable/#isInitialised) returns false. This is to avoid initialising abilities more than once.
|
|
7
7
|
*
|
|
8
8
|
* ## Learn more
|
|
9
9
|
* - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
|
|
10
10
|
* - [`AbilityType`](https://serenity-js.org/api/core/#AbilityType)
|
|
11
|
-
* - [`Discardable`](https://serenity-js.org/api/core/
|
|
11
|
+
* - [`Discardable`](https://serenity-js.org/api/core/class/Discardable/)
|
|
12
12
|
*
|
|
13
13
|
* @group Abilities
|
|
14
14
|
*/
|
|
@@ -23,9 +23,9 @@ export abstract class Initialisable {
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Initialises the ability. Invoked whenever [`Actor.attemptsTo`](https://serenity-js.org/api/core/class/Actor/#attemptsTo) method is called,
|
|
26
|
-
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/
|
|
26
|
+
* but **only when** [`Initialisable.isInitialised`](https://serenity-js.org/api/core/class/Initialisable/#isInitialised) returns false.
|
|
27
27
|
*
|
|
28
|
-
* Make sure to implement [`Initialisable.isInitialised`](https://serenity-js.org/api/core/
|
|
28
|
+
* Make sure to implement [`Initialisable.isInitialised`](https://serenity-js.org/api/core/class/Initialisable/#isInitialised) so that it returns `true`
|
|
29
29
|
* when the ability has been successfully initialised.
|
|
30
30
|
*/
|
|
31
31
|
abstract initialise(): Promise<void> | void;
|
|
@@ -34,7 +34,7 @@ export type StageFocus = 'foreground' | 'background';
|
|
|
34
34
|
* By default, actors created before the actual test scenario starts, e.g. in beforeAll hooks, are placed in the `'background'` focus area.
|
|
35
35
|
* When a [`SceneStarts`](https://serenity-js.org/api/core-events/class/SceneStarts/) event is announced,
|
|
36
36
|
* the focus switches to `'foreground'`. When a [`SceneFinishes`](https://serenity-js.org/api/core-events/class/SceneFinishes/)
|
|
37
|
-
* event is announced, foreground actors are dismissed, their abilities [discarded](https://serenity-js.org/api/core/
|
|
37
|
+
* event is announced, foreground actors are dismissed, their abilities [discarded](https://serenity-js.org/api/core/class/Discardable/)
|
|
38
38
|
* and focus returns to `'background'`.
|
|
39
39
|
*
|
|
40
40
|
* ## Custom lifecycle management
|