@serenity-js/playwright-test 3.31.17 → 3.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +6 -5
  3. package/lib/api/PlaywrightTestConfig.d.ts +7 -6
  4. package/lib/api/PlaywrightTestConfig.d.ts.map +1 -1
  5. package/lib/api/WorkerEventStreamReader.d.ts +13 -0
  6. package/lib/api/WorkerEventStreamReader.d.ts.map +1 -0
  7. package/lib/api/WorkerEventStreamReader.js +58 -0
  8. package/lib/api/WorkerEventStreamReader.js.map +1 -0
  9. package/lib/api/WorkerEventStreamWriter.d.ts +24 -0
  10. package/lib/api/WorkerEventStreamWriter.d.ts.map +1 -0
  11. package/lib/api/WorkerEventStreamWriter.js +86 -0
  12. package/lib/api/WorkerEventStreamWriter.js.map +1 -0
  13. package/lib/api/index.d.ts +1 -2
  14. package/lib/api/index.d.ts.map +1 -1
  15. package/lib/api/index.js +1 -2
  16. package/lib/api/index.js.map +1 -1
  17. package/lib/api/serenity-fixtures.d.ts +377 -0
  18. package/lib/api/serenity-fixtures.d.ts.map +1 -0
  19. package/lib/api/{SerenityOptions.js → serenity-fixtures.js} +1 -1
  20. package/lib/api/serenity-fixtures.js.map +1 -0
  21. package/lib/api/test-api.d.ts +27 -15
  22. package/lib/api/test-api.d.ts.map +1 -1
  23. package/lib/api/test-api.js +126 -104
  24. package/lib/api/test-api.js.map +1 -1
  25. package/lib/events/EventFactory.d.ts +16 -0
  26. package/lib/events/EventFactory.d.ts.map +1 -0
  27. package/lib/events/EventFactory.js +94 -0
  28. package/lib/events/EventFactory.js.map +1 -0
  29. package/lib/events/PlaywrightSceneId.d.ts +7 -0
  30. package/lib/events/PlaywrightSceneId.d.ts.map +1 -0
  31. package/lib/events/PlaywrightSceneId.js +19 -0
  32. package/lib/events/PlaywrightSceneId.js.map +1 -0
  33. package/lib/events/index.d.ts +3 -0
  34. package/lib/events/index.d.ts.map +1 -0
  35. package/lib/events/index.js +19 -0
  36. package/lib/events/index.js.map +1 -0
  37. package/lib/reporter/PlaywrightErrorParser.d.ts +7 -0
  38. package/lib/reporter/PlaywrightErrorParser.d.ts.map +1 -0
  39. package/lib/reporter/PlaywrightErrorParser.js +28 -0
  40. package/lib/reporter/PlaywrightErrorParser.js.map +1 -0
  41. package/lib/reporter/PlaywrightEventBuffer.d.ts +25 -0
  42. package/lib/reporter/PlaywrightEventBuffer.d.ts.map +1 -0
  43. package/lib/reporter/PlaywrightEventBuffer.js +147 -0
  44. package/lib/reporter/PlaywrightEventBuffer.js.map +1 -0
  45. package/lib/reporter/PlaywrightTestSceneIdFactory.d.ts +8 -0
  46. package/lib/reporter/PlaywrightTestSceneIdFactory.d.ts.map +1 -0
  47. package/lib/reporter/PlaywrightTestSceneIdFactory.js +15 -0
  48. package/lib/reporter/PlaywrightTestSceneIdFactory.js.map +1 -0
  49. package/lib/reporter/SerenityReporterForPlaywrightTest.d.ts +15 -22
  50. package/lib/reporter/SerenityReporterForPlaywrightTest.d.ts.map +1 -1
  51. package/lib/reporter/SerenityReporterForPlaywrightTest.js +62 -163
  52. package/lib/reporter/SerenityReporterForPlaywrightTest.js.map +1 -1
  53. package/lib/reporter/index.d.ts +0 -2
  54. package/lib/reporter/index.d.ts.map +1 -1
  55. package/lib/reporter/index.js +0 -2
  56. package/lib/reporter/index.js.map +1 -1
  57. package/package.json +9 -9
  58. package/src/api/PlaywrightTestConfig.ts +7 -6
  59. package/src/api/WorkerEventStreamReader.ts +27 -0
  60. package/src/api/WorkerEventStreamWriter.ts +117 -0
  61. package/src/api/index.ts +1 -2
  62. package/src/api/serenity-fixtures.ts +392 -0
  63. package/src/api/test-api.ts +187 -99
  64. package/src/events/EventFactory.ts +204 -0
  65. package/src/events/PlaywrightSceneId.ts +20 -0
  66. package/src/events/index.ts +2 -0
  67. package/src/reporter/PlaywrightErrorParser.ts +35 -0
  68. package/src/reporter/PlaywrightEventBuffer.ts +251 -0
  69. package/src/reporter/PlaywrightTestSceneIdFactory.ts +14 -0
  70. package/src/reporter/SerenityReporterForPlaywrightTest.ts +89 -250
  71. package/src/reporter/index.ts +0 -2
  72. package/lib/api/SerenityFixtures.d.ts +0 -130
  73. package/lib/api/SerenityFixtures.d.ts.map +0 -1
  74. package/lib/api/SerenityFixtures.js +0 -3
  75. package/lib/api/SerenityFixtures.js.map +0 -1
  76. package/lib/api/SerenityOptions.d.ts +0 -271
  77. package/lib/api/SerenityOptions.d.ts.map +0 -1
  78. package/lib/api/SerenityOptions.js.map +0 -1
  79. package/lib/reporter/DomainEventBuffer.d.ts +0 -11
  80. package/lib/reporter/DomainEventBuffer.d.ts.map +0 -1
  81. package/lib/reporter/DomainEventBuffer.js +0 -24
  82. package/lib/reporter/DomainEventBuffer.js.map +0 -1
  83. package/lib/reporter/PlaywrightAttachments.d.ts +0 -2
  84. package/lib/reporter/PlaywrightAttachments.d.ts.map +0 -1
  85. package/lib/reporter/PlaywrightAttachments.js +0 -5
  86. package/lib/reporter/PlaywrightAttachments.js.map +0 -1
  87. package/src/api/SerenityFixtures.ts +0 -132
  88. package/src/api/SerenityOptions.ts +0 -277
  89. package/src/reporter/DomainEventBuffer.ts +0 -28
  90. package/src/reporter/PlaywrightAttachments.ts +0 -1
