@serenity-js/core 3.7.1 → 3.8.0
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 +27 -0
- package/lib/events/ActivityRelatedArtifactArchived.d.ts +1 -1
- package/lib/events/ActivityRelatedArtifactArchived.d.ts.map +1 -1
- package/lib/events/ActivityRelatedArtifactArchived.js +4 -3
- package/lib/events/ActivityRelatedArtifactArchived.js.map +1 -1
- package/lib/events/ArtifactArchived.d.ts +2 -1
- package/lib/events/ArtifactArchived.d.ts.map +1 -1
- package/lib/events/ArtifactArchived.js +5 -2
- package/lib/events/ArtifactArchived.js.map +1 -1
- package/lib/stage/crew/artifact-archiver/ArtifactArchiver.d.ts +39 -19
- package/lib/stage/crew/artifact-archiver/ArtifactArchiver.d.ts.map +1 -1
- package/lib/stage/crew/artifact-archiver/ArtifactArchiver.js +41 -21
- package/lib/stage/crew/artifact-archiver/ArtifactArchiver.js.map +1 -1
- package/lib/stage/crew/stream-reporter/StreamReporter.d.ts +44 -16
- package/lib/stage/crew/stream-reporter/StreamReporter.d.ts.map +1 -1
- package/lib/stage/crew/stream-reporter/StreamReporter.js +48 -16
- package/lib/stage/crew/stream-reporter/StreamReporter.js.map +1 -1
- package/package.json +4 -4
- package/src/events/ActivityRelatedArtifactArchived.ts +4 -1
- package/src/events/ArtifactArchived.ts +4 -0
- package/src/stage/crew/artifact-archiver/ArtifactArchiver.ts +43 -19
- package/src/stage/crew/stream-reporter/StreamReporter.ts +51 -16
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
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.8.0](https://github.com/serenity-js/serenity-js/compare/v3.7.2...v3.8.0) (2023-08-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **serenity-bdd:** corrected screenshot sort order in screenshot detail viewer ([7537622](https://github.com/serenity-js/serenity-js/commit/7537622d41193e3cf358a1b939c7422bcc3b207f)), closes [#1790](https://github.com/serenity-js/serenity-js/issues/1790)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **core:** allow for easier debugging of Serenity/JS domain events using StreamReporter ([108677e](https://github.com/serenity-js/serenity-js/commit/108677e213423004127b6752301e73f66231030e)), closes [#1790](https://github.com/serenity-js/serenity-js/issues/1790)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [3.7.2](https://github.com/serenity-js/serenity-js/compare/v3.7.1...v3.7.2) (2023-07-26)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **deps:** update dependency fast-glob to ^3.3.1 ([0822973](https://github.com/serenity-js/serenity-js/commit/0822973cace7872cfa27e056c8c0276884ac8076))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## [3.7.1](https://github.com/serenity-js/serenity-js/compare/v3.7.0...v3.7.1) (2023-07-22)
|
|
7
34
|
|
|
8
35
|
**Note:** Version bump only for package @serenity-js/core
|
|
@@ -10,7 +10,7 @@ import { ArtifactArchived } from './ArtifactArchived';
|
|
|
10
10
|
export declare class ActivityRelatedArtifactArchived extends ArtifactArchived {
|
|
11
11
|
readonly activityId: CorrelationId;
|
|
12
12
|
static fromJSON(o: JSONObject): ActivityRelatedArtifactArchived;
|
|
13
|
-
constructor(sceneId: CorrelationId, activityId: CorrelationId, name: Name, type: ArtifactType, path: Path, timestamp?: Timestamp);
|
|
13
|
+
constructor(sceneId: CorrelationId, activityId: CorrelationId, name: Name, type: ArtifactType, path: Path, artifactTimestamp: Timestamp, timestamp?: Timestamp);
|
|
14
14
|
toJSON(): JSONObject;
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=ActivityRelatedArtifactArchived.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActivityRelatedArtifactArchived.d.ts","sourceRoot":"","sources":["../../src/events/ActivityRelatedArtifactArchived.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAY,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD;;GAEG;AACH,qBAAa,+BAAgC,SAAQ,gBAAgB;
|
|
1
|
+
{"version":3,"file":"ActivityRelatedArtifactArchived.d.ts","sourceRoot":"","sources":["../../src/events/ActivityRelatedArtifactArchived.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAY,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD;;GAEG;AACH,qBAAa,+BAAgC,SAAQ,gBAAgB;aAe7C,UAAU,EAAE,aAAa;IAd7C,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,UAAU,GAAG,+BAA+B;gBAa3D,OAAO,EAAE,aAAa,EACN,UAAU,EAAE,aAAa,EACzC,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,IAAI,EACV,iBAAiB,EAAE,SAAS,EAC5B,SAAS,CAAC,EAAE,SAAS;IAMzB,MAAM,IAAI,UAAU;CAWvB"}
|
|
@@ -14,10 +14,10 @@ const ArtifactArchived_1 = require("./ArtifactArchived");
|
|
|
14
14
|
*/
|
|
15
15
|
class ActivityRelatedArtifactArchived extends ArtifactArchived_1.ArtifactArchived {
|
|
16
16
|
static fromJSON(o) {
|
|
17
|
-
return new ActivityRelatedArtifactArchived(model_1.CorrelationId.fromJSON(o.sceneId), model_1.CorrelationId.fromJSON(o.activityId), model_1.Name.fromJSON(o.name), model_1.Artifact.ofType(o.type), io_1.Path.fromJSON(o.path), screenplay_1.Timestamp.fromJSON(o.timestamp));
|
|
17
|
+
return new ActivityRelatedArtifactArchived(model_1.CorrelationId.fromJSON(o.sceneId), model_1.CorrelationId.fromJSON(o.activityId), model_1.Name.fromJSON(o.name), model_1.Artifact.ofType(o.type), io_1.Path.fromJSON(o.path), screenplay_1.Timestamp.fromJSON(o.artifactTimestamp), screenplay_1.Timestamp.fromJSON(o.timestamp));
|
|
18
18
|
}
|
|
19
|
-
constructor(sceneId, activityId, name, type, path, timestamp) {
|
|
20
|
-
super(sceneId, name, type, path, timestamp);
|
|
19
|
+
constructor(sceneId, activityId, name, type, path, artifactTimestamp, timestamp) {
|
|
20
|
+
super(sceneId, name, type, path, artifactTimestamp, timestamp);
|
|
21
21
|
this.activityId = activityId;
|
|
22
22
|
(0, tiny_types_1.ensure)('activityId', activityId, (0, tiny_types_1.isDefined)());
|
|
23
23
|
}
|
|
@@ -28,6 +28,7 @@ class ActivityRelatedArtifactArchived extends ArtifactArchived_1.ArtifactArchive
|
|
|
28
28
|
name: this.name.toJSON(),
|
|
29
29
|
type: this.type.name,
|
|
30
30
|
path: this.path.toJSON(),
|
|
31
|
+
artifactTimestamp: this.artifactTimestamp.toJSON(),
|
|
31
32
|
timestamp: this.timestamp.toJSON(),
|
|
32
33
|
};
|
|
33
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActivityRelatedArtifactArchived.js","sourceRoot":"","sources":["../../src/events/ActivityRelatedArtifactArchived.ts"],"names":[],"mappings":";;;AACA,2CAA+C;AAE/C,8BAA6B;AAE7B,oCAAyD;AACzD,8CAA0C;AAC1C,yDAAsD;AAEtD,kDAAkD;AAClD,+BAA+B;AAC/B,4BAA4B;AAE5B;;GAEG;AACH,MAAa,+BAAgC,SAAQ,mCAAgB;IACjE,MAAM,CAAC,QAAQ,CAAC,CAAa;QACzB,OAAO,IAAI,+BAA+B,CACtC,qBAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAiB,CAAC,EAC3C,qBAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAoB,CAAC,EAC9C,YAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAc,CAAC,EAC/B,gBAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAc,CAAC,EACjC,SAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAc,CAAC,EAC/B,sBAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAmB,CAAC,CAC5C,CAAC;IACN,CAAC;IAED,YACI,OAAsB,EACN,UAAyB,EACzC,IAAU,EACV,IAAkB,EAClB,IAAU,EACV,SAAqB;QAErB,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"ActivityRelatedArtifactArchived.js","sourceRoot":"","sources":["../../src/events/ActivityRelatedArtifactArchived.ts"],"names":[],"mappings":";;;AACA,2CAA+C;AAE/C,8BAA6B;AAE7B,oCAAyD;AACzD,8CAA0C;AAC1C,yDAAsD;AAEtD,kDAAkD;AAClD,+BAA+B;AAC/B,4BAA4B;AAE5B;;GAEG;AACH,MAAa,+BAAgC,SAAQ,mCAAgB;IACjE,MAAM,CAAC,QAAQ,CAAC,CAAa;QACzB,OAAO,IAAI,+BAA+B,CACt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vent {
|
|
|
12
12
|
readonly name: Name;
|
|
13
13
|
readonly type: ArtifactType;
|
|
14
14
|
readonly path: Path;
|
|
15
|
+
readonly artifactTimestamp: Timestamp;
|
|
15
16
|
static fromJSON(o: JSONObject): ArtifactArchived;
|
|
16
|
-
constructor(sceneId: CorrelationId, name: Name, type: ArtifactType, path: Path, timestamp?: Timestamp);
|
|
17
|
+
constructor(sceneId: CorrelationId, name: Name, type: ArtifactType, path: Path, artifactTimestamp: Timestamp, timestamp?: Timestamp);
|
|
17
18
|
toJSON(): JSONObject;
|
|
18
19
|
}
|
|
19
20
|
//# sourceMappingURL=ArtifactArchived.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArtifactArchived.d.ts","sourceRoot":"","sources":["../../src/events/ArtifactArchived.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAY,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;
|
|
1
|
+
{"version":3,"file":"ArtifactArchived.d.ts","sourceRoot":"","sources":["../../src/events/ArtifactArchived.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAY,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;aAazB,OAAO,EAAE,aAAa;aACtB,IAAI,EAAE,IAAI;aACV,IAAI,EAAE,YAAY;aAClB,IAAI,EAAE,IAAI;aACV,iBAAiB,EAAE,SAAS;IAhBhD,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,UAAU,GAAG,gBAAgB;gBAY5B,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,IAAI,EACV,iBAAiB,EAAE,SAAS,EAC5C,SAAS,CAAC,EAAE,SAAS;IAWzB,MAAM,IAAI,UAAU;CASvB"}
|
|
@@ -11,24 +11,27 @@ const DomainEvent_1 = require("./DomainEvent");
|
|
|
11
11
|
*/
|
|
12
12
|
class ArtifactArchived extends DomainEvent_1.DomainEvent {
|
|
13
13
|
static fromJSON(o) {
|
|
14
|
-
return new ArtifactArchived(model_1.CorrelationId.fromJSON(o.sceneId), model_1.Name.fromJSON(o.name), model_1.Artifact.ofType(o.type), io_1.Path.fromJSON(o.path), screenplay_1.Timestamp.fromJSON(o.timestamp));
|
|
14
|
+
return new ArtifactArchived(model_1.CorrelationId.fromJSON(o.sceneId), model_1.Name.fromJSON(o.name), model_1.Artifact.ofType(o.type), io_1.Path.fromJSON(o.path), screenplay_1.Timestamp.fromJSON(o.artifactTimestamp), screenplay_1.Timestamp.fromJSON(o.timestamp));
|
|
15
15
|
}
|
|
16
|
-
constructor(sceneId, name, type, path, timestamp) {
|
|
16
|
+
constructor(sceneId, name, type, path, artifactTimestamp, timestamp) {
|
|
17
17
|
super(timestamp);
|
|
18
18
|
this.sceneId = sceneId;
|
|
19
19
|
this.name = name;
|
|
20
20
|
this.type = type;
|
|
21
21
|
this.path = path;
|
|
22
|
+
this.artifactTimestamp = artifactTimestamp;
|
|
22
23
|
(0, tiny_types_1.ensure)('sceneId', sceneId, (0, tiny_types_1.isDefined)());
|
|
23
24
|
(0, tiny_types_1.ensure)('name', name, (0, tiny_types_1.isDefined)());
|
|
24
25
|
(0, tiny_types_1.ensure)('type', type, (0, tiny_types_1.isDefined)());
|
|
25
26
|
(0, tiny_types_1.ensure)('path', path, (0, tiny_types_1.isDefined)());
|
|
27
|
+
(0, tiny_types_1.ensure)('artifactTimestamp', artifactTimestamp, (0, tiny_types_1.isDefined)());
|
|
26
28
|
}
|
|
27
29
|
toJSON() {
|
|
28
30
|
return {
|
|
29
31
|
name: this.name.toJSON(),
|
|
30
32
|
type: this.type.name,
|
|
31
33
|
path: this.path.toJSON(),
|
|
34
|
+
createdAt: this.artifactTimestamp.toJSON(),
|
|
32
35
|
timestamp: this.timestamp.toJSON(),
|
|
33
36
|
};
|
|
34
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArtifactArchived.js","sourceRoot":"","sources":["../../src/events/ArtifactArchived.ts"],"names":[],"mappings":";;;AACA,2CAA+C;AAE/C,8BAA6B;AAE7B,oCAAyD;AACzD,8CAA0C;AAC1C,+CAA4C;AAE5C;;GAEG;AACH,MAAa,gBAAiB,SAAQ,yBAAW;IAC7C,MAAM,CAAC,QAAQ,CAAC,CAAa;QACzB,OAAO,IAAI,gBAAgB,CACvB,qBAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAiB,CAAC,EAC3C,YAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAc,CAAC,EAC/B,gBAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAc,CAAC,EACjC,SAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAc,CAAC,EAC/B,sBAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAmB,CAAC,CAC5C,CAAC;IACN,CAAC;IAED,YACoB,OAAsB,EACtB,IAAU,EACV,IAAkB,EAClB,IAAU,
|
|
1
|
+
{"version":3,"file":"ArtifactArchived.js","sourceRoot":"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B,EAAE,iBAAiB,EAAE,IAAA,sBAAS,GAAE,CAAC,CAAC;IAChE,CAAC;IAED,MAAM;QACF,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACxB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;YACpB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACxB,SAAS,EAAE,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE;YAC1C,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;SACrC,CAAC;IACN,CAAC;CACJ;AAtCD,4CAsCC"}
|
|
@@ -3,7 +3,7 @@ import { FileSystem } from '../../../io';
|
|
|
3
3
|
import type { Stage } from '../../Stage';
|
|
4
4
|
import type { StageCrewMember } from '../../StageCrewMember';
|
|
5
5
|
/**
|
|
6
|
-
* Stores any {@apilink Artifact|artifacts} emitted via {@apilink ArtifactGenerated} events on the {@apilink FileSystem}
|
|
6
|
+
* Stores any {@apilink Artifact|artifacts} emitted via {@apilink ArtifactGenerated} events on the {@apilink FileSystem}.
|
|
7
7
|
*
|
|
8
8
|
* ## Registering `ArtifactArchiver` programmatically
|
|
9
9
|
*
|
|
@@ -18,49 +18,69 @@ import type { StageCrewMember } from '../../StageCrewMember';
|
|
|
18
18
|
* })
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
|
-
* ##
|
|
21
|
+
* ## Using `ArtifactArchiver` with Playwright Test
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* // playwright.config.ts
|
|
25
|
+
* import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
|
|
26
|
+
*
|
|
27
|
+
* const config: PlaywrightTestConfig = {
|
|
28
|
+
* testDir: './spec',
|
|
29
|
+
*
|
|
30
|
+
* reporter: [
|
|
31
|
+
* [ '@serenity-js/playwright-test', {
|
|
32
|
+
* crew: [
|
|
33
|
+
* '@serenity-js/serenity-bdd',
|
|
34
|
+
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
|
|
35
|
+
* [ '@serenity-js/core:StreamReporter', { outputFile: 'target/events.ndjson' }]
|
|
36
|
+
* ]
|
|
37
|
+
* // other Serenity/JS config
|
|
38
|
+
* }]
|
|
39
|
+
* ],
|
|
40
|
+
* // other Playwright Test config
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* ## Using `ArtifactArchiver` with Protractor
|
|
22
45
|
*
|
|
23
46
|
* ```js
|
|
24
47
|
* // protractor.conf.js
|
|
25
|
-
* const { ArtifactArchiver } = require('@serenity-js/core')
|
|
26
|
-
*
|
|
27
48
|
* exports.config = {
|
|
28
49
|
* framework: 'custom',
|
|
29
50
|
* frameworkPath: require.resolve('@serenity-js/protractor/adapter'),
|
|
30
51
|
*
|
|
31
52
|
* serenity: {
|
|
32
53
|
* crew: [
|
|
33
|
-
*
|
|
54
|
+
* '@serenity-js/serenity-bdd',
|
|
55
|
+
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
|
|
34
56
|
* ],
|
|
35
57
|
* // other Serenity/JS config
|
|
36
58
|
* },
|
|
37
59
|
* // other Protractor config
|
|
38
|
-
* }
|
|
60
|
+
* }
|
|
39
61
|
* ```
|
|
40
62
|
*
|
|
41
|
-
* ##
|
|
63
|
+
* ## Using `ArtifactArchiver` with WebdriverIO
|
|
42
64
|
*
|
|
43
65
|
* ```ts
|
|
44
|
-
* // wdio.conf.
|
|
45
|
-
* import { ArtifactArchiver } from '@serenity-js/core'
|
|
66
|
+
* // wdio.conf.ts
|
|
46
67
|
* import { WebdriverIOConfig } from '@serenity-js/webdriverio'
|
|
47
68
|
*
|
|
48
69
|
* export const config: WebdriverIOConfig = {
|
|
49
70
|
*
|
|
50
|
-
*
|
|
71
|
+
* framework: '@serenity-js/webdriverio',
|
|
51
72
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
73
|
+
* serenity: {
|
|
74
|
+
* crew: [
|
|
75
|
+
* '@serenity-js/serenity-bdd',
|
|
76
|
+
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
|
|
77
|
+
* ]
|
|
78
|
+
* // other Serenity/JS config
|
|
79
|
+
* },
|
|
80
|
+
* // other WebdriverIO config
|
|
59
81
|
* }
|
|
60
82
|
* ```
|
|
61
83
|
*
|
|
62
|
-
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
|
|
63
|
-
*
|
|
64
84
|
* @group Stage
|
|
65
85
|
*/
|
|
66
86
|
export declare class ArtifactArchiver implements StageCrewMember {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArtifactArchiver.d.ts","sourceRoot":"","sources":["../../../../src/stage/crew/artifact-archiver/ArtifactArchiver.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAUxC,OAAO,EAAE,UAAU,EAAQ,MAAM,aAAa,CAAC;AAG/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D
|
|
1
|
+
{"version":3,"file":"ArtifactArchiver.d.ts","sourceRoot":"","sources":["../../../../src/stage/crew/artifact-archiver/ArtifactArchiver.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAUxC,OAAO,EAAE,UAAU,EAAQ,MAAM,aAAa,CAAC;AAG/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AACH,qBAAa,gBAAiB,YAAW,eAAe;IAkChD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,KAAK,CAAC;IAjClB;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CAAC,GAAG,WAAW,EAAE,MAAM,EAAE,GAAG,eAAe;IAQpE;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,GAAG,eAAe;IAMrE;;;;OAIG;gBAEkB,UAAU,EAAE,UAAU,EAC/B,KAAK,CAAC,EAAE,KAAK;IAIzB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe;IAKzC;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IA8BlC,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,OAAO;IAwBf,OAAO,CAAC,yBAAyB;CAwBpC"}
|
|
@@ -7,7 +7,7 @@ const io_1 = require("../../../io");
|
|
|
7
7
|
const model_1 = require("../../../model");
|
|
8
8
|
const Hash_1 = require("./Hash");
|
|
9
9
|
/**
|
|
10
|
-
* Stores any {@apilink Artifact|artifacts} emitted via {@apilink ArtifactGenerated} events on the {@apilink FileSystem}
|
|
10
|
+
* Stores any {@apilink Artifact|artifacts} emitted via {@apilink ArtifactGenerated} events on the {@apilink FileSystem}.
|
|
11
11
|
*
|
|
12
12
|
* ## Registering `ArtifactArchiver` programmatically
|
|
13
13
|
*
|
|
@@ -22,49 +22,69 @@ const Hash_1 = require("./Hash");
|
|
|
22
22
|
* })
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
|
-
* ##
|
|
25
|
+
* ## Using `ArtifactArchiver` with Playwright Test
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* // playwright.config.ts
|
|
29
|
+
* import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
|
|
30
|
+
*
|
|
31
|
+
* const config: PlaywrightTestConfig = {
|
|
32
|
+
* testDir: './spec',
|
|
33
|
+
*
|
|
34
|
+
* reporter: [
|
|
35
|
+
* [ '@serenity-js/playwright-test', {
|
|
36
|
+
* crew: [
|
|
37
|
+
* '@serenity-js/serenity-bdd',
|
|
38
|
+
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
|
|
39
|
+
* [ '@serenity-js/core:StreamReporter', { outputFile: 'target/events.ndjson' }]
|
|
40
|
+
* ]
|
|
41
|
+
* // other Serenity/JS config
|
|
42
|
+
* }]
|
|
43
|
+
* ],
|
|
44
|
+
* // other Playwright Test config
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* ## Using `ArtifactArchiver` with Protractor
|
|
26
49
|
*
|
|
27
50
|
* ```js
|
|
28
51
|
* // protractor.conf.js
|
|
29
|
-
* const { ArtifactArchiver } = require('@serenity-js/core')
|
|
30
|
-
*
|
|
31
52
|
* exports.config = {
|
|
32
53
|
* framework: 'custom',
|
|
33
54
|
* frameworkPath: require.resolve('@serenity-js/protractor/adapter'),
|
|
34
55
|
*
|
|
35
56
|
* serenity: {
|
|
36
57
|
* crew: [
|
|
37
|
-
*
|
|
58
|
+
* '@serenity-js/serenity-bdd',
|
|
59
|
+
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
|
|
38
60
|
* ],
|
|
39
61
|
* // other Serenity/JS config
|
|
40
62
|
* },
|
|
41
63
|
* // other Protractor config
|
|
42
|
-
* }
|
|
64
|
+
* }
|
|
43
65
|
* ```
|
|
44
66
|
*
|
|
45
|
-
* ##
|
|
67
|
+
* ## Using `ArtifactArchiver` with WebdriverIO
|
|
46
68
|
*
|
|
47
69
|
* ```ts
|
|
48
|
-
* // wdio.conf.
|
|
49
|
-
* import { ArtifactArchiver } from '@serenity-js/core'
|
|
70
|
+
* // wdio.conf.ts
|
|
50
71
|
* import { WebdriverIOConfig } from '@serenity-js/webdriverio'
|
|
51
72
|
*
|
|
52
73
|
* export const config: WebdriverIOConfig = {
|
|
53
74
|
*
|
|
54
|
-
*
|
|
75
|
+
* framework: '@serenity-js/webdriverio',
|
|
55
76
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
77
|
+
* serenity: {
|
|
78
|
+
* crew: [
|
|
79
|
+
* '@serenity-js/serenity-bdd',
|
|
80
|
+
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
|
|
81
|
+
* ]
|
|
82
|
+
* // other Serenity/JS config
|
|
83
|
+
* },
|
|
84
|
+
* // other WebdriverIO config
|
|
63
85
|
* }
|
|
64
86
|
* ```
|
|
65
87
|
*
|
|
66
|
-
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
|
|
67
|
-
*
|
|
68
88
|
* @group Stage
|
|
69
89
|
*/
|
|
70
90
|
class ArtifactArchiver {
|
|
@@ -149,10 +169,10 @@ class ArtifactArchiver {
|
|
|
149
169
|
archivisationAnnouncement(event, relativePathToArtifact) {
|
|
150
170
|
return (absolutePath) => {
|
|
151
171
|
if (event instanceof events_1.ActivityRelatedArtifactGenerated) {
|
|
152
|
-
this.stage.announce(new events_1.ActivityRelatedArtifactArchived(event.sceneId, event.activityId, event.name, event.artifact.constructor, relativePathToArtifact));
|
|
172
|
+
this.stage.announce(new events_1.ActivityRelatedArtifactArchived(event.sceneId, event.activityId, event.name, event.artifact.constructor, relativePathToArtifact, event.timestamp, this.stage.currentTime()));
|
|
153
173
|
}
|
|
154
174
|
else if (event instanceof events_1.ArtifactGenerated) {
|
|
155
|
-
this.stage.announce(new events_1.ArtifactArchived(event.sceneId, event.name, event.artifact.constructor, relativePathToArtifact));
|
|
175
|
+
this.stage.announce(new events_1.ArtifactArchived(event.sceneId, event.name, event.artifact.constructor, relativePathToArtifact, event.timestamp, this.stage.currentTime()));
|
|
156
176
|
}
|
|
157
177
|
};
|
|
158
178
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArtifactArchiver.js","sourceRoot":"","sources":["../../../../src/stage/crew/artifact-archiver/ArtifactArchiver.ts"],"names":[],"mappings":";;;AACA,2CAAkF;AAIlF,4CAQyB;AACzB,oCAA+C;AAE/C,0CAAqF;AAGrF,iCAA8B;AAE9B
|
|
1
|
+
{"version":3,"file":"ArtifactArchiver.js","sourceRoot":"","sources":["../../../../src/stage/crew/artifact-archiver/ArtifactArchiver.ts"],"names":[],"mappings":";;;AACA,2CAAkF;AAIlF,4CAQyB;AACzB,oCAA+C;AAE/C,0CAAqF;AAGrF,iCAA8B;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AACH,MAAa,gBAAgB;IAEzB;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CAAC,GAAG,WAAqB;QAC9C,IAAA,mBAAM,EAAC,+BAA+B,EAAE,WAAW,EAAE,IAAA,qBAAQ,EAAC,QAAQ,EAAE,IAAA,0BAAa,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAE3F,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,SAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAEpH,OAAO,IAAI,gBAAgB,CAAC,IAAI,eAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAmC;QAC/C,MAAM,eAAe,GAAG,IAAA,mBAAM,EAAC,iBAAiB,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D,KAAK,CAAC,KAAK,CAAC,EAAE;YACX,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,6BAAoB,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QACvF,CAAC,CAAC,CAAC;IACX,CAAC;IAEO,yBAAyB,CAAC,KAA2D,EAAE,sBAA4B;QACvH,OAAO,CAAC,YAAkB,EAAE,EAAE;YAC1B,IAAI,KAAK,YAAY,yCAAgC,EAAE;gBACnD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,wCAA+B,CACnD,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,QAAQ,CAAC,WAA2B,EAC1C,sBAAsB,EACtB,KAAK,CAAC,SAAS,EACf,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAC3B,CAAC,CAAC;aACN;iBAAM,IAAI,KAAK,YAAY,0BAAiB,EAAE;gBAC3C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,yBAAgB,CACpC,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,QAAQ,CAAC,WAA2B,EAC1C,sBAAsB,EACtB,KAAK,CAAC,SAAS,EACf,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAC3B,CAAC,CAAC;aACN;QACL,CAAC,CAAC;IACN,CAAC;CACJ;AAhJD,4CAgJC;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,iBAAiB,EAAE;SAC1B,UAAU,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -5,7 +5,7 @@ import type { Stage } from '../../Stage';
|
|
|
5
5
|
import type { StageCrewMember } from '../../StageCrewMember';
|
|
6
6
|
/**
|
|
7
7
|
* Serialises all the {@apilink DomainEvent} objects it receives and streams
|
|
8
|
-
* them as [ndjson](http://ndjson.org/) to the output stream.
|
|
8
|
+
* them as [ndjson](http://ndjson.org/) to the output stream or file.
|
|
9
9
|
*
|
|
10
10
|
* Useful when debugging issues related to custom Serenity/JS test runner adapters.
|
|
11
11
|
*
|
|
@@ -34,43 +34,61 @@ import type { StageCrewMember } from '../../StageCrewMember';
|
|
|
34
34
|
* })
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
37
|
-
* ##
|
|
37
|
+
* ## Using `StreamReporter` with Playwright Test
|
|
38
|
+
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* // playwright.config.ts
|
|
41
|
+
* import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
|
|
42
|
+
*
|
|
43
|
+
* const config: PlaywrightTestConfig = {
|
|
44
|
+
* testDir: './spec',
|
|
45
|
+
*
|
|
46
|
+
* reporter: [
|
|
47
|
+
* [ '@serenity-js/playwright-test', {
|
|
48
|
+
* crew: [
|
|
49
|
+
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
|
|
50
|
+
* ]
|
|
51
|
+
* // other Serenity/JS config
|
|
52
|
+
* }]
|
|
53
|
+
* ],
|
|
54
|
+
* // other Playwright Test config
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* ## Using `StreamReporter` with Protractor
|
|
38
59
|
*
|
|
39
60
|
* ```js
|
|
40
61
|
* // protractor.conf.js
|
|
41
|
-
* const { StreamReporter } = require('@serenity-js/core');
|
|
42
|
-
*
|
|
43
62
|
* exports.config = {
|
|
44
63
|
* framework: 'custom',
|
|
45
64
|
* frameworkPath: require.resolve('@serenity-js/protractor/adapter'),
|
|
46
65
|
*
|
|
47
66
|
* serenity: {
|
|
48
67
|
* crew: [
|
|
49
|
-
*
|
|
68
|
+
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
|
|
50
69
|
* ],
|
|
51
70
|
* // other Serenity/JS config
|
|
52
71
|
* },
|
|
53
72
|
* // other Protractor config
|
|
54
|
-
* }
|
|
73
|
+
* }
|
|
55
74
|
* ```
|
|
56
75
|
*
|
|
57
|
-
* ##
|
|
76
|
+
* ## Using `StreamReporter` with WebdriverIO
|
|
58
77
|
*
|
|
59
78
|
* ```ts
|
|
60
|
-
* // wdio.conf.
|
|
61
|
-
* import { StreamReporter } from '@serenity-js/core'
|
|
79
|
+
* // wdio.conf.ts
|
|
62
80
|
* import { WebdriverIOConfig } from '@serenity-js/webdriverio'
|
|
63
81
|
*
|
|
64
82
|
* export const config: WebdriverIOConfig = {
|
|
65
83
|
*
|
|
66
|
-
*
|
|
84
|
+
* framework: '@serenity-js/webdriverio',
|
|
67
85
|
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
86
|
+
* serenity: {
|
|
87
|
+
* crew: [
|
|
88
|
+
* '@serenity-js/serenity-bdd',
|
|
89
|
+
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
|
|
90
|
+
* ]
|
|
91
|
+
* // other Serenity/JS config
|
|
74
92
|
* },
|
|
75
93
|
* // other WebdriverIO config
|
|
76
94
|
* }
|
|
@@ -81,6 +99,16 @@ import type { StageCrewMember } from '../../StageCrewMember';
|
|
|
81
99
|
export declare class StreamReporter implements StageCrewMember {
|
|
82
100
|
private readonly output;
|
|
83
101
|
private readonly stage?;
|
|
102
|
+
/**
|
|
103
|
+
* Instantiates a `StreamReporter` outputting a stream of {@apilink DomainEvent|domain events}
|
|
104
|
+
* to an `outputFile` at the given location.
|
|
105
|
+
*
|
|
106
|
+
* @param config
|
|
107
|
+
*/
|
|
108
|
+
static fromJSON(config: {
|
|
109
|
+
outputFile: string;
|
|
110
|
+
cwd?: string;
|
|
111
|
+
}): StageCrewMember;
|
|
84
112
|
/**
|
|
85
113
|
* @param {stream~Writable} output
|
|
86
114
|
* A Writable stream that should receive the output
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamReporter.d.ts","sourceRoot":"","sources":["../../../../src/stage/crew/stream-reporter/StreamReporter.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"StreamReporter.d.ts","sourceRoot":"","sources":["../../../../src/stage/crew/stream-reporter/StreamReporter.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AACH,qBAAa,cAAe,YAAW,eAAe;IAyB9C,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IAxB3B;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,eAAe;IAS9E;;;;;;OAMG;gBAEkB,MAAM,GAAE,QAAyB,EACjC,KAAK,CAAC,EAAE,KAAK;IAIlC;;;;;;;;OAQG;IACH,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe;IAIzC;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;CAKrC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StreamReporter = void 0;
|
|
4
|
+
const tiny_types_1 = require("tiny-types");
|
|
5
|
+
const io_1 = require("../../../io");
|
|
4
6
|
/**
|
|
5
7
|
* Serialises all the {@apilink DomainEvent} objects it receives and streams
|
|
6
|
-
* them as [ndjson](http://ndjson.org/) to the output stream.
|
|
8
|
+
* them as [ndjson](http://ndjson.org/) to the output stream or file.
|
|
7
9
|
*
|
|
8
10
|
* Useful when debugging issues related to custom Serenity/JS test runner adapters.
|
|
9
11
|
*
|
|
@@ -32,43 +34,61 @@ exports.StreamReporter = void 0;
|
|
|
32
34
|
* })
|
|
33
35
|
* ```
|
|
34
36
|
*
|
|
35
|
-
* ##
|
|
37
|
+
* ## Using `StreamReporter` with Playwright Test
|
|
38
|
+
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* // playwright.config.ts
|
|
41
|
+
* import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
|
|
42
|
+
*
|
|
43
|
+
* const config: PlaywrightTestConfig = {
|
|
44
|
+
* testDir: './spec',
|
|
45
|
+
*
|
|
46
|
+
* reporter: [
|
|
47
|
+
* [ '@serenity-js/playwright-test', {
|
|
48
|
+
* crew: [
|
|
49
|
+
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
|
|
50
|
+
* ]
|
|
51
|
+
* // other Serenity/JS config
|
|
52
|
+
* }]
|
|
53
|
+
* ],
|
|
54
|
+
* // other Playwright Test config
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* ## Using `StreamReporter` with Protractor
|
|
36
59
|
*
|
|
37
60
|
* ```js
|
|
38
61
|
* // protractor.conf.js
|
|
39
|
-
* const { StreamReporter } = require('@serenity-js/core');
|
|
40
|
-
*
|
|
41
62
|
* exports.config = {
|
|
42
63
|
* framework: 'custom',
|
|
43
64
|
* frameworkPath: require.resolve('@serenity-js/protractor/adapter'),
|
|
44
65
|
*
|
|
45
66
|
* serenity: {
|
|
46
67
|
* crew: [
|
|
47
|
-
*
|
|
68
|
+
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
|
|
48
69
|
* ],
|
|
49
70
|
* // other Serenity/JS config
|
|
50
71
|
* },
|
|
51
72
|
* // other Protractor config
|
|
52
|
-
* }
|
|
73
|
+
* }
|
|
53
74
|
* ```
|
|
54
75
|
*
|
|
55
|
-
* ##
|
|
76
|
+
* ## Using `StreamReporter` with WebdriverIO
|
|
56
77
|
*
|
|
57
78
|
* ```ts
|
|
58
|
-
* // wdio.conf.
|
|
59
|
-
* import { StreamReporter } from '@serenity-js/core'
|
|
79
|
+
* // wdio.conf.ts
|
|
60
80
|
* import { WebdriverIOConfig } from '@serenity-js/webdriverio'
|
|
61
81
|
*
|
|
62
82
|
* export const config: WebdriverIOConfig = {
|
|
63
83
|
*
|
|
64
|
-
*
|
|
84
|
+
* framework: '@serenity-js/webdriverio',
|
|
65
85
|
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
86
|
+
* serenity: {
|
|
87
|
+
* crew: [
|
|
88
|
+
* '@serenity-js/serenity-bdd',
|
|
89
|
+
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
|
|
90
|
+
* ]
|
|
91
|
+
* // other Serenity/JS config
|
|
72
92
|
* },
|
|
73
93
|
* // other WebdriverIO config
|
|
74
94
|
* }
|
|
@@ -77,6 +97,18 @@ exports.StreamReporter = void 0;
|
|
|
77
97
|
* @group Stage
|
|
78
98
|
*/
|
|
79
99
|
class StreamReporter {
|
|
100
|
+
/**
|
|
101
|
+
* Instantiates a `StreamReporter` outputting a stream of {@apilink DomainEvent|domain events}
|
|
102
|
+
* to an `outputFile` at the given location.
|
|
103
|
+
*
|
|
104
|
+
* @param config
|
|
105
|
+
*/
|
|
106
|
+
static fromJSON(config) {
|
|
107
|
+
const outputFile = (0, tiny_types_1.ensure)('outputFile', config?.outputFile, (0, tiny_types_1.isDefined)(), (0, tiny_types_1.isString)());
|
|
108
|
+
const cwd = config.cwd || process.cwd();
|
|
109
|
+
const fs = new io_1.FileSystem(io_1.Path.from(cwd));
|
|
110
|
+
return new StreamReporter(fs.createWriteStreamTo(io_1.Path.from(outputFile)));
|
|
111
|
+
}
|
|
80
112
|
/**
|
|
81
113
|
* @param {stream~Writable} output
|
|
82
114
|
* A Writable stream that should receive the output
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamReporter.js","sourceRoot":"","sources":["../../../../src/stage/crew/stream-reporter/StreamReporter.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"StreamReporter.js","sourceRoot":"","sources":["../../../../src/stage/crew/stream-reporter/StreamReporter.ts"],"names":[],"mappings":";;;AACA,2CAAyD;AAGzD,oCAA+C;AAI/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AACH,MAAa,cAAc;IAEvB;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,MAA4C;QACxD,MAAM,UAAU,GAAG,IAAA,mBAAM,EAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,IAAA,sBAAS,GAAE,EAAE,IAAA,qBAAQ,GAAE,CAAC,CAAC;QACrF,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAExC,MAAM,EAAE,GAAG,IAAI,eAAU,CAAC,SAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QAEzC,OAAO,IAAI,cAAc,CAAC,EAAE,CAAC,mBAAmB,CAAC,SAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;OAMG;IACH,YACqB,SAAmB,OAAO,CAAC,MAAM,EACjC,KAAa;QADb,WAAM,GAAN,MAAM,CAA2B;QACjC,UAAK,GAAL,KAAK,CAAQ;IAElC,CAAC;IAED;;;;;;;;OAQG;IACH,UAAU,CAAC,KAAY;QACnB,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,KAAkB;QACvB,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,IAAI,CACjF,CAAC;IACN,CAAC;CACJ;AAvDD,wCAuDC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Serenity/JS Screenplay, reporting engine and core interfaces.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"chalk": "^4.1.2",
|
|
37
37
|
"diff": "^5.1.0",
|
|
38
38
|
"error-stack-parser": "2.1.4",
|
|
39
|
-
"fast-glob": "^3.3.
|
|
39
|
+
"fast-glob": "^3.3.1",
|
|
40
40
|
"filenamify": "^4.3.0",
|
|
41
41
|
"graceful-fs": "^4.2.11",
|
|
42
42
|
"moment": "^2.29.4",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@types/semver": "^7.5.0",
|
|
54
54
|
"@types/validate-npm-package-name": "^4.0.0",
|
|
55
55
|
"assertion-error-formatter": "^3.0.0",
|
|
56
|
-
"c8": "8.0.
|
|
56
|
+
"c8": "8.0.1",
|
|
57
57
|
"memfs": "^4.2.0",
|
|
58
58
|
"mocha": "^10.2.0",
|
|
59
59
|
"mocha-multi": "^1.1.7",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": "^16.13 || ^18.12 || ^20"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "5a054cb7304cf0133c3370768fe03db67c197e59"
|
|
75
75
|
}
|
|
@@ -22,6 +22,7 @@ export class ActivityRelatedArtifactArchived extends ArtifactArchived {
|
|
|
22
22
|
Name.fromJSON(o.name as string),
|
|
23
23
|
Artifact.ofType(o.type as string),
|
|
24
24
|
Path.fromJSON(o.path as string),
|
|
25
|
+
Timestamp.fromJSON(o.artifactTimestamp as string),
|
|
25
26
|
Timestamp.fromJSON(o.timestamp as string),
|
|
26
27
|
);
|
|
27
28
|
}
|
|
@@ -32,9 +33,10 @@ export class ActivityRelatedArtifactArchived extends ArtifactArchived {
|
|
|
32
33
|
name: Name,
|
|
33
34
|
type: ArtifactType,
|
|
34
35
|
path: Path,
|
|
36
|
+
artifactTimestamp: Timestamp,
|
|
35
37
|
timestamp?: Timestamp,
|
|
36
38
|
) {
|
|
37
|
-
super(sceneId, name, type, path, timestamp);
|
|
39
|
+
super(sceneId, name, type, path, artifactTimestamp, timestamp);
|
|
38
40
|
ensure('activityId', activityId, isDefined());
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -45,6 +47,7 @@ export class ActivityRelatedArtifactArchived extends ArtifactArchived {
|
|
|
45
47
|
name: this.name.toJSON(),
|
|
46
48
|
type: this.type.name,
|
|
47
49
|
path: this.path.toJSON(),
|
|
50
|
+
artifactTimestamp: this.artifactTimestamp.toJSON(),
|
|
48
51
|
timestamp: this.timestamp.toJSON(),
|
|
49
52
|
};
|
|
50
53
|
}
|
|
@@ -17,6 +17,7 @@ export class ArtifactArchived extends DomainEvent {
|
|
|
17
17
|
Name.fromJSON(o.name as string),
|
|
18
18
|
Artifact.ofType(o.type as string),
|
|
19
19
|
Path.fromJSON(o.path as string),
|
|
20
|
+
Timestamp.fromJSON(o.artifactTimestamp as string),
|
|
20
21
|
Timestamp.fromJSON(o.timestamp as string),
|
|
21
22
|
);
|
|
22
23
|
}
|
|
@@ -26,6 +27,7 @@ export class ArtifactArchived extends DomainEvent {
|
|
|
26
27
|
public readonly name: Name,
|
|
27
28
|
public readonly type: ArtifactType,
|
|
28
29
|
public readonly path: Path,
|
|
30
|
+
public readonly artifactTimestamp: Timestamp,
|
|
29
31
|
timestamp?: Timestamp,
|
|
30
32
|
) {
|
|
31
33
|
super(timestamp);
|
|
@@ -34,6 +36,7 @@ export class ArtifactArchived extends DomainEvent {
|
|
|
34
36
|
ensure('name', name, isDefined());
|
|
35
37
|
ensure('type', type, isDefined());
|
|
36
38
|
ensure('path', path, isDefined());
|
|
39
|
+
ensure('artifactTimestamp', artifactTimestamp, isDefined());
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
toJSON(): JSONObject {
|
|
@@ -41,6 +44,7 @@ export class ArtifactArchived extends DomainEvent {
|
|
|
41
44
|
name: this.name.toJSON(),
|
|
42
45
|
type: this.type.name,
|
|
43
46
|
path: this.path.toJSON(),
|
|
47
|
+
createdAt: this.artifactTimestamp.toJSON(),
|
|
44
48
|
timestamp: this.timestamp.toJSON(),
|
|
45
49
|
};
|
|
46
50
|
}
|
|
@@ -20,7 +20,7 @@ import type { StageCrewMember } from '../../StageCrewMember';
|
|
|
20
20
|
import { Hash } from './Hash';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* Stores any {@apilink Artifact|artifacts} emitted via {@apilink ArtifactGenerated} events on the {@apilink FileSystem}
|
|
23
|
+
* Stores any {@apilink Artifact|artifacts} emitted via {@apilink ArtifactGenerated} events on the {@apilink FileSystem}.
|
|
24
24
|
*
|
|
25
25
|
* ## Registering `ArtifactArchiver` programmatically
|
|
26
26
|
*
|
|
@@ -35,49 +35,69 @@ import { Hash } from './Hash';
|
|
|
35
35
|
* })
|
|
36
36
|
* ```
|
|
37
37
|
*
|
|
38
|
-
* ##
|
|
38
|
+
* ## Using `ArtifactArchiver` with Playwright Test
|
|
39
|
+
*
|
|
40
|
+
* ```ts
|
|
41
|
+
* // playwright.config.ts
|
|
42
|
+
* import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
|
|
43
|
+
*
|
|
44
|
+
* const config: PlaywrightTestConfig = {
|
|
45
|
+
* testDir: './spec',
|
|
46
|
+
*
|
|
47
|
+
* reporter: [
|
|
48
|
+
* [ '@serenity-js/playwright-test', {
|
|
49
|
+
* crew: [
|
|
50
|
+
* '@serenity-js/serenity-bdd',
|
|
51
|
+
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
|
|
52
|
+
* [ '@serenity-js/core:StreamReporter', { outputFile: 'target/events.ndjson' }]
|
|
53
|
+
* ]
|
|
54
|
+
* // other Serenity/JS config
|
|
55
|
+
* }]
|
|
56
|
+
* ],
|
|
57
|
+
* // other Playwright Test config
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* ## Using `ArtifactArchiver` with Protractor
|
|
39
62
|
*
|
|
40
63
|
* ```js
|
|
41
64
|
* // protractor.conf.js
|
|
42
|
-
* const { ArtifactArchiver } = require('@serenity-js/core')
|
|
43
|
-
*
|
|
44
65
|
* exports.config = {
|
|
45
66
|
* framework: 'custom',
|
|
46
67
|
* frameworkPath: require.resolve('@serenity-js/protractor/adapter'),
|
|
47
68
|
*
|
|
48
69
|
* serenity: {
|
|
49
70
|
* crew: [
|
|
50
|
-
*
|
|
71
|
+
* '@serenity-js/serenity-bdd',
|
|
72
|
+
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
|
|
51
73
|
* ],
|
|
52
74
|
* // other Serenity/JS config
|
|
53
75
|
* },
|
|
54
76
|
* // other Protractor config
|
|
55
|
-
* }
|
|
77
|
+
* }
|
|
56
78
|
* ```
|
|
57
79
|
*
|
|
58
|
-
* ##
|
|
80
|
+
* ## Using `ArtifactArchiver` with WebdriverIO
|
|
59
81
|
*
|
|
60
82
|
* ```ts
|
|
61
|
-
* // wdio.conf.
|
|
62
|
-
* import { ArtifactArchiver } from '@serenity-js/core'
|
|
83
|
+
* // wdio.conf.ts
|
|
63
84
|
* import { WebdriverIOConfig } from '@serenity-js/webdriverio'
|
|
64
85
|
*
|
|
65
86
|
* export const config: WebdriverIOConfig = {
|
|
66
87
|
*
|
|
67
|
-
*
|
|
88
|
+
* framework: '@serenity-js/webdriverio',
|
|
68
89
|
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
90
|
+
* serenity: {
|
|
91
|
+
* crew: [
|
|
92
|
+
* '@serenity-js/serenity-bdd',
|
|
93
|
+
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
|
|
94
|
+
* ]
|
|
95
|
+
* // other Serenity/JS config
|
|
96
|
+
* },
|
|
97
|
+
* // other WebdriverIO config
|
|
76
98
|
* }
|
|
77
99
|
* ```
|
|
78
100
|
*
|
|
79
|
-
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
|
|
80
|
-
*
|
|
81
101
|
* @group Stage
|
|
82
102
|
*/
|
|
83
103
|
export class ArtifactArchiver implements StageCrewMember {
|
|
@@ -209,6 +229,8 @@ export class ArtifactArchiver implements StageCrewMember {
|
|
|
209
229
|
event.name,
|
|
210
230
|
event.artifact.constructor as ArtifactType,
|
|
211
231
|
relativePathToArtifact,
|
|
232
|
+
event.timestamp,
|
|
233
|
+
this.stage.currentTime(),
|
|
212
234
|
));
|
|
213
235
|
} else if (event instanceof ArtifactGenerated) {
|
|
214
236
|
this.stage.announce(new ArtifactArchived(
|
|
@@ -216,6 +238,8 @@ export class ArtifactArchiver implements StageCrewMember {
|
|
|
216
238
|
event.name,
|
|
217
239
|
event.artifact.constructor as ArtifactType,
|
|
218
240
|
relativePathToArtifact,
|
|
241
|
+
event.timestamp,
|
|
242
|
+
this.stage.currentTime(),
|
|
219
243
|
));
|
|
220
244
|
}
|
|
221
245
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { Writable } from 'stream';
|
|
2
|
+
import { ensure, isDefined, isString } from 'tiny-types';
|
|
2
3
|
|
|
3
4
|
import type { DomainEvent } from '../../../events';
|
|
5
|
+
import { FileSystem, Path } from '../../../io';
|
|
4
6
|
import type { Stage } from '../../Stage';
|
|
5
7
|
import type { StageCrewMember } from '../../StageCrewMember';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Serialises all the {@apilink DomainEvent} objects it receives and streams
|
|
9
|
-
* them as [ndjson](http://ndjson.org/) to the output stream.
|
|
11
|
+
* them as [ndjson](http://ndjson.org/) to the output stream or file.
|
|
10
12
|
*
|
|
11
13
|
* Useful when debugging issues related to custom Serenity/JS test runner adapters.
|
|
12
14
|
*
|
|
@@ -35,43 +37,61 @@ import type { StageCrewMember } from '../../StageCrewMember';
|
|
|
35
37
|
* })
|
|
36
38
|
* ```
|
|
37
39
|
*
|
|
38
|
-
* ##
|
|
40
|
+
* ## Using `StreamReporter` with Playwright Test
|
|
41
|
+
*
|
|
42
|
+
* ```ts
|
|
43
|
+
* // playwright.config.ts
|
|
44
|
+
* import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
|
|
45
|
+
*
|
|
46
|
+
* const config: PlaywrightTestConfig = {
|
|
47
|
+
* testDir: './spec',
|
|
48
|
+
*
|
|
49
|
+
* reporter: [
|
|
50
|
+
* [ '@serenity-js/playwright-test', {
|
|
51
|
+
* crew: [
|
|
52
|
+
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
|
|
53
|
+
* ]
|
|
54
|
+
* // other Serenity/JS config
|
|
55
|
+
* }]
|
|
56
|
+
* ],
|
|
57
|
+
* // other Playwright Test config
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* ## Using `StreamReporter` with Protractor
|
|
39
62
|
*
|
|
40
63
|
* ```js
|
|
41
64
|
* // protractor.conf.js
|
|
42
|
-
* const { StreamReporter } = require('@serenity-js/core');
|
|
43
|
-
*
|
|
44
65
|
* exports.config = {
|
|
45
66
|
* framework: 'custom',
|
|
46
67
|
* frameworkPath: require.resolve('@serenity-js/protractor/adapter'),
|
|
47
68
|
*
|
|
48
69
|
* serenity: {
|
|
49
70
|
* crew: [
|
|
50
|
-
*
|
|
71
|
+
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
|
|
51
72
|
* ],
|
|
52
73
|
* // other Serenity/JS config
|
|
53
74
|
* },
|
|
54
75
|
* // other Protractor config
|
|
55
|
-
* }
|
|
76
|
+
* }
|
|
56
77
|
* ```
|
|
57
78
|
*
|
|
58
|
-
* ##
|
|
79
|
+
* ## Using `StreamReporter` with WebdriverIO
|
|
59
80
|
*
|
|
60
81
|
* ```ts
|
|
61
|
-
* // wdio.conf.
|
|
62
|
-
* import { StreamReporter } from '@serenity-js/core'
|
|
82
|
+
* // wdio.conf.ts
|
|
63
83
|
* import { WebdriverIOConfig } from '@serenity-js/webdriverio'
|
|
64
84
|
*
|
|
65
85
|
* export const config: WebdriverIOConfig = {
|
|
66
86
|
*
|
|
67
|
-
*
|
|
87
|
+
* framework: '@serenity-js/webdriverio',
|
|
68
88
|
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
89
|
+
* serenity: {
|
|
90
|
+
* crew: [
|
|
91
|
+
* '@serenity-js/serenity-bdd',
|
|
92
|
+
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
|
|
93
|
+
* ]
|
|
94
|
+
* // other Serenity/JS config
|
|
75
95
|
* },
|
|
76
96
|
* // other WebdriverIO config
|
|
77
97
|
* }
|
|
@@ -81,6 +101,21 @@ import type { StageCrewMember } from '../../StageCrewMember';
|
|
|
81
101
|
*/
|
|
82
102
|
export class StreamReporter implements StageCrewMember {
|
|
83
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Instantiates a `StreamReporter` outputting a stream of {@apilink DomainEvent|domain events}
|
|
106
|
+
* to an `outputFile` at the given location.
|
|
107
|
+
*
|
|
108
|
+
* @param config
|
|
109
|
+
*/
|
|
110
|
+
static fromJSON(config: { outputFile: string, cwd?: string }): StageCrewMember {
|
|
111
|
+
const outputFile = ensure('outputFile', config?.outputFile, isDefined(), isString());
|
|
112
|
+
const cwd = config.cwd || process.cwd();
|
|
113
|
+
|
|
114
|
+
const fs = new FileSystem(Path.from(cwd))
|
|
115
|
+
|
|
116
|
+
return new StreamReporter(fs.createWriteStreamTo(Path.from(outputFile)));
|
|
117
|
+
}
|
|
118
|
+
|
|
84
119
|
/**
|
|
85
120
|
* @param {stream~Writable} output
|
|
86
121
|
* A Writable stream that should receive the output
|