@serenity-js/playwright-test 3.0.0-rc.38 → 3.0.0-rc.40
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 +32 -0
- package/lib/api/PlaywrightTestConfig.d.ts +41 -0
- package/lib/api/PlaywrightTestConfig.d.ts.map +1 -0
- package/lib/{PlaywrightTestConfig.js → api/PlaywrightTestConfig.js} +0 -0
- package/lib/api/PlaywrightTestConfig.js.map +1 -0
- package/lib/api/SerenityFixtures.d.ts +128 -0
- package/lib/api/SerenityFixtures.d.ts.map +1 -0
- package/lib/api/SerenityFixtures.js +3 -0
- package/lib/api/SerenityFixtures.js.map +1 -0
- package/lib/api/SerenityOptions.d.ts +256 -0
- package/lib/api/SerenityOptions.d.ts.map +1 -0
- package/lib/api/SerenityOptions.js +3 -0
- package/lib/api/SerenityOptions.js.map +1 -0
- package/lib/api/SerenityTestType.d.ts +5 -0
- package/lib/api/SerenityTestType.d.ts.map +1 -0
- package/lib/api/SerenityTestType.js +4 -0
- package/lib/api/SerenityTestType.js.map +1 -0
- package/lib/api/index.d.ts +6 -0
- package/lib/api/index.d.ts.map +1 -0
- package/lib/api/index.js +22 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/test-api.d.ts +115 -0
- package/lib/api/test-api.d.ts.map +1 -0
- package/lib/{api.js → api/test-api.js} +43 -16
- package/lib/api/test-api.js.map +1 -0
- package/lib/index.d.ts +1 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/reporter/PlaywrightStepReporter.d.ts +3 -0
- package/lib/reporter/PlaywrightStepReporter.d.ts.map +1 -1
- package/lib/reporter/PlaywrightStepReporter.js +55 -12
- package/lib/reporter/PlaywrightStepReporter.js.map +1 -1
- package/lib/reporter/SerenityReporterForPlaywrightTest.d.ts +20 -7
- package/lib/reporter/SerenityReporterForPlaywrightTest.d.ts.map +1 -1
- package/lib/reporter/SerenityReporterForPlaywrightTest.js +4 -8
- package/lib/reporter/SerenityReporterForPlaywrightTest.js.map +1 -1
- package/package.json +6 -5
- package/src/api/PlaywrightTestConfig.ts +42 -0
- package/src/api/SerenityFixtures.ts +130 -0
- package/src/api/SerenityOptions.ts +261 -0
- package/src/api/SerenityTestType.ts +12 -0
- package/src/api/index.ts +5 -0
- package/src/{api.ts → api/test-api.ts} +63 -128
- package/src/index.ts +1 -2
- package/src/reporter/PlaywrightStepReporter.ts +90 -18
- package/src/reporter/SerenityReporterForPlaywrightTest.ts +21 -8
- package/lib/PlaywrightTestConfig.d.ts +0 -8
- package/lib/PlaywrightTestConfig.d.ts.map +0 -1
- package/lib/PlaywrightTestConfig.js.map +0 -1
- package/lib/api.d.ts +0 -213
- package/lib/api.d.ts.map +0 -1
- package/lib/api.js.map +0 -1
- package/src/PlaywrightTestConfig.ts +0 -6
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { SerenityTestType } from './SerenityTestType';
|
|
2
|
+
/**
|
|
3
|
+
* Declares a single test scenario.
|
|
4
|
+
*
|
|
5
|
+
* ## Example
|
|
6
|
+
*
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
9
|
+
* import { describe, it } from '@serenity-js/playwright-test'
|
|
10
|
+
*
|
|
11
|
+
* describe(`Todo List App`, () => {
|
|
12
|
+
*
|
|
13
|
+
* it(`should allow me to add a todo item`, async ({ actor }) => {
|
|
14
|
+
* await actor.attemptsTo(
|
|
15
|
+
* startWithAnEmptyList(),
|
|
16
|
+
*
|
|
17
|
+
* recordItem('Buy some milk'),
|
|
18
|
+
*
|
|
19
|
+
* Ensure.that(itemNames(), equals([
|
|
20
|
+
* 'Buy some milk',
|
|
21
|
+
* ])),
|
|
22
|
+
* )
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* it('supports multiple actors using separate browsers', async ({ actorCalled }) => {
|
|
26
|
+
* await actorCalled('Alice').attemptsTo(
|
|
27
|
+
* startWithAListContaining(
|
|
28
|
+
* 'Feed the cat'
|
|
29
|
+
* ),
|
|
30
|
+
* )
|
|
31
|
+
*
|
|
32
|
+
* await actorCalled('Bob').attemptsTo(
|
|
33
|
+
* startWithAListContaining(
|
|
34
|
+
* 'Walk the dog'
|
|
35
|
+
* ),
|
|
36
|
+
* )
|
|
37
|
+
*
|
|
38
|
+
* await actorCalled('Alice').attemptsTo(
|
|
39
|
+
* Ensure.that(itemNames(), equals([
|
|
40
|
+
* 'Feed the cat'
|
|
41
|
+
* ])),
|
|
42
|
+
* )
|
|
43
|
+
*
|
|
44
|
+
* await actorCalled('Bob').attemptsTo(
|
|
45
|
+
* Ensure.that(itemNames(), equals([
|
|
46
|
+
* 'Walk the dog'
|
|
47
|
+
* ])),
|
|
48
|
+
* )
|
|
49
|
+
* })
|
|
50
|
+
* })
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* ## Learn more
|
|
54
|
+
* - {@apilink describe|Grouping test scenarios}
|
|
55
|
+
* - {@apilink SerenityFixtures}
|
|
56
|
+
* - [Playwright Test `test` function](https://playwright.dev/docs/api/class-test#test-call)
|
|
57
|
+
* - [Serenity/JS + Playwright Test project template](https://github.com/serenity-js/serenity-js-playwright-test-template/)
|
|
58
|
+
*/
|
|
59
|
+
export declare const it: SerenityTestType;
|
|
60
|
+
export declare const test: SerenityTestType;
|
|
61
|
+
/**
|
|
62
|
+
* Declares a group of test scenarios.
|
|
63
|
+
*
|
|
64
|
+
* ## Example
|
|
65
|
+
*
|
|
66
|
+
* ```typescript
|
|
67
|
+
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
68
|
+
* import { describe, it, test } from '@serenity-js/playwright-test'
|
|
69
|
+
* import { Photographer, TakePhotosOfFailures, Value } from '@serenity-js/web'
|
|
70
|
+
*
|
|
71
|
+
* describe(`Todo List App`, () => {
|
|
72
|
+
*
|
|
73
|
+
* test.use({
|
|
74
|
+
* defaultActorName: 'Serena',
|
|
75
|
+
* crew: [
|
|
76
|
+
* Photographer.whoWill(TakePhotosOfFailures),
|
|
77
|
+
* ],
|
|
78
|
+
* })
|
|
79
|
+
*
|
|
80
|
+
* it(`should allow me to add a todo item`, async ({ actor }) => {
|
|
81
|
+
* await actor.attemptsTo(
|
|
82
|
+
* startWithAnEmptyList(),
|
|
83
|
+
*
|
|
84
|
+
* recordItem('Buy some milk'),
|
|
85
|
+
*
|
|
86
|
+
* Ensure.that(itemNames(), equals([
|
|
87
|
+
* 'Buy some milk',
|
|
88
|
+
* ])),
|
|
89
|
+
* )
|
|
90
|
+
* })
|
|
91
|
+
*
|
|
92
|
+
* it('should clear text input field when an item is added', async ({ actor }) => {
|
|
93
|
+
* await actor.attemptsTo(
|
|
94
|
+
* startWithAnEmptyList(),
|
|
95
|
+
*
|
|
96
|
+
* recordItem('Buy some milk'),
|
|
97
|
+
*
|
|
98
|
+
* Ensure.that(Value.of(newTodoInput()), equals('')),
|
|
99
|
+
* )
|
|
100
|
+
* })
|
|
101
|
+
* })
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* ## Learn more
|
|
105
|
+
* - Declaring a Serenity/JS {@apilink it|test scenario}
|
|
106
|
+
* - [Playwright Test `describe` function](https://playwright.dev/docs/api/class-test#test-describe-1)
|
|
107
|
+
* - [Serenity/JS + Playwright Test project template](https://github.com/serenity-js/serenity-js-playwright-test-template/)
|
|
108
|
+
*/
|
|
109
|
+
export declare const describe: SerenityTestType['describe'];
|
|
110
|
+
export declare const beforeAll: SerenityTestType['beforeAll'];
|
|
111
|
+
export declare const beforeEach: SerenityTestType['beforeEach'];
|
|
112
|
+
export declare const afterEach: SerenityTestType['afterEach'];
|
|
113
|
+
export declare const afterAll: SerenityTestType['afterAll'];
|
|
114
|
+
export declare const expect: SerenityTestType['expect'];
|
|
115
|
+
//# sourceMappingURL=test-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-api.d.ts","sourceRoot":"","sources":["../../src/api/test-api.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,eAAO,MAAM,EAAE,EAAE,gBAiHf,CAAC;AAYH,eAAO,MAAM,IAAI,EAAE,gBAAqB,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,eAAO,MAAM,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAe,CAAC;AAClE,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAgB,CAAC;AACrE,eAAO,MAAM,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAiB,CAAC;AACxE,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAgB,CAAC;AACrE,eAAO,MAAM,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAe,CAAC;AAClE,eAAO,MAAM,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAa,CAAC"}
|
|
@@ -29,8 +29,10 @@ const core_1 = require("@serenity-js/core");
|
|
|
29
29
|
const events_1 = require("@serenity-js/core/lib/events");
|
|
30
30
|
const model_1 = require("@serenity-js/core/lib/model");
|
|
31
31
|
const playwright_1 = require("@serenity-js/playwright");
|
|
32
|
+
const web_1 = require("@serenity-js/web");
|
|
32
33
|
const os = __importStar(require("os"));
|
|
33
|
-
const
|
|
34
|
+
const tiny_types_1 = require("tiny-types");
|
|
35
|
+
const reporter_1 = require("../reporter");
|
|
34
36
|
/**
|
|
35
37
|
* Declares a single test scenario.
|
|
36
38
|
*
|
|
@@ -83,14 +85,30 @@ const reporter_1 = require("./reporter");
|
|
|
83
85
|
* ```
|
|
84
86
|
*
|
|
85
87
|
* ## Learn more
|
|
86
|
-
* - Grouping test scenarios
|
|
88
|
+
* - {@apilink describe|Grouping test scenarios}
|
|
87
89
|
* - {@apilink SerenityFixtures}
|
|
88
90
|
* - [Playwright Test `test` function](https://playwright.dev/docs/api/class-test#test-call)
|
|
89
91
|
* - [Serenity/JS + Playwright Test project template](https://github.com/serenity-js/serenity-js-playwright-test-template/)
|
|
90
92
|
*/
|
|
91
93
|
exports.it = test_1.test.extend({
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
actors: [
|
|
95
|
+
({ browser, contextOptions }, use) => use(core_1.Cast.whereEveryoneCan(playwright_1.BrowseTheWebWithPlaywright.using(browser, contextOptions), core_1.TakeNotes.usingAnEmptyNotepad())),
|
|
96
|
+
{ option: true },
|
|
97
|
+
],
|
|
98
|
+
defaultActorName: [
|
|
99
|
+
'Serena',
|
|
100
|
+
{ option: true },
|
|
101
|
+
],
|
|
102
|
+
cueTimeout: [
|
|
103
|
+
core_1.Duration.ofSeconds(5),
|
|
104
|
+
{ option: true },
|
|
105
|
+
],
|
|
106
|
+
crew: [
|
|
107
|
+
[
|
|
108
|
+
web_1.Photographer.whoWill(web_1.TakePhotosOfFailures)
|
|
109
|
+
],
|
|
110
|
+
{ option: true },
|
|
111
|
+
],
|
|
94
112
|
// eslint-disable-next-line no-empty-pattern
|
|
95
113
|
platform: ({}, use) => {
|
|
96
114
|
const platform = os.platform();
|
|
@@ -103,7 +121,7 @@ exports.it = test_1.test.extend({
|
|
|
103
121
|
serenity: async ({ crew, cueTimeout, platform }, use, info) => {
|
|
104
122
|
const domainEventBuffer = new reporter_1.DomainEventBuffer();
|
|
105
123
|
core_1.serenity.configure({
|
|
106
|
-
cueTimeout: cueTimeout,
|
|
124
|
+
cueTimeout: asDuration(cueTimeout),
|
|
107
125
|
crew: [
|
|
108
126
|
...crew,
|
|
109
127
|
domainEventBuffer,
|
|
@@ -127,23 +145,32 @@ exports.it = test_1.test.extend({
|
|
|
127
145
|
body: Buffer.from(JSON.stringify(serialisedEvents), 'utf8'),
|
|
128
146
|
});
|
|
129
147
|
},
|
|
130
|
-
|
|
131
|
-
await use(core_1.Cast.whereEveryoneCan(playwright_1.BrowseTheWebWithPlaywright.using(browser)));
|
|
132
|
-
},
|
|
133
|
-
defaultActorName: 'Serena',
|
|
134
|
-
actor: async ({ actorCalled, defaultActorName }, use) => {
|
|
135
|
-
await use(actorCalled(defaultActorName));
|
|
136
|
-
},
|
|
137
|
-
actorCalled: async ({ serenity, actors, browser, browserName }, use) => {
|
|
138
|
-
serenity.engage(actors);
|
|
148
|
+
actorCalled: async ({ serenity, actors, browser, browserName, contextOptions }, use) => {
|
|
139
149
|
const sceneId = serenity.currentSceneId();
|
|
150
|
+
serenity.engage(asCast(actors));
|
|
140
151
|
const actorCalled = serenity.theActorCalled.bind(serenity);
|
|
141
152
|
serenity.announce(new events_1.SceneTagged(sceneId, new model_1.BrowserTag(browserName, browser.version()), serenity.currentTime()));
|
|
142
153
|
await use(actorCalled);
|
|
143
154
|
serenity.announce(new events_1.SceneFinishes(sceneId, serenity.currentTime()));
|
|
144
155
|
await core_1.serenity.waitForNextCue();
|
|
145
156
|
},
|
|
157
|
+
actor: async ({ actorCalled, defaultActorName }, use) => {
|
|
158
|
+
await use(actorCalled(defaultActorName));
|
|
159
|
+
},
|
|
160
|
+
page: async ({ actor }, use) => {
|
|
161
|
+
const page = (await playwright_1.BrowseTheWebWithPlaywright.as(actor).currentPage());
|
|
162
|
+
const nativePage = await page.nativePage();
|
|
163
|
+
await use(nativePage);
|
|
164
|
+
},
|
|
146
165
|
});
|
|
166
|
+
function asDuration(maybeDuration) {
|
|
167
|
+
return maybeDuration instanceof core_1.Duration
|
|
168
|
+
? maybeDuration
|
|
169
|
+
: core_1.Duration.ofMilliseconds(maybeDuration);
|
|
170
|
+
}
|
|
171
|
+
function asCast(maybeCast) {
|
|
172
|
+
return (0, tiny_types_1.ensure)('actors', maybeCast, (0, tiny_types_1.property)('prepare', (0, tiny_types_1.isFunction)()));
|
|
173
|
+
}
|
|
147
174
|
exports.test = exports.it;
|
|
148
175
|
/**
|
|
149
176
|
* Declares a group of test scenarios.
|
|
@@ -189,7 +216,7 @@ exports.test = exports.it;
|
|
|
189
216
|
* ```
|
|
190
217
|
*
|
|
191
218
|
* ## Learn more
|
|
192
|
-
* - Declaring a
|
|
219
|
+
* - Declaring a Serenity/JS {@apilink it|test scenario}
|
|
193
220
|
* - [Playwright Test `describe` function](https://playwright.dev/docs/api/class-test#test-describe-1)
|
|
194
221
|
* - [Serenity/JS + Playwright Test project template](https://github.com/serenity-js/serenity-js-playwright-test-template/)
|
|
195
222
|
*/
|
|
@@ -199,4 +226,4 @@ exports.beforeEach = exports.it.beforeEach;
|
|
|
199
226
|
exports.afterEach = exports.it.afterEach;
|
|
200
227
|
exports.afterAll = exports.it.afterAll;
|
|
201
228
|
exports.expect = exports.it.expect;
|
|
202
|
-
//# sourceMappingURL=api.js.map
|
|
229
|
+
//# sourceMappingURL=test-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-api.js","sourceRoot":"","sources":["../../src/api/test-api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA0D;AAC1D,4CAA4F;AAC5F,yDAA0E;AAC1E,uDAAsE;AACtE,wDAAqF;AACrF,0CAAsE;AACtE,uCAAyB;AACzB,2CAAqE;AAErE,0CAA2H;AAK3H;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACU,QAAA,EAAE,GAAqB,WAAI,CAAC,MAAM,CAAqD;IAEhG,MAAM,EAAE;QACJ,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,GAAG,EAAE,EAAE,CACjC,GAAG,CAAC,WAAI,CAAC,gBAAgB,CACrB,uCAA0B,CAAC,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,EACzD,gBAAS,CAAC,mBAAmB,EAAE,CAClC,CAAC;QACN,EAAE,MAAM,EAAE,IAAI,EAAE;KACnB;IAED,gBAAgB,EAAE;QACd,QAAQ;QACR,EAAE,MAA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C,UAAE,CAAC,UAAU,CAAC;AAC3D,QAAA,SAAS,GAAkC,UAAE,CAAC,SAAS,CAAC;AACxD,QAAA,QAAQ,GAAiC,UAAE,CAAC,QAAQ,CAAC;AACrD,QAAA,MAAM,GAA+B,UAAE,CAAC,MAAM,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export * from './api';
|
|
2
|
-
export
|
|
3
|
-
export { SerenityReporterForPlaywrightTest as default } from './reporter';
|
|
2
|
+
export { SerenityReporterForPlaywrightTest as default, SerenityReporterForPlaywrightTestConfig } from './reporter';
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAe,OAAO,CAAC;AACvB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAe,OAAO,CAAC;AACvB,OAAO,EAAE,iCAAiC,IAAI,OAAO,EAAE,uCAAuC,EAAE,MAAM,YAAY,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -16,7 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.default = void 0;
|
|
18
18
|
__exportStar(require("./api"), exports);
|
|
19
|
-
__exportStar(require("./PlaywrightTestConfig"), exports);
|
|
20
19
|
var reporter_1 = require("./reporter");
|
|
21
20
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return reporter_1.SerenityReporterForPlaywrightTest; } });
|
|
22
21
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wCAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wCAAuB;AACvB,uCAAmH;AAA1G,mGAAA,iCAAiC,OAAW"}
|
|
@@ -8,6 +8,9 @@ export declare class PlaywrightStepReporter implements StageCrewMember {
|
|
|
8
8
|
constructor(testInfo: TestInfo, stage?: Stage);
|
|
9
9
|
assignedTo(stage: Stage): StageCrewMember;
|
|
10
10
|
notifyOf(event: DomainEvent): void;
|
|
11
|
+
private isAPhotoAttempt;
|
|
12
|
+
private indicatesCompletionOfAnAsyncOperation;
|
|
13
|
+
private attachPhotoFrom;
|
|
11
14
|
private createStep;
|
|
12
15
|
}
|
|
13
16
|
//# sourceMappingURL=PlaywrightStepReporter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaywrightStepReporter.d.ts","sourceRoot":"","sources":["../../src/reporter/PlaywrightStepReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"PlaywrightStepReporter.d.ts","sourceRoot":"","sources":["../../src/reporter/PlaywrightStepReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAOH,WAAW,EAId,MAAM,8BAA8B,CAAC;AAsCtC,qBAAa,sBAAuB,YAAW,eAAe;IAKtD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,KAAK,CAAC;IAJlB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA4C;gBAG7C,QAAQ,EAAE,QAAQ,EAC3B,KAAK,CAAC,EAAE,KAAK;IAIzB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe;IAMzC,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IA8ClC,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,qCAAqC;IAM7C,OAAO,CAAC,eAAe;IAmBvB,OAAO,CAAC,UAAU;CAYrB"}
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PlaywrightStepReporter = void 0;
|
|
4
4
|
const events_1 = require("@serenity-js/core/lib/events");
|
|
5
|
+
const io_1 = require("@serenity-js/core/lib/io");
|
|
5
6
|
const model_1 = require("@serenity-js/core/lib/model");
|
|
7
|
+
const web_1 = require("@serenity-js/web");
|
|
8
|
+
const tiny_types_1 = require("tiny-types");
|
|
9
|
+
const genericPathToPhotographer = io_1.Path.from(require.resolve('@serenity-js/web'));
|
|
6
10
|
class PlaywrightStepReporter {
|
|
7
11
|
constructor(testInfo, stage) {
|
|
8
12
|
this.testInfo = testInfo;
|
|
@@ -14,20 +18,59 @@ class PlaywrightStepReporter {
|
|
|
14
18
|
return this;
|
|
15
19
|
}
|
|
16
20
|
notifyOf(event) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
(0, tiny_types_1.match)(event)
|
|
22
|
+
.when(events_1.TaskStarts, (e) => {
|
|
23
|
+
this.steps.set(e.activityId.value, this.createStep(e.details, 'task'));
|
|
24
|
+
})
|
|
25
|
+
.when(events_1.InteractionStarts, (e) => {
|
|
26
|
+
this.steps.set(e.activityId.value, this.createStep(e.details, 'interaction'));
|
|
27
|
+
})
|
|
28
|
+
.when(events_1.AsyncOperationAttempted, (e) => {
|
|
29
|
+
if (this.isAPhotoAttempt(e)) {
|
|
30
|
+
this.steps.set(e.correlationId.value, this.createStep(new model_1.ActivityDetails(new model_1.Name(`${web_1.Photographer.name}: ${e.description.value}`), new io_1.FileSystemLocation(genericPathToPhotographer)), 'crew'));
|
|
26
31
|
}
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
})
|
|
33
|
+
.when(events_1.ActivityFinished, (e) => {
|
|
34
|
+
const error = e.outcome instanceof model_1.ProblemIndication
|
|
35
|
+
? e.outcome.error
|
|
36
|
+
: undefined;
|
|
37
|
+
this.steps.get(e.activityId.value).complete({ error });
|
|
38
|
+
})
|
|
39
|
+
.when(events_1.ActivityRelatedArtifactGenerated, (e) => {
|
|
40
|
+
if (e.artifact instanceof model_1.Photo) {
|
|
41
|
+
this.attachPhotoFrom(e);
|
|
29
42
|
}
|
|
30
|
-
}
|
|
43
|
+
})
|
|
44
|
+
.when(events_1.SceneTagged, (e) => {
|
|
45
|
+
// don't include platform and browser tags as Playwright already includes them
|
|
46
|
+
if (!(e.tag instanceof model_1.PlatformTag || e.tag instanceof model_1.BrowserTag)) {
|
|
47
|
+
this.testInfo.annotations.push({ type: e.tag.type, description: e.tag.name });
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
.else(e => {
|
|
51
|
+
if (this.indicatesCompletionOfAnAsyncOperation(e) && this.steps.has(e.correlationId.value)) {
|
|
52
|
+
const error = event instanceof events_1.AsyncOperationFailed
|
|
53
|
+
? event.error
|
|
54
|
+
: undefined;
|
|
55
|
+
this.steps.get(e.correlationId.value).complete({ error });
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
isAPhotoAttempt(event) {
|
|
60
|
+
return event.name.value.startsWith(web_1.Photographer.name);
|
|
61
|
+
}
|
|
62
|
+
indicatesCompletionOfAnAsyncOperation(event) {
|
|
63
|
+
return event instanceof events_1.AsyncOperationCompleted
|
|
64
|
+
|| event instanceof events_1.AsyncOperationAborted
|
|
65
|
+
|| event instanceof events_1.AsyncOperationFailed;
|
|
66
|
+
}
|
|
67
|
+
attachPhotoFrom(event) {
|
|
68
|
+
const id = model_1.CorrelationId.create();
|
|
69
|
+
this.stage.announce(new events_1.AsyncOperationAttempted(new model_1.Name(this.constructor.name), new model_1.Description(`Attaching screenshot of '${event.name.value}'...`), id, this.stage.currentTime()));
|
|
70
|
+
this.testInfo.attach(event.name.value, { body: Buffer.from(event.artifact.base64EncodedValue, 'base64'), contentType: 'image/png' })
|
|
71
|
+
.then(() => {
|
|
72
|
+
this.stage.announce(new events_1.AsyncOperationCompleted(id, this.stage.currentTime()));
|
|
73
|
+
});
|
|
31
74
|
}
|
|
32
75
|
createStep(activityDetails, type) {
|
|
33
76
|
// https://github.com/microsoft/playwright/blob/04f77f231981780704a3a5e2cea93e3c420809a0/packages/playwright-test/src/expect.ts#L200-L206
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaywrightStepReporter.js","sourceRoot":"","sources":["../../src/reporter/PlaywrightStepReporter.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"PlaywrightStepReporter.js","sourceRoot":"","sources":["../../src/reporter/PlaywrightStepReporter.ts"],"names":[],"mappings":";;;AAEA,yDAWsC;AACtC,iDAAoE;AACpE,uDAAmJ;AACnJ,0CAAgD;AAChD,2CAAmC;AAEnC,MAAM,yBAAyB,GAAG,SAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAA;AAgChF,MAAa,sBAAsB;IAI/B,YACqB,QAAkB,EAC3B,KAAa;QADJ,aAAQ,GAAR,QAAQ,CAAU;QAC3B,UAAK,GAAL,KAAK,CAAQ;QAJR,UAAK,GAAkC,IAAI,GAAG,EAAE,CAAC;IAMlE,CAAC;IAED,UAAU,CAAC,KAAY;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ,CAAC,KAAkB;QAEvB,IAAA,kBAAK,EAAoB,KAAK,CAAC;aAC1B,IAAI,CAAC,mBAAU,EAA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KAAK;SACvB,CAAqB,CAAC;IAC3B,CAAC;CACJ;AAvGD,wDAuGC"}
|
|
@@ -1,30 +1,43 @@
|
|
|
1
1
|
import type { FullConfig } from '@playwright/test';
|
|
2
2
|
import type { Reporter, Suite, TestCase, TestResult } from '@playwright/test/reporter';
|
|
3
|
-
import { Serenity, StageCrewMember, StageCrewMemberBuilder } from '@serenity-js/core';
|
|
3
|
+
import { ClassDescription, Serenity, StageCrewMember, StageCrewMemberBuilder } from '@serenity-js/core';
|
|
4
4
|
import { OutputStream } from '@serenity-js/core/lib/adapter';
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Configuration object accepted by `@serenity-js/playwright-test` reporter.
|
|
7
|
+
*
|
|
8
|
+
* See {@apilink SerenityOptions} for usage examples.
|
|
9
|
+
*/
|
|
10
|
+
export interface SerenityReporterForPlaywrightTestConfig {
|
|
6
11
|
/**
|
|
7
12
|
* A list of {@apilink StageCrewMemberBuilder|StageCrewMemberBuilders} or {@apilink StageCrewMember|StageCrewMembers}
|
|
8
|
-
* to be notified of {@apilink DomainEvent|DomainEvents} that occur during the scenario execution.
|
|
13
|
+
* to be instantiated in Playwright Test reporter process and notified of {@apilink DomainEvent|DomainEvents} that occur during the scenario execution.
|
|
14
|
+
* Note that the `crew` can also be configured using {@apilink ClassDescription|ClassDescriptions}.
|
|
15
|
+
*
|
|
16
|
+
* #### Learn more
|
|
17
|
+
* - {@apilink SerenityOptions}
|
|
18
|
+
* - {@apilink SerenityConfig.crew}
|
|
9
19
|
*/
|
|
10
|
-
crew?: Array<StageCrewMember | StageCrewMemberBuilder>;
|
|
20
|
+
crew?: Array<StageCrewMember | StageCrewMemberBuilder | ClassDescription>;
|
|
11
21
|
/**
|
|
12
22
|
* An output stream to be injected into {@apilink StageCrewMemberBuilder|StageCrewMemberBuilders}
|
|
13
23
|
*
|
|
14
24
|
* Defaults to [`process.stdout`](https://nodejs.org/api/process.html#process_process_stdout).
|
|
25
|
+
*
|
|
26
|
+
* #### Learn more
|
|
27
|
+
* - {@apilink SerenityConfig.outputStream}
|
|
15
28
|
*/
|
|
16
29
|
outputStream?: OutputStream;
|
|
17
30
|
}
|
|
18
31
|
/**
|
|
19
|
-
*
|
|
20
|
-
* {@apilink DomainEvent|domain events}
|
|
32
|
+
* Serenity/JS reporter that receives notifications from Playwright Test and emits them as
|
|
33
|
+
* Serenity/JS {@apilink DomainEvent|domain events} which can be used by
|
|
34
|
+
* Serenity/JS {@apilink StageCrewMember|stage crew members}.
|
|
21
35
|
*/
|
|
22
36
|
export declare class SerenityReporterForPlaywrightTest implements Reporter {
|
|
23
37
|
private readonly serenity;
|
|
24
38
|
private errorParser;
|
|
25
39
|
private sceneIds;
|
|
26
40
|
/**
|
|
27
|
-
*
|
|
28
41
|
* @param config
|
|
29
42
|
* @param serenity
|
|
30
43
|
* Instance of {@apilink Serenity}, specific to the Node process running this Serenity reporter.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SerenityReporterForPlaywrightTest.d.ts","sourceRoot":"","sources":["../../src/reporter/SerenityReporterForPlaywrightTest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAc,QAAQ,EAAwC,eAAe,EAAE,sBAAsB,EAAa,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"SerenityReporterForPlaywrightTest.d.ts","sourceRoot":"","sources":["../../src/reporter/SerenityReporterForPlaywrightTest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAc,QAAQ,EAAwC,eAAe,EAAE,sBAAsB,EAAa,MAAM,mBAAmB,CAAC;AACrK,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAiC7D;;;;GAIG;AACH,MAAM,WAAW,uCAAuC;IAEpD;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,eAAe,GAAG,sBAAsB,GAAG,gBAAgB,CAAC,CAAC;IAE1E;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAED;;;;GAIG;AACH,qBAAa,iCAAkC,YAAW,QAAQ;IAa1D,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAX7B,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,QAAQ,CAAyC;IAEzD;;;;;OAKG;gBAEC,MAAM,EAAE,uCAAuC,EAC9B,QAAQ,GAAE,QAAmC;IAKlE,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAI/C,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAwBjC,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI;IA0CnD,OAAO,CAAC,wBAAwB;IAUhC,OAAO,CAAC,WAAW;IAwBnB,OAAO,CAAC,mBAAmB;IAcrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAY5B,OAAO,CAAC,IAAI;IAMZ,OAAO,CAAC,qBAAqB;IA8B7B,OAAO,CAAC,GAAG;IAIX,aAAa,IAAI,OAAO;CAG3B"}
|
|
@@ -23,24 +23,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.SerenityReporterForPlaywrightTest =
|
|
26
|
+
exports.SerenityReporterForPlaywrightTest = void 0;
|
|
27
27
|
const core_1 = require("@serenity-js/core");
|
|
28
28
|
const events = __importStar(require("@serenity-js/core/lib/events"));
|
|
29
29
|
const events_1 = require("@serenity-js/core/lib/events");
|
|
30
30
|
const io_1 = require("@serenity-js/core/lib/io");
|
|
31
31
|
const model_1 = require("@serenity-js/core/lib/model");
|
|
32
32
|
const PlaywrightAttachments_1 = require("./PlaywrightAttachments");
|
|
33
|
-
// TODO Split SerenityConfig into ActorsConfig and SerenityReportingConfig
|
|
34
|
-
class SerenityReporterForPlaywrightTestConfig {
|
|
35
|
-
}
|
|
36
|
-
exports.SerenityReporterForPlaywrightTestConfig = SerenityReporterForPlaywrightTestConfig;
|
|
37
33
|
/**
|
|
38
|
-
*
|
|
39
|
-
* {@apilink DomainEvent|domain events}
|
|
34
|
+
* Serenity/JS reporter that receives notifications from Playwright Test and emits them as
|
|
35
|
+
* Serenity/JS {@apilink DomainEvent|domain events} which can be used by
|
|
36
|
+
* Serenity/JS {@apilink StageCrewMember|stage crew members}.
|
|
40
37
|
*/
|
|
41
38
|
class SerenityReporterForPlaywrightTest {
|
|
42
39
|
/**
|
|
43
|
-
*
|
|
44
40
|
* @param config
|
|
45
41
|
* @param serenity
|
|
46
42
|
* Instance of {@apilink Serenity}, specific to the Node process running this Serenity reporter.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SerenityReporterForPlaywrightTest.js","sourceRoot":"","sources":["../../src/reporter/SerenityReporterForPlaywrightTest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,
|
|
1
|
+
{"version":3,"file":"SerenityReporterForPlaywrightTest.js","sourceRoot":"","sources":["../../src/reporter/SerenityReporterForPlaywrightTest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,4CAAqK;AAErK,qEAAuD;AACvD,yDAWsC;AACtC,iDAAoE;AACpE,uDAcqC;AAErC,mEAA4F;AA+B5F;;;;GAIG;AACH,MAAa,iCAAiC;IAK1C;;;;;OAKG;IACH,YACI,MAA+C,EAC9B,WAAqB,eAA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+1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/playwright-test",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
4
|
-
"description": "Serenity/JS
|
|
3
|
+
"version": "3.0.0-rc.40",
|
|
4
|
+
"description": "Serenity/JS reporter and test APIs for Playwright Test",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
7
7
|
"email": "jan.molak@smartcodeltd.co.uk",
|
|
@@ -45,8 +45,9 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@playwright/test": "^1.29.1",
|
|
48
|
-
"@serenity-js/core": "3.0.0-rc.
|
|
49
|
-
"@serenity-js/playwright": "3.0.0-rc.
|
|
48
|
+
"@serenity-js/core": "3.0.0-rc.40",
|
|
49
|
+
"@serenity-js/playwright": "3.0.0-rc.40",
|
|
50
|
+
"@serenity-js/web": "3.0.0-rc.40",
|
|
50
51
|
"deepmerge": "^4.2.2",
|
|
51
52
|
"tiny-types": "^1.19.0"
|
|
52
53
|
},
|
|
@@ -59,5 +60,5 @@
|
|
|
59
60
|
"ts-node": "^10.9.1",
|
|
60
61
|
"typescript": "^4.9.4"
|
|
61
62
|
},
|
|
62
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "94e7c72355737fe8bf1ad005c1677af13aa8e872"
|
|
63
64
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { PlaywrightTestConfig as BasePlaywrightTestConfig } from '@playwright/test';
|
|
2
|
+
|
|
3
|
+
import { SerenityOptions } from './SerenityOptions';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Convenience alias for [PlaywrightTestConfig](https://playwright.dev/docs/test-configuration) object
|
|
7
|
+
* that includes {@apilink SerenityOptions} and allows for any other custom options when needed.
|
|
8
|
+
*
|
|
9
|
+
* #### Example
|
|
10
|
+
* Configuring Playwright Test using the standard `PlaywrightTestConfig` from `@playwright/test`:
|
|
11
|
+
*
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // playwright.config.ts
|
|
14
|
+
* import type { PlaywrightTestConfig } from '@playwright/test'
|
|
15
|
+
* import type { SerenityOptions } from '@serenity-js/playwright-test'
|
|
16
|
+
*
|
|
17
|
+
* const config: PlaywrightTestConfig<SerenityOptions & MyCustomOptions> = {
|
|
18
|
+
* // ...
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* export default config
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* Simplified configuration using Serenity/JS `PlaywrightTestConfig` from `@serenity-js/playwright-test`:
|
|
25
|
+
*
|
|
26
|
+
* ```typescript
|
|
27
|
+
* // playwright.config.ts
|
|
28
|
+
* import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
|
|
29
|
+
*
|
|
30
|
+
* const config: PlaywrightTestConfig<MyCustomOptions> = {
|
|
31
|
+
* // ...
|
|
32
|
+
* }
|
|
33
|
+
* export default config
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* #### Learn more
|
|
37
|
+
* - {@apilink SerenityOptions}
|
|
38
|
+
* - {@apilink SerenityFixtures}
|
|
39
|
+
* - {@apilink SerenityReporterForPlaywrightTestConfig}
|
|
40
|
+
* - [Playwright Test configuration](https://playwright.dev/docs/test-configuration)
|
|
41
|
+
*/
|
|
42
|
+
export type PlaywrightTestConfig<TestArgs = object, WorkerArgs = object> = BasePlaywrightTestConfig<SerenityOptions & TestArgs, WorkerArgs>;
|