@@ -1,271 +0,0 @@
1
- import type { PlaywrightTestOptions, PlaywrightWorkerArgs, TestFixture } from '@playwright/test';
2
- import type { Cast, ClassDescription, Duration, StageCrewMember, StageCrewMemberBuilder } from '@serenity-js/core';
3
- import type { PlaywrightOptions } from '@serenity-js/playwright';
4
- /**
5
- * Configuration object accepted by `@serenity-js/playwright-test`.
6
- *
7
- * ## Example
8
- *
9
- * ```typescript
10
- * // playwright.config.ts
11
- * import type { Cast, TakeNotes } from '@serenity-js/core'
12
- * import type { BrowseTheWebWithPlaywright } from '@serenity-js/playwright'
13
- * import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
14
- * import type { CallAnApi } from '@serenity-js/rest'
15
- *
16
- * // Define any custom configuration options, if needed
17
- * interface MyCustomOptions {
18
- * apiUrl: string;
19
- * }
20
- *
21
- * const config: PlaywrightTestConfig<MyCustomOptions> = {
22
- *
23
- * // Register Serenity/JS reporter for Playwright Test
24
- * // to enable integration with Serenity/JS stage crew members
25
- * // and have them instantiated in the Playwright reporter process
26
- * reporter: [
27
- * [ '@serenity-js/playwright-test', {
28
- * // Stage crew members instantiated in the test reporter process
29
- * crew: [
30
- * '@serenity-js/serenity-bdd',
31
- * '@serenity-js/console-reporter',
32
- * [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
33
- * ]
34
- * }]
35
- * ],
36
- *
37
- * use: {
38
- *
39
- * // Register Serenity/JS stage crew members
40
- * // and have them instantiated in Playwright Test worker processes
41
- * crew: [
42
- * [ '@serenity-js/web:Photographer', { strategy: 'TakePhotosOfFailures' } ]
43
- * ],
44
- *
45
- * // Register a custom cast of Serenity/JS actors
46
- * // if you don't want to use the default ones
47
- * actors: ({ browser, contextOptions, apiUrl }, use) => {
48
- * const cast = Cast.where(actor =>
49
- * actor.whoCan(
50
- * BrowseTheWebWithPlaywright.using(browser, contextOptions),
51
- * TakeNotes.usingAnEmptyNotepad(),
52
- * CallAnApi.at(apiUrl),
53
- * )
54
- * )
55
- *
56
- * use(cast)
57
- * },
58
- *
59
- * // Name to be given to an actor injected via `actor` fixture
60
- * defaultActorName: 'Alice',
61
- *
62
- * // Any custom options, as per the MyCustomOptions interface
63
- * apiUrl: 'https://api.serenity-js.org/v1'
64
- *
65
- * // Any other Playwright options
66
- * baseURL: 'https://todo-app.serenity-js.org/',
67
- * video: 'on-first-retry',
68
- * trace: 'on-first-retry',
69
- * },
70
- * }
71
- *
72
- * export default config
73
- * ```
74
- *
75
- * ## Learn more
76
- * - [`PlaywrightTestConfig`](https://serenity-js.org/api/playwright-test/#PlaywrightTestConfig)
77
- * - [`Cast`](https://serenity-js.org/api/core/class/Cast/)
78
- * - [`SerenityFixtures`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/)
79
- */
80
- export interface SerenityOptions {
81
- /**
82
- * Configures the [`Cast`](https://serenity-js.org/api/core/class/Cast/) of [`actors`](https://serenity-js.org/api/core/class/SerenityConfig/#actors) to be used when injecting an [`actor`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/#actor)
83
- * or invoking [`actorCalled`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/#actorCalled) in a [test scenario](https://serenity-js.org/api/playwright-test/function/it/).
84
- *
85
- * :::info Did you know?
86
- * When you use `@serenity-js/playwright-test` [test APIs](https://serenity-js.org/api/playwright-test/function/it/), Serenity/JS already provides a default cast of actors for you.
87
- * Each one of the default actors receives [abilities](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWebWithPlaywright`](https://serenity-js.org/api/playwright/class/BrowseTheWebWithPlaywright/) and [`TakeNotes.usingAnEmptyNotepad`](https://serenity-js.org/api/core/class/TakeNotes/#usingAnEmptyNotepad).
88
- *
89
- * The default abilities should be sufficient in most web testing scenarios. However, you might want to override this default configuration
90
- * when you need your actors to [interact with REST APIs](https://serenity-js.org/api/rest/class/CallAnApi/),
91
- * [manage local servers](https://serenity-js.org/api/local-server/class/ManageALocalServer/),
92
- * start with a notepad that has some [initial state](https://serenity-js.org/api/core/class/TakeNotes/#using),
93
- * or receive [custom abilities](https://serenity-js.org/api/core/class/Ability/).
94
- * :::
95
- *
96
- * #### Using a custom crew of Serenity/JS actors
97
- *
98
- * ```typescript
99
- * // playwright.config.ts
100
- * import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
101
- * import { Cast, TakeNotes } from '@serenity-js/core'
102
- * import { BrowseTheWebWithPlaywright } from '@serenity-js/playwright'
103
- * import { CallAnApi } from '@serenity-js/rest'
104
- *
105
- * // Define any custom configuration options, if needed
106
- * interface MyCustomOptions {
107
- * apiUrl: string;
108
- * }
109
- *
110
- * // Parameterise PlaywrightTestConfig with MyCustomOptions
111
- * // to enable type checking of any custom properties
112
- * const config: PlaywrightTestConfig<MyCustomOptions> = {
113
- * use: {
114
- * contextOptions: {
115
- * defaultNavigationTimeout: 30_000,
116
- * },
117
- *
118
- * // custom properties
119
- * apiUrl: 'https://api.serenity-js.org/v1',
120
- *
121
- * // Custom cast of actors receives `contextOptions`
122
- * // with the additional Serenity/JS properties (see `PlaywrightOptions`),
123
- * // as well as any other custom properties you define in the destructuring expression,
124
- * // such as `apiUrl`.
125
- * actors: ({ browser, contextOptions, apiUrl }, use) => {
126
- * const cast = Cast.where(actor => actor.whoCan(
127
- * BrowseTheWebWithPlaywright.using(browser, contextOptions),
128
- * TakeNotes.usingAnEmptyNotepad(),
129
- * CallAnApi.at(apiUrl),
130
- * ))
131
- *
132
- * // Make sure to pass your custom cast to Playwright `use` callback
133
- * use(cast)
134
- * },
135
- * },
136
- * };
137
- * export default config
138
- * ```
139
- *
140
- * #### Learn more
141
- * - Declaring a Serenity/JS [test scenario](https://serenity-js.org/api/playwright-test/function/it/)
142
- * - [`SerenityFixtures`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/)
143
- */
144
- actors: TestFixture<Cast, PlaywrightTestOptions & PlaywrightWorkerArgs>;
145
- /**
146
- * Configures the name given to the default Serenity/JS [`actor`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/#actor)
147
- * injected into a [test scenario](https://serenity-js.org/api/playwright-test/function/it/).
148
- *
149
- * #### Learn more
150
- * - Declaring a Serenity/JS [test scenario](https://serenity-js.org/api/playwright-test/function/it/)
151
- * - [`SerenityFixtures`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/)
152
- */
153
- defaultActorName: string;
154
- /**
155
- * Configures the [stage crew members](https://serenity-js.org/api/core/class/SerenityConfig/#crew)
156
- * to be instantiated in Playwright Test worker processes.
157
- *
158
- * :::info Did you know?
159
- * By default, Serenity/JS registers a [`Photographer`](https://serenity-js.org/api/web/class/Photographer/).whoWill([`TakePhotosOfFailures`](https://serenity-js.org/api/web/class/TakePhotosOfFailures/)),
160
- * so that any test failures are automatically accompanied by a screenshot.
161
- *
162
- * If you prefer a different behaviour, you can configure the `crew` with an empty array to disable taking screenshots altogether (`crew: []`),
163
- * or with a [`Photographer`](https://serenity-js.org/api/web/class/Photographer/) who uses a different [`PhotoTakingStrategy`](https://serenity-js.org/api/web/class/PhotoTakingStrategy/), like to [`TakePhotosOfInteractions`](https://serenity-js.org/api/web/class/TakePhotosOfInteractions/).
164
- * :::
165
- *
166
- * #### Example
167
- *
168
- * ```typescript
169
- * // playwright.config.ts
170
- * import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
171
- *
172
- * const config: PlaywrightTestConfig = {
173
- * use: {
174
- * crew: [
175
- * [ '@serenity-js/web:Photographer', { strategy: 'TakePhotosOfFailures' } ]
176
- * ],
177
- * },
178
- * };
179
- * export default config
180
- * ```
181
- *
182
- * #### Learn more
183
- * - [`SerenityConfig.crew`](https://serenity-js.org/api/core/class/SerenityConfig/#crew)
184
- */
185
- crew: Array<ClassDescription | StageCrewMember | StageCrewMemberBuilder>;
186
- /**
187
- * Sets the [`cueTimeout`](https://serenity-js.org/api/core/class/SerenityConfig/#cueTimeout) to a given [duration](https://serenity-js.org/api/core/class/Duration/) or a numeric value in milliseconds.
188
- * Defaults to **5 seconds**.
189
- *
190
- * #### Learn more
191
- * - [`SerenityConfig.cueTimeout`](https://serenity-js.org/api/core/class/SerenityConfig/#cueTimeout)
192
- * - [`Discardable`](https://serenity-js.org/api/core/interface/Discardable/)
193
- * - [`Ability`](https://serenity-js.org/api/core/class/Ability/)
194
- */
195
- cueTimeout: number | Duration;
196
- /**
197
- * The maximum default amount of time allowed for interactions such as [`Wait.until`](https://serenity-js.org/api/core/class/Wait/#until)
198
- * to complete.
199
- *
200
- * Defaults to **5 seconds**, can be overridden per interaction.
201
- *
202
- * #### Learn more
203
- * - [`Wait.until`](https://serenity-js.org/api/core/class/Wait/#until)
204
- */
205
- interactionTimeout?: Duration;
206
- /**
207
- * Playwright [BrowserContextOptions](https://playwright.dev/docs/api/class-testoptions#test-options-context-options),
208
- * augmented with several convenience properties to be used with the [ability](https://serenity-js.org/api/core/class/Ability/)
209
- * to [`BrowseTheWebWithPlaywright`](https://serenity-js.org/api/playwright/class/BrowseTheWebWithPlaywright/).
210
- *
211
- * Additional convenience properties include:
212
- * - [`PlaywrightOptions.defaultNavigationTimeout`](https://serenity-js.org/api/playwright/interface/PlaywrightOptions/#defaultNavigationTimeout)
213
- * - [`PlaywrightOptions.defaultNavigationWaitUntil`](https://serenity-js.org/api/playwright/interface/PlaywrightOptions/#defaultNavigationWaitUntil)
214
- * - [`PlaywrightOptions.defaultTimeout`](https://serenity-js.org/api/playwright/interface/PlaywrightOptions/#defaultTimeout)
215
- *
216
- * #### Using `contextOptions` with the default cast of Serenity/JS actors
217
- *
218
- * ```typescript
219
- * // playwright.config.ts
220
- * import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
221
- *
222
- * const config: PlaywrightTestConfig = {
223
- * use: {
224
- * contextOptions: {
225
- * defaultNavigationTimeout: 30_000,
226
- * }
227
- *
228
- * // Since `actors` property is not defined,
229
- * // `contextOptions` will be passed to the default cast of Serenity/JS actors
230
- * // and injected into the ability to `BrowseTheWebWithPlaywright`
231
- * // that each actor receives.
232
- * },
233
- * };
234
- * export default config;
235
- * ```
236
- *
237
- * #### Using `contextOptions` with a custom cast of Serenity/JS actors
238
- *
239
- * ```typescript
240
- * // playwright.config.ts
241
- * import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
242
- *
243
- * const config: PlaywrightTestConfig = {
244
- * use: {
245
- * contextOptions: {
246
- * defaultNavigationTimeout: 30_000,
247
- * }
248
- *
249
- * // Custom cast of actors receives `contextOptions` with the
250
- * // additional Serenity/JS properties.
251
- * actors: ({ browser, contextOptions }, use) => {
252
- * const cast = Cast.where(actor => actor.whoCan(
253
- * BrowseTheWebWithPlaywright.using(browser, contextOptions),
254
- * TakeNotes.usingAnEmptyNotepad(),
255
- * ))
256
- *
257
- * use(cast)
258
- * },
259
- * },
260
- * };
261
- * export default config;
262
- * ```
263
- *
264
- * #### Learn more
265
- * - [`SerenityFixtures`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/)
266
- * - [Playwright Browser Context options](https://playwright.dev/docs/api/class-testoptions#test-options-context-options)
267
- * - [Playwright Test fixtures](https://playwright.dev/docs/test-fixtures)
268
- */
269
- contextOptions: PlaywrightOptions;
270
- }
271
- //# sourceMappingURL=SerenityOptions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SerenityOptions.d.ts","sourceRoot":"","sources":["../../src/api/SerenityOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AACnH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AACH,MAAM,WAAW,eAAe;IAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8DG;IACH,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,qBAAqB,GAAG,oBAAoB,CAAC,CAAA;IAEvE;;;;;;;OAOG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,IAAI,EAAE,KAAK,CAAC,gBAAgB,GAAG,eAAe,GAAG,sBAAsB,CAAC,CAAC;IAEzE;;;;;;;;OAQG;IACH,UAAU,EAAE,MAAM,GAAG,QAAQ,CAAC;IAE9B;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,QAAQ,CAAC;IAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8DG;IACH,cAAc,EAAE,iBAAiB,CAAC;CACrC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SerenityOptions.js","sourceRoot":"","sources":["../../src/api/SerenityOptions.ts"],"names":[],"mappings":""}
@@ -1,11 +0,0 @@
1
- import type { Stage, StageCrewMember } from '@serenity-js/core';
2
- import type { DomainEvent } from '@serenity-js/core/lib/events';
3
- export declare class DomainEventBuffer implements StageCrewMember {
4
- private stage?;
5
- private events;
6
- constructor(stage?: Stage);
7
- assignedTo(stage: Stage): StageCrewMember;
8
- notifyOf(event: DomainEvent): void;
9
- flush(): DomainEvent[];
10
- }
11
- //# sourceMappingURL=DomainEventBuffer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DomainEventBuffer.d.ts","sourceRoot":"","sources":["../../src/reporter/DomainEventBuffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE,qBAAa,iBAAkB,YAAW,eAAe;IAIzC,OAAO,CAAC,KAAK,CAAC;IAF1B,OAAO,CAAC,MAAM,CAAqB;gBAEf,KAAK,CAAC,EAAE,KAAK;IAGjC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe;IAMzC,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAIlC,KAAK,IAAI,WAAW,EAAE;CAOzB"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DomainEventBuffer = void 0;
4
- class DomainEventBuffer {
5
- stage;
6
- events = [];
7
- constructor(stage) {
8
- this.stage = stage;
9
- }
10
- assignedTo(stage) {
11
- this.stage = stage;
12
- return this;
13
- }
14
- notifyOf(event) {
15
- this.events.push(event);
16
- }
17
- flush() {
18
- const events = [...this.events];
19
- this.events = [];
20
- return events;
21
- }
22
- }
23
- exports.DomainEventBuffer = DomainEventBuffer;
24
- //# sourceMappingURL=DomainEventBuffer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DomainEventBuffer.js","sourceRoot":"","sources":["../../src/reporter/DomainEventBuffer.ts"],"names":[],"mappings":";;;AAGA,MAAa,iBAAiB;IAIN;IAFZ,MAAM,GAAkB,EAAE,CAAC;IAEnC,YAAoB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IACjC,CAAC;IAED,UAAU,CAAC,KAAY;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ,CAAC,KAAkB;QACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK;QACD,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QAEhC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QAEjB,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAxBD,8CAwBC"}
@@ -1,2 +0,0 @@
1
- export declare const SERENITY_JS_DOMAIN_EVENTS_ATTACHMENT_CONTENT_TYPE = "application/vnd.serenity-js.domain-events+json";
2
- //# sourceMappingURL=PlaywrightAttachments.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlaywrightAttachments.d.ts","sourceRoot":"","sources":["../../src/reporter/PlaywrightAttachments.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iDAAiD,mDAAmD,CAAC"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SERENITY_JS_DOMAIN_EVENTS_ATTACHMENT_CONTENT_TYPE = void 0;
4
- exports.SERENITY_JS_DOMAIN_EVENTS_ATTACHMENT_CONTENT_TYPE = 'application/vnd.serenity-js.domain-events+json';
5
- //# sourceMappingURL=PlaywrightAttachments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlaywrightAttachments.js","sourceRoot":"","sources":["../../src/reporter/PlaywrightAttachments.ts"],"names":[],"mappings":";;;AAAa,QAAA,iDAAiD,GAAG,gDAAgD,CAAC"}
@@ -1,132 +0,0 @@
1
- import type { 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 [test scenarios](https://serenity-js.org/api/playwright-test/function/it/).
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 [test scenario](https://serenity-js.org/api/playwright-test/function/it/)
42
- * - [Grouping test scenarios](https://serenity-js.org/api/playwright-test/function/describe/)
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 [`actor`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/#actor)
60
- * and invoking [`actorCalled`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/#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.where(actor =>
76
- * actor.whoCan(
77
- * BrowseTheWebWithPlaywright.using(browser, contextOptions),
78
- * TakeNotes.usingAnEmptyNotepad(),
79
- * )
80
- * )
81
- *
82
- * // Make sure to pass your custom cast to Playwright `use` callback
83
- * use(cast)
84
- * },
85
- * })
86
- *
87
- * describe(`Todo List App`, () => {
88
- *
89
- * it(`should allow me to add a todo item`, async ({ actor }) => {
90
- * await actor.attemptsTo(
91
- * startWithAnEmptyList(),
92
- *
93
- * recordItem('Buy some milk'),
94
- *
95
- * Ensure.that(itemNames(), equals([
96
- * 'Buy some milk',
97
- * ])),
98
- * )
99
- * })
100
- * })
101
- * })
102
- * ```
103
- */
104
- actors: Cast;
105
-
106
- /**
107
- * Uses the provided [cast](https://serenity-js.org/api/core/class/Cast/) of [`actors`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/#actors) to instantiate an [`Actor`](https://serenity-js.org/api/core/class/Actor/) called `name`
108
- * and inject it into a [test scenario](https://serenity-js.org/api/playwright-test/function/it/).
109
- *
110
- * Retrieves an existing actor if one has already been instantiated.
111
- *
112
- * #### Learn more
113
- * - Declaring a Serenity/JS [test scenario](https://serenity-js.org/api/playwright-test/function/it/)
114
- * - [`SerenityOptions.actors`](https://serenity-js.org/api/playwright-test/interface/SerenityOptions/#actors)
115
- * - [`SerenityFixtures.actors`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/#actors)
116
- *
117
- * @param name
118
- */
119
- actorCalled: (name: string) => Actor;
120
-
121
- /**
122
- * Default [`actor`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/#actor) injected into a [test scenario](https://serenity-js.org/api/playwright-test/function/it/).
123
- *
124
- * Using `actor` fixture is equivalent to invoking [`actorCalled`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/#actorCalled) with [`defaultActorName`](https://serenity-js.org/api/playwright-test/interface/SerenityOptions/#defaultActorName).
125
- *
126
- * #### Learn more
127
- * - [`actorCalled`](https://serenity-js.org/api/playwright-test/interface/SerenityFixtures/#actorCalled)
128
- * - [`SerenityOptions.defaultActorName`](https://serenity-js.org/api/playwright-test/interface/SerenityOptions/#defaultActorName)
129
- * - Declaring a Serenity/JS [test scenario](https://serenity-js.org/api/playwright-test/function/it/)
130
- */
131
- actor: Actor;
132
- }