@serenity-js/playwright-test 3.0.0-rc.38 → 3.0.0-rc.39

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/lib/api/PlaywrightTestConfig.d.ts +41 -0
  3. package/lib/api/PlaywrightTestConfig.d.ts.map +1 -0
  4. package/lib/{PlaywrightTestConfig.js → api/PlaywrightTestConfig.js} +0 -0
  5. package/lib/api/PlaywrightTestConfig.js.map +1 -0
  6. package/lib/api/SerenityFixtures.d.ts +128 -0
  7. package/lib/api/SerenityFixtures.d.ts.map +1 -0
  8. package/lib/api/SerenityFixtures.js +3 -0
  9. package/lib/api/SerenityFixtures.js.map +1 -0
  10. package/lib/api/SerenityOptions.d.ts +256 -0
  11. package/lib/api/SerenityOptions.d.ts.map +1 -0
  12. package/lib/api/SerenityOptions.js +3 -0
  13. package/lib/api/SerenityOptions.js.map +1 -0
  14. package/lib/api/SerenityTestType.d.ts +5 -0
  15. package/lib/api/SerenityTestType.d.ts.map +1 -0
  16. package/lib/api/SerenityTestType.js +4 -0
  17. package/lib/api/SerenityTestType.js.map +1 -0
  18. package/lib/api/index.d.ts +6 -0
  19. package/lib/api/index.d.ts.map +1 -0
  20. package/lib/api/index.js +22 -0
  21. package/lib/api/index.js.map +1 -0
  22. package/lib/api/test-api.d.ts +115 -0
  23. package/lib/api/test-api.d.ts.map +1 -0
  24. package/lib/{api.js → api/test-api.js} +43 -16
  25. package/lib/api/test-api.js.map +1 -0
  26. package/lib/index.d.ts +1 -2
  27. package/lib/index.d.ts.map +1 -1
  28. package/lib/index.js +0 -1
  29. package/lib/index.js.map +1 -1
  30. package/lib/reporter/PlaywrightStepReporter.d.ts +3 -0
  31. package/lib/reporter/PlaywrightStepReporter.d.ts.map +1 -1
  32. package/lib/reporter/PlaywrightStepReporter.js +56 -12
  33. package/lib/reporter/PlaywrightStepReporter.js.map +1 -1
  34. package/lib/reporter/SerenityReporterForPlaywrightTest.d.ts +20 -7
  35. package/lib/reporter/SerenityReporterForPlaywrightTest.d.ts.map +1 -1
  36. package/lib/reporter/SerenityReporterForPlaywrightTest.js +4 -8
  37. package/lib/reporter/SerenityReporterForPlaywrightTest.js.map +1 -1
  38. package/package.json +6 -5
  39. package/src/api/PlaywrightTestConfig.ts +42 -0
  40. package/src/api/SerenityFixtures.ts +130 -0
  41. package/src/api/SerenityOptions.ts +261 -0
  42. package/src/api/SerenityTestType.ts +12 -0
  43. package/src/api/index.ts +5 -0
  44. package/src/{api.ts → api/test-api.ts} +63 -128
  45. package/src/index.ts +1 -2
  46. package/src/reporter/PlaywrightStepReporter.ts +91 -18
  47. package/src/reporter/SerenityReporterForPlaywrightTest.ts +21 -8
  48. package/lib/PlaywrightTestConfig.d.ts +0 -8
  49. package/lib/PlaywrightTestConfig.d.ts.map +0 -1
  50. package/lib/PlaywrightTestConfig.js.map +0 -1
  51. package/lib/api.d.ts +0 -213
  52. package/lib/api.d.ts.map +0 -1
  53. package/lib/api.js.map +0 -1
  54. package/src/PlaywrightTestConfig.ts +0 -6
@@ -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 reporter_1 = require("./reporter");
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 using {@apilink describe}
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
- cueTimeout: core_1.Duration.ofSeconds(5),
93
- crew: [],
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
- actors: async ({ browser }, use) => {
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 test scenario using {@apilink it}
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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AAC,aAAgC;IAChD,OAAO,aAAa,YAAY,eAAQ;QACpC,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,eAAQ,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,MAAM,CAAC,SAAkB;IAC9B,OAAO,IAAA,mBAAM,EAAC,QAAQ,EAAE,SAAiB,EAAE,IAAA,qBAAQ,EAAC,SAAS,EAAE,IAAA,uBAAU,GAAE,CAAC,CAAC,CAAC;AAClF,CAAC;AAEY,QAAA,IAAI,GAAqB,UAAE,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACU,QAAA,QAAQ,GAAiC,UAAE,CAAC,QAAQ,CAAC;AACrD,QAAA,SAAS,GAAkC,UAAE,CAAC,SAAS,CAAC;AACxD,QAAA,UAAU,GAAmC,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 * from './PlaywrightTestConfig';
3
- export { SerenityReporterForPlaywrightTest as default } from './reporter';
2
+ export { SerenityReporterForPlaywrightTest as default, SerenityReporterForPlaywrightTestConfig } from './reporter';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAe,OAAO,CAAC;AACvB,cAAe,wBAAwB,CAAC;AACxC,OAAO,EAAE,iCAAiC,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC"}
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,yDAAwC;AACxC,uCAA0E;AAAjE,mGAAA,iCAAiC,OAAW"}
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,EAAE,WAAW,EAAoE,MAAM,8BAA8B,CAAC;AAiC7H,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;IAmBlC,OAAO,CAAC,UAAU;CAYrB"}
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;AAuCtC,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,12 @@
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 model_2 = require("@serenity-js/core/src/model");
8
+ const web_1 = require("@serenity-js/web");
9
+ const tiny_types_1 = require("tiny-types");
10
+ const genericPathToPhotographer = io_1.Path.from(require.resolve('@serenity-js/web'));
6
11
  class PlaywrightStepReporter {
7
12
  constructor(testInfo, stage) {
8
13
  this.testInfo = testInfo;
@@ -14,20 +19,59 @@ class PlaywrightStepReporter {
14
19
  return this;
15
20
  }
16
21
  notifyOf(event) {
17
- if (event instanceof events_1.TaskStarts) {
18
- this.steps.set(event.activityId.value, this.createStep(event.details, 'task'));
19
- }
20
- if (event instanceof events_1.InteractionStarts) {
21
- this.steps.set(event.activityId.value, this.createStep(event.details, 'interaction'));
22
- }
23
- if (event instanceof events_1.InteractionFinished || event instanceof events_1.TaskFinished) {
24
- if (event.outcome instanceof model_1.ProblemIndication) {
25
- this.steps.get(event.activityId.value).complete({ error: event.outcome.error });
22
+ (0, tiny_types_1.match)(event)
23
+ .when(events_1.TaskStarts, (e) => {
24
+ this.steps.set(e.activityId.value, this.createStep(e.details, 'task'));
25
+ })
26
+ .when(events_1.InteractionStarts, (e) => {
27
+ this.steps.set(e.activityId.value, this.createStep(e.details, 'interaction'));
28
+ })
29
+ .when(events_1.AsyncOperationAttempted, (e) => {
30
+ if (this.isAPhotoAttempt(e)) {
31
+ 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
32
  }
27
- else {
28
- this.steps.get(event.activityId.value).complete({});
33
+ })
34
+ .when(events_1.ActivityFinished, (e) => {
35
+ const error = e.outcome instanceof model_1.ProblemIndication
36
+ ? e.outcome.error
37
+ : undefined;
38
+ this.steps.get(e.activityId.value).complete({ error });
39
+ })
40
+ .when(events_1.ActivityRelatedArtifactGenerated, (e) => {
41
+ if (e.artifact instanceof model_1.Photo) {
42
+ this.attachPhotoFrom(e);
29
43
  }
30
- }
44
+ })
45
+ .when(events_1.SceneTagged, (e) => {
46
+ // don't include platform and browser tags as Playwright already includes them
47
+ if (!(e.tag instanceof model_2.PlatformTag || e.tag instanceof model_2.BrowserTag)) {
48
+ this.testInfo.annotations.push({ type: e.tag.type, description: e.tag.name });
49
+ }
50
+ })
51
+ .else(e => {
52
+ if (this.indicatesCompletionOfAnAsyncOperation(e) && this.steps.has(e.correlationId.value)) {
53
+ const error = event instanceof events_1.AsyncOperationFailed
54
+ ? event.error
55
+ : undefined;
56
+ this.steps.get(e.correlationId.value).complete({ error });
57
+ }
58
+ });
59
+ }
60
+ isAPhotoAttempt(event) {
61
+ return event.name.value.startsWith(web_1.Photographer.name);
62
+ }
63
+ indicatesCompletionOfAnAsyncOperation(event) {
64
+ return event instanceof events_1.AsyncOperationCompleted
65
+ || event instanceof events_1.AsyncOperationAborted
66
+ || event instanceof events_1.AsyncOperationFailed;
67
+ }
68
+ attachPhotoFrom(event) {
69
+ const id = model_1.CorrelationId.create();
70
+ 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()));
71
+ this.testInfo.attach(event.name.value, { body: Buffer.from(event.artifact.base64EncodedValue, 'base64'), contentType: 'image/png' })
72
+ .then(() => {
73
+ this.stage.announce(new events_1.AsyncOperationCompleted(id, this.stage.currentTime()));
74
+ });
31
75
  }
32
76
  createStep(activityDetails, type) {
33
77
  // 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,yDAA6H;AAC7H,uDAAiF;AAgCjF,MAAa,sBAAsB;IAI/B,YACqB,QAAkB,EAC3B,KAAa;QADJ,aAAQ,GAAR,QAAQ,CAAU;QAC3B,UAAK,GAAL,KAAK,CAAQ;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AAM,MAAM,CAAC,EACrE,EAAE,EACF,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAC3B,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;aAC/H,IAAI,CAAC,GAAG,EAAE;YACP,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,gCAAuB,CAC3C,EAAE,EACF,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAC3B,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACX,CAAC;IAEO,UAAU,CAAC,eAAgC,EAAE,IAAqC;QACtF,yIAAyI;QACzI,OAAQ,IAAI,CAAC,QAAgB,CAAC,QAAQ,CAAC;YACnC,QAAQ,EAAE,eAAe,CAAC,QAAQ;gBAC9B,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,MAAM,EAAE;gBAC7H,CAAC,CAAC,SAAS;YACf,QAAQ,EAAE,eAAgB,IAAK,EAAE;YACjC,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK;YACjC,eAAe,EAAE,IAAI;YACrB,aAAa,EAAE,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
- export declare class SerenityReporterForPlaywrightTestConfig {
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
- * Receives notifications from Playwright Test and translates them to Serenity/JS
20
- * {@apilink DomainEvent|domain events}, so that they can be used with Serenity/JS reporters.
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;AACnJ,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAkC7D,qBAAa,uCAAuC;IAChD;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,eAAe,GAAG,sBAAsB,CAAC,CAAC;IAEvD;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAED;;;GAGG;AACH,qBAAa,iCAAkC,YAAW,QAAQ;IAc1D,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAZ7B,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,QAAQ,CAAyC;IAEzD;;;;;;OAMG;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;I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AAO,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 = exports.SerenityReporterForPlaywrightTestConfig = void 0;
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
- * Receives notifications from Playwright Test and translates them to Serenity/JS
39
- * {@apilink DomainEvent|domain events}, so that they can be used with Serenity/JS reporters.
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,4CAAmJ;AAEnJ,qEAAuD;AACvD,yDAWsC;AACtC,iDAAoE;AACpE,uDAcqC;AAErC,mEAA4F;AAE5F,0EAA0E;AAC1E,MAAa,uC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;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;;AA1Bc,2BAAK,GAAG,IAAI,MAAM,CAC7B,sJAAsJ,EAAE,uCAAuC;AAC/L,GAAG,CACN,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@serenity-js/playwright-test",
3
- "version": "3.0.0-rc.38",
4
- "description": "Serenity/JS Screenplay Pattern library for Playwright",
3
+ "version": "3.0.0-rc.39",
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.38",
49
- "@serenity-js/playwright": "3.0.0-rc.38",
48
+ "@serenity-js/core": "3.0.0-rc.39",
49
+ "@serenity-js/playwright": "3.0.0-rc.39",
50
+ "@serenity-js/web": "3.0.0-rc.39",
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": "3472a2338ceea7267e24147635c0cc1ce4ff70fe"
63
+ "gitHead": "0ed93e2714afd329ac8e5e3121374d9f1f80d660"
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>;
@@ -0,0 +1,130 @@
1
+ import { Actor, Cast, Serenity } from '@serenity-js/core';
2
+
3
+ /**
4
+ * Serenity/JS-specific [Playwright Test fixtures](https://playwright.dev/docs/test-fixtures)
5
+ * injected into your {@apilink it|test scenarios}.
6
+ *
7
+ * ## Example test scenario
8
+ *
9
+ * ```typescript
10
+ * import { Ensure, equals } from '@serenity-js/assertions'
11
+ * import { describe, it, test } from '@serenity-js/playwright-test'
12
+ * import { Photographer, TakePhotosOfFailures } from '@serenity-js/web'
13
+ *
14
+ * describe(`Recording items`, () => {
15
+ *
16
+ * test.use({
17
+ * defaultActorName: 'Serena',
18
+ * crew: [
19
+ * Photographer.whoWill(TakePhotosOfFailures),
20
+ * ],
21
+ * })
22
+ *
23
+ * describe(`Todo List App`, () => {
24
+ *
25
+ * it(`should allow me to add a todo item`, async ({ actor }) => {
26
+ * await actor.attemptsTo(
27
+ * startWithAnEmptyList(),
28
+ *
29
+ * recordItem('Buy some milk'),
30
+ *
31
+ * Ensure.that(itemNames(), equals([
32
+ * 'Buy some milk',
33
+ * ])),
34
+ * )
35
+ * })
36
+ * })
37
+ * })
38
+ * ```
39
+ *
40
+ * ## Learn more
41
+ * - Declaring a Serenity/JS {@apilink it|test scenario}
42
+ * - {@apilink describe|Grouping test scenarios}
43
+ * - [Serenity/JS + Playwright Test project template](https://github.com/serenity-js/serenity-js-playwright-test-template/)
44
+ */
45
+ export interface SerenityFixtures {
46
+
47
+ /**
48
+ * Retrieves the root object of the Serenity/JS framework.
49
+ */
50
+ serenity: Serenity;
51
+
52
+ /**
53
+ * Name and version of the operating system that Playwright Test worker process runs on.
54
+ */
55
+ platform: { name: string, version: string };
56
+
57
+ /**
58
+ * A cast of Serenity/JS actors to be used instead of the default cast
59
+ * when instantiating {@apilink SerenityFixtures.actor|actor}
60
+ * and invoking {@apilink SerenityFixtures.actorCalled|actorCalled}.
61
+ *
62
+ * #### Overriding the default cast of Serenity/JS actors
63
+ *
64
+ * ```typescript
65
+ * import { Cast, TakeNotes } from '@serenity-js/core'
66
+ * import { Ensure, equals } from '@serenity-js/assertions'
67
+ * import { BrowseTheWebWithPlaywright } from '@serenity-js/playwright'
68
+ * import { describe, it, test } from '@serenity-js/playwright-test'
69
+ *
70
+ * describe(`Recording items`, () => {
71
+ *
72
+ * test.use({
73
+ * defaultActorName: 'Serena',
74
+ * actors: ({ browser, contextOptions }, use) => {
75
+ * const cast = Cast.whereEveryoneCan(
76
+ * BrowseTheWebWithPlaywright.using(browser, contextOptions),
77
+ * TakeNotes.usingAnEmptyNotepad(),
78
+ * )
79
+ *
80
+ * // Make sure to pass your custom cast to Playwright `use` callback
81
+ * use(cast)
82
+ * },
83
+ * })
84
+ *
85
+ * describe(`Todo List App`, () => {
86
+ *
87
+ * it(`should allow me to add a todo item`, async ({ actor }) => {
88
+ * await actor.attemptsTo(
89
+ * startWithAnEmptyList(),
90
+ *
91
+ * recordItem('Buy some milk'),
92
+ *
93
+ * Ensure.that(itemNames(), equals([
94
+ * 'Buy some milk',
95
+ * ])),
96
+ * )
97
+ * })
98
+ * })
99
+ * })
100
+ * ```
101
+ */
102
+ actors: Cast;
103
+
104
+ /**
105
+ * Uses the provided {@apilink Cast} of {@apilink SerenityFixtures.actors|actors} to instantiate an {@apilink Actor} called `name`
106
+ * and inject it into a {@apilink it|test scenario}.
107
+ *
108
+ * Retrieves an existing actor if one has already been instantiated.
109
+ *
110
+ * #### Learn more
111
+ * - Declaring a Serenity/JS {@apilink it|test scenario}
112
+ * - {@apilink SerenityOptions.actors}
113
+ * - {@apilink SerenityFixtures.actors}
114
+ *
115
+ * @param name
116
+ */
117
+ actorCalled: (name: string) => Actor;
118
+
119
+ /**
120
+ * Default {@apilink SerenityFixtures.actor|actor} injected into a {@apilink it|test scenario}.
121
+ *
122
+ * Using `actor` fixture is equivalent to invoking {@apilink SerenityFixtures.actorCalled|actorCalled} with {@apilink SerenityOptions.defaultActorName|defaultActorName}.
123
+ *
124
+ * #### Learn more
125
+ * - {@apilink SerenityFixtures.actorCalled|actorCalled}
126
+ * - {@apilink SerenityOptions.defaultActorName}
127
+ * - Declaring a Serenity/JS {@apilink it|test scenario}
128
+ */
129
+ actor: Actor;
130
+ }