@serenity-js/playwright-test 3.15.0 → 3.16.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 +28 -0
- package/README.md +5 -2
- package/lib/reporter/SerenityReporterForPlaywrightTest.d.ts +5 -1
- package/lib/reporter/SerenityReporterForPlaywrightTest.d.ts.map +1 -1
- package/lib/reporter/SerenityReporterForPlaywrightTest.js +8 -2
- package/lib/reporter/SerenityReporterForPlaywrightTest.js.map +1 -1
- package/package.json +8 -8
- package/src/reporter/SerenityReporterForPlaywrightTest.ts +14 -19
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,34 @@
|
|
|
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.16.0](https://github.com/serenity-js/serenity-js/compare/v3.15.1...v3.16.0) (2024-02-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **deps:** update playwright dependencies to v1.41.1 ([a1a39ee](https://github.com/serenity-js/serenity-js/commit/a1a39ee2e30506849d4589a9588a5ac7dfb0adb8))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **playwright-test:** improved requirements reporting ([3b99112](https://github.com/serenity-js/serenity-js/commit/3b99112b2eb0add2440d88a6485ee23e7acac75e))
|
|
17
|
+
* **playwright-test:** support for nested requirements reporting ([37ef679](https://github.com/serenity-js/serenity-js/commit/37ef679bde723af856d94bc64781f189a59213ed))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [3.15.1](https://github.com/serenity-js/serenity-js/compare/v3.15.0...v3.15.1) (2024-01-19)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* **deps:** update playwright dependencies to v1.41.0 ([bb2dc99](https://github.com/serenity-js/serenity-js/commit/bb2dc99bf8c94536a0863c9c60d5461a9b3dfe19))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
6
34
|
# [3.15.0](https://github.com/serenity-js/serenity-js/compare/v3.14.2...v3.15.0) (2024-01-12)
|
|
7
35
|
|
|
8
36
|
**Note:** Version bump only for package @serenity-js/playwright-test
|
package/README.md
CHANGED
|
@@ -352,7 +352,8 @@ describe('EmailInput', () => {
|
|
|
352
352
|
To use Serenity/JS reporting capabilities, register the `@serenity-js/playwright-test` reporter in your
|
|
353
353
|
`playwright.config.ts` and define the appropriate reporting services (a.k.a. your "stage crew").
|
|
354
354
|
|
|
355
|
-
For example, to enable Serenity/JS Console Reporter
|
|
355
|
+
For example, to enable [Serenity/JS Console Reporter](https://serenity-js.org/handbook/reporting/console-reporter/)
|
|
356
|
+
and [Serenity BDD Reporter](https://serenity-js.org/handbook/reporting/serenity-bdd-reporter/), install the relevant modules:
|
|
356
357
|
|
|
357
358
|
```bash
|
|
358
359
|
npm install --save-dev @serenity-js/console-reporter @serenity-js/serenity-bdd
|
|
@@ -366,11 +367,13 @@ Next, configure your Playwright project as follows:
|
|
|
366
367
|
import type { PlaywrightTestConfig } from '@playwright/test'
|
|
367
368
|
|
|
368
369
|
const config: PlaywrightTestConfig = {
|
|
370
|
+
testDir: './spec',
|
|
371
|
+
|
|
369
372
|
reporter: [
|
|
370
373
|
[ '@serenity-js/playwright-test', {
|
|
371
374
|
crew: [
|
|
372
|
-
'@serenity-js/serenity-bdd',
|
|
373
375
|
'@serenity-js/console-reporter',
|
|
376
|
+
[ '@serenity-js/serenity-bdd', { specDirectory: './spec' } ],
|
|
374
377
|
[ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
|
|
375
378
|
// '@serenity-js/core:StreamReporter',
|
|
376
379
|
]
|
|
@@ -2,6 +2,7 @@ import type { FullConfig } from '@playwright/test';
|
|
|
2
2
|
import type { Reporter, Suite, TestCase, TestResult } from '@playwright/test/reporter';
|
|
3
3
|
import type { ClassDescription, Serenity, StageCrewMember, StageCrewMemberBuilder } from '@serenity-js/core';
|
|
4
4
|
import type { OutputStream } from '@serenity-js/core/lib/adapter';
|
|
5
|
+
import { RequirementsHierarchy } from '@serenity-js/core/lib/io';
|
|
5
6
|
/**
|
|
6
7
|
* Configuration object accepted by `@serenity-js/playwright-test` reporter.
|
|
7
8
|
*
|
|
@@ -35,6 +36,7 @@ export interface SerenityReporterForPlaywrightTestConfig {
|
|
|
35
36
|
*/
|
|
36
37
|
export declare class SerenityReporterForPlaywrightTest implements Reporter {
|
|
37
38
|
private readonly serenity;
|
|
39
|
+
private requirementsHierarchy;
|
|
38
40
|
private errorParser;
|
|
39
41
|
private sceneIds;
|
|
40
42
|
/**
|
|
@@ -42,8 +44,10 @@ export declare class SerenityReporterForPlaywrightTest implements Reporter {
|
|
|
42
44
|
* @param serenity
|
|
43
45
|
* Instance of {@apilink Serenity}, specific to the Node process running this Serenity reporter.
|
|
44
46
|
* Note that Playwright runs test workers and reporters in separate processes.
|
|
47
|
+
* @param requirementsHierarchy
|
|
48
|
+
* Root directory of the requirements hierarchy, used to determine capabilities and themes.
|
|
45
49
|
*/
|
|
46
|
-
constructor(config: SerenityReporterForPlaywrightTestConfig, serenity?: Serenity);
|
|
50
|
+
constructor(config: SerenityReporterForPlaywrightTestConfig, serenity?: Serenity, requirementsHierarchy?: RequirementsHierarchy);
|
|
47
51
|
onBegin(config: FullConfig, suite: Suite): void;
|
|
48
52
|
onTestBegin(test: TestCase): void;
|
|
49
53
|
onTestEnd(test: TestCase, result: TestResult): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SerenityReporterForPlaywrightTest.d.ts","sourceRoot":"","sources":["../../src/reporter/SerenityReporterForPlaywrightTest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBA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CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI;IA0CnD,OAAO,CAAC,wBAAwB;IAUhC,OAAO,CAAC,WAAW;IAwBnB,OAAO,CAAC,mBAAmB;IAqBrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB5B,OAAO,CAAC,IAAI;IAMZ,OAAO,CAAC,qBAAqB;IA8B7B,OAAO,CAAC,GAAG;IAIX,aAAa,IAAI,OAAO;CAG3B"}
|
|
@@ -37,6 +37,7 @@ const PlaywrightAttachments_1 = require("./PlaywrightAttachments");
|
|
|
37
37
|
*/
|
|
38
38
|
class SerenityReporterForPlaywrightTest {
|
|
39
39
|
serenity;
|
|
40
|
+
requirementsHierarchy;
|
|
40
41
|
errorParser = new PlaywrightErrorParser();
|
|
41
42
|
sceneIds = new Map();
|
|
42
43
|
/**
|
|
@@ -44,19 +45,24 @@ class SerenityReporterForPlaywrightTest {
|
|
|
44
45
|
* @param serenity
|
|
45
46
|
* Instance of {@apilink Serenity}, specific to the Node process running this Serenity reporter.
|
|
46
47
|
* Note that Playwright runs test workers and reporters in separate processes.
|
|
48
|
+
* @param requirementsHierarchy
|
|
49
|
+
* Root directory of the requirements hierarchy, used to determine capabilities and themes.
|
|
47
50
|
*/
|
|
48
|
-
constructor(config, serenity = core_1.serenity) {
|
|
51
|
+
constructor(config, serenity = core_1.serenity, requirementsHierarchy = new io_1.RequirementsHierarchy(new io_1.FileSystem(io_1.Path.from(process.cwd())))) {
|
|
49
52
|
this.serenity = serenity;
|
|
53
|
+
this.requirementsHierarchy = requirementsHierarchy;
|
|
50
54
|
this.serenity.configure(config);
|
|
51
55
|
}
|
|
52
56
|
onBegin(config, suite) {
|
|
57
|
+
this.requirementsHierarchy = new io_1.RequirementsHierarchy(new io_1.FileSystem(io_1.Path.from(config.rootDir)));
|
|
53
58
|
this.serenity.announce(new events_1.TestRunStarts(this.now()));
|
|
54
59
|
}
|
|
55
60
|
onTestBegin(test) {
|
|
56
61
|
const currentSceneId = this.serenity.assignNewSceneId();
|
|
57
62
|
this.sceneIds.set(test.id, currentSceneId);
|
|
58
63
|
const scenario = this.scenarioDetailsFrom(test);
|
|
59
|
-
this.emit(new events_1.SceneStarts(currentSceneId, scenario, this.serenity.currentTime()),
|
|
64
|
+
this.emit(new events_1.SceneStarts(currentSceneId, scenario, this.serenity.currentTime()), ...this.requirementsHierarchy.requirementTagsFor(scenario.location.path, scenario.category.value)
|
|
65
|
+
.map(tag => new events_1.SceneTagged(currentSceneId, tag, this.serenity.currentTime())), new events_1.TestRunnerDetected(currentSceneId, new model_1.Name('Playwright'), this.serenity.currentTime()));
|
|
60
66
|
}
|
|
61
67
|
// TODO might be nice to support that by emitting TestStepStarted / Finished
|
|
62
68
|
// onStepBegin(test: TestCase, _result: TestResult, step: TestStep): void {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SerenityReporterForPlaywrightTest.js","sourceRoot":"","sources":["../../src/reporter/SerenityReporterForPlaywrightTest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"SerenityReporterForPlaywrightTest.js","sourceRoot":"","sources":["../../src/reporter/SerenityReporterForPlaywrightTest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,4CAAqF;AAGrF,qEAAuD;AACvD,yDAUsC;AACtC,iDAAuG;AAEvG,uDAWqC;AAErC,mEAA4F;AA+B5F;;;;GAIG;AACH,MAAa,iCAAiC;IAerB;IACT;IAdJ,WAAW,GAAG,IAAI,qBAAqB,EAAE,CAAC;IAC1C,QAAQ,GAA+B,IAAI,GAAG,EAAE,CAAC;IAEzD;;;;;;;OAOG;IACH,YACI,MAA+C,EAC9B,WAAqB,eAAwB,EACtD,wBAA+C,IAAI,0BAAqB,CAAC,IAAI,eAAU,CAAC,SAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QADzG,aAAQ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;QAC7F,IAAI,KAAK,GAAG,SAAS,CAAC,KAAK,IAAI,qBAAqB,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAErF,iCAAiC;QACjC,qCAAqC;QAErC,MAAM,QAAQ,GAAG,UAAU,OAAO,EAAE,CAAC;QACrC,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;YAChD,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;SACxC;QAED,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QACjC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QAEpB,OAAO,KAAK,CAAC;IACjB,CAAC;IAEO,MAAM,CAAC,cAAc,CAAC,IAAY;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACxC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/playwright-test",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0",
|
|
4
4
|
"description": "Serenity/JS reporter and test APIs for Playwright Test",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"node": "^16.13 || ^18.12 || ^20"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@playwright/test": "1.
|
|
49
|
-
"@serenity-js/core": "3.
|
|
50
|
-
"@serenity-js/playwright": "3.
|
|
51
|
-
"@serenity-js/rest": "3.
|
|
52
|
-
"@serenity-js/web": "3.
|
|
48
|
+
"@playwright/test": "1.41.1",
|
|
49
|
+
"@serenity-js/core": "3.16.0",
|
|
50
|
+
"@serenity-js/playwright": "3.16.0",
|
|
51
|
+
"@serenity-js/rest": "3.16.0",
|
|
52
|
+
"@serenity-js/web": "3.16.0",
|
|
53
53
|
"deepmerge": "4.3.1",
|
|
54
54
|
"tiny-types": "1.21.0"
|
|
55
55
|
},
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"@integration/testing-tools": "3.0.0",
|
|
58
58
|
"@types/chai": "4.3.11",
|
|
59
59
|
"@types/mocha": "10.0.6",
|
|
60
|
-
"c8": "9.
|
|
60
|
+
"c8": "9.1.0",
|
|
61
61
|
"mocha": "10.2.0",
|
|
62
62
|
"mocha-multi": "1.1.7",
|
|
63
63
|
"ts-node": "10.9.2",
|
|
64
64
|
"typescript": "5.1.6"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "242771e55bd6becc5baeaac03edf945e4cdaf7a4"
|
|
67
67
|
}
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import type { FullConfig } from '@playwright/test';
|
|
2
2
|
import type { Reporter, Suite, TestCase, TestError, TestResult } from '@playwright/test/reporter';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
Serenity,
|
|
6
|
-
StageCrewMember,
|
|
7
|
-
StageCrewMemberBuilder,
|
|
8
|
-
Timestamp
|
|
9
|
-
} from '@serenity-js/core';
|
|
10
|
-
import {
|
|
11
|
-
LogicError,
|
|
12
|
-
serenity as reporterSerenityInstance
|
|
13
|
-
} from '@serenity-js/core';
|
|
3
|
+
import type { ClassDescription, Serenity, StageCrewMember, StageCrewMemberBuilder, Timestamp } from '@serenity-js/core';
|
|
4
|
+
import { LogicError, serenity as reporterSerenityInstance } from '@serenity-js/core';
|
|
14
5
|
import type { OutputStream } from '@serenity-js/core/lib/adapter';
|
|
15
|
-
import type {
|
|
16
|
-
DomainEvent} from '@serenity-js/core/lib/events';
|
|
6
|
+
import type { DomainEvent } from '@serenity-js/core/lib/events';
|
|
17
7
|
import * as events from '@serenity-js/core/lib/events';
|
|
18
8
|
import {
|
|
19
9
|
InteractionFinished,
|
|
@@ -26,10 +16,8 @@ import {
|
|
|
26
16
|
TestRunnerDetected,
|
|
27
17
|
TestRunStarts
|
|
28
18
|
} from '@serenity-js/core/lib/events';
|
|
29
|
-
import { FileSystemLocation, Path } from '@serenity-js/core/lib/io';
|
|
30
|
-
import type {
|
|
31
|
-
CorrelationId,
|
|
32
|
-
Outcome} from '@serenity-js/core/lib/model';
|
|
19
|
+
import { FileSystem, FileSystemLocation, Path, RequirementsHierarchy } from '@serenity-js/core/lib/io';
|
|
20
|
+
import type { CorrelationId, Outcome } from '@serenity-js/core/lib/model';
|
|
33
21
|
import {
|
|
34
22
|
ArbitraryTag,
|
|
35
23
|
Category,
|
|
@@ -39,7 +27,6 @@ import {
|
|
|
39
27
|
ExecutionRetriedTag,
|
|
40
28
|
ExecutionSkipped,
|
|
41
29
|
ExecutionSuccessful,
|
|
42
|
-
FeatureTag,
|
|
43
30
|
Name,
|
|
44
31
|
ScenarioDetails,
|
|
45
32
|
} from '@serenity-js/core/lib/model';
|
|
@@ -90,15 +77,20 @@ export class SerenityReporterForPlaywrightTest implements Reporter {
|
|
|
90
77
|
* @param serenity
|
|
91
78
|
* Instance of {@apilink Serenity}, specific to the Node process running this Serenity reporter.
|
|
92
79
|
* Note that Playwright runs test workers and reporters in separate processes.
|
|
80
|
+
* @param requirementsHierarchy
|
|
81
|
+
* Root directory of the requirements hierarchy, used to determine capabilities and themes.
|
|
93
82
|
*/
|
|
94
83
|
constructor(
|
|
95
84
|
config: SerenityReporterForPlaywrightTestConfig,
|
|
96
85
|
private readonly serenity: Serenity = reporterSerenityInstance,
|
|
86
|
+
private requirementsHierarchy: RequirementsHierarchy = new RequirementsHierarchy(new FileSystem(Path.from(process.cwd()))),
|
|
97
87
|
) {
|
|
98
88
|
this.serenity.configure(config);
|
|
99
89
|
}
|
|
100
90
|
|
|
101
91
|
onBegin(config: FullConfig, suite: Suite): void {
|
|
92
|
+
this.requirementsHierarchy = new RequirementsHierarchy(new FileSystem(Path.from(config.rootDir)));
|
|
93
|
+
|
|
102
94
|
this.serenity.announce(new TestRunStarts(this.now()));
|
|
103
95
|
}
|
|
104
96
|
|
|
@@ -112,7 +104,10 @@ export class SerenityReporterForPlaywrightTest implements Reporter {
|
|
|
112
104
|
|
|
113
105
|
this.emit(
|
|
114
106
|
new SceneStarts(currentSceneId, scenario, this.serenity.currentTime()),
|
|
115
|
-
|
|
107
|
+
|
|
108
|
+
...this.requirementsHierarchy.requirementTagsFor(scenario.location.path, scenario.category.value)
|
|
109
|
+
.map(tag => new SceneTagged(currentSceneId, tag, this.serenity.currentTime())),
|
|
110
|
+
|
|
116
111
|
new TestRunnerDetected(currentSceneId, new Name('Playwright'), this.serenity.currentTime()),
|
|
117
112
|
);
|
|
118
113
|
}
|