@serenity-js/playwright-test 3.10.2 → 3.10.4
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 +23 -0
- package/README.md +54 -0
- package/lib/api/DescribeFunction.d.ts +235 -0
- package/lib/api/DescribeFunction.d.ts.map +1 -0
- package/lib/api/DescribeFunction.js +3 -0
- package/lib/api/DescribeFunction.js.map +1 -0
- package/lib/api/SuiteFunction.d.ts +51 -0
- package/lib/api/SuiteFunction.d.ts.map +1 -0
- package/lib/api/SuiteFunction.js +3 -0
- package/lib/api/SuiteFunction.js.map +1 -0
- package/lib/api/index.d.ts +2 -0
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +2 -0
- package/lib/api/index.js.map +1 -1
- package/lib/api/test-api.d.ts +19 -7
- package/lib/api/test-api.d.ts.map +1 -1
- package/lib/api/test-api.js.map +1 -1
- package/package.json +6 -6
- package/src/api/DescribeFunction.ts +233 -0
- package/src/api/SuiteFunction.ts +52 -0
- package/src/api/index.ts +2 -0
- package/src/api/test-api.ts +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
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.10.4](https://github.com/serenity-js/serenity-js/compare/v3.10.3...v3.10.4) (2023-09-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **deps:** update playwright dependencies to ^1.38.1 ([0072ddb](https://github.com/serenity-js/serenity-js/commit/0072ddbe42cc147e9cce5a7bca79bc87c707e1ce))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [3.10.3](https://github.com/serenity-js/serenity-js/compare/v3.10.2...v3.10.3) (2023-09-15)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **deps:** update playwright dependencies to ^1.38.0 ([0b8074b](https://github.com/serenity-js/serenity-js/commit/0b8074b19155a38aa2009049d9a395b7026d12b3))
|
|
23
|
+
* **playwright-test:** simplified and documented implementing custom Playwright Test fixtures ([61fc2bc](https://github.com/serenity-js/serenity-js/commit/61fc2bce72c9758658851949afac84d573698677)), closes [microsoft/playwright#24146](https://github.com/microsoft/playwright/issues/24146)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
## [3.10.2](https://github.com/serenity-js/serenity-js/compare/v3.10.1...v3.10.2) (2023-09-10)
|
|
7
30
|
|
|
8
31
|
|
package/README.md
CHANGED
|
@@ -228,6 +228,60 @@ test.use({
|
|
|
228
228
|
})
|
|
229
229
|
```
|
|
230
230
|
|
|
231
|
+
#### Customising test fixtures
|
|
232
|
+
|
|
233
|
+
[`useFixtures`](https://serenity-js.org/api/playwright-test/function/useFixtures/) lets you configure
|
|
234
|
+
Serenity/JS Screenplay Pattern actors in a single place,
|
|
235
|
+
and define custom [test fixtures](https://playwright.dev/docs/test-fixtures) if needed.
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
// my-custom-api.ts
|
|
239
|
+
export const {
|
|
240
|
+
describe, it, test, beforeAll, beforeEach, afterEach, afterAll, expect
|
|
241
|
+
} = useFixtures<{ email: string }>({
|
|
242
|
+
|
|
243
|
+
// Override Serenity/JS fixtures:
|
|
244
|
+
actors: async ({ browser, baseURL }, use) => {
|
|
245
|
+
await use(
|
|
246
|
+
Cast.where(actor => actor.whoCan(
|
|
247
|
+
BrowseTheWebWithPlaywright.using(browser),
|
|
248
|
+
TakeNotes.usingAnEmptyNotepad(),
|
|
249
|
+
CallAnApi.at(baseURL),
|
|
250
|
+
))
|
|
251
|
+
)
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
// Add your own fixtures:
|
|
255
|
+
email: async ({ actor }, use) => {
|
|
256
|
+
await use(`${ actor.name }@example.org`);
|
|
257
|
+
},
|
|
258
|
+
})
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
With the custom test API definition in place, use it in your test files instead of the default one:
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
// example.spec.ts
|
|
265
|
+
import { Log } from '@serenity-js/core'
|
|
266
|
+
|
|
267
|
+
import { describe, it, test } from './my-custom-api' // Note the custom test API
|
|
268
|
+
|
|
269
|
+
describe('Serenity Screenplay with Playwright', () => {
|
|
270
|
+
|
|
271
|
+
describe('New Todo', () => {
|
|
272
|
+
|
|
273
|
+
// inject default actor:
|
|
274
|
+
it('should allow me to add todo items', async ({ actor, email }) => {
|
|
275
|
+
|
|
276
|
+
// define test workflow
|
|
277
|
+
await actor.attemptsTo(
|
|
278
|
+
Log.the(email),
|
|
279
|
+
)
|
|
280
|
+
})
|
|
281
|
+
})
|
|
282
|
+
})
|
|
283
|
+
```
|
|
284
|
+
|
|
231
285
|
### UI Component Testing
|
|
232
286
|
|
|
233
287
|
You can use Serenity/JS and Playwright Test to write UI component tests and **reuse your test code** between component and end-to-end test suites.
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import type { SuiteFunction } from './SuiteFunction';
|
|
2
|
+
export type DescribeFunction = SuiteFunction & {
|
|
3
|
+
/**
|
|
4
|
+
* Declares a focused group of tests. If there are some focused tests or suites, all of them will be run but nothing
|
|
5
|
+
* else.
|
|
6
|
+
*
|
|
7
|
+
* **Usage**
|
|
8
|
+
*
|
|
9
|
+
* ```js
|
|
10
|
+
* test.describe.only('focused group', () => {
|
|
11
|
+
* test('in the focused group', async ({ page }) => {
|
|
12
|
+
* // This test will run
|
|
13
|
+
* });
|
|
14
|
+
* });
|
|
15
|
+
* test('not in the focused group', async ({ page }) => {
|
|
16
|
+
* // This test will not run
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @param title Group title.
|
|
21
|
+
* @param callback A callback that is run immediately when calling
|
|
22
|
+
* [test.describe.only(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-only). Any tests
|
|
23
|
+
* added in this callback will belong to the group.
|
|
24
|
+
*/
|
|
25
|
+
only: SuiteFunction;
|
|
26
|
+
/**
|
|
27
|
+
* Declares a skipped test group, similarly to
|
|
28
|
+
* [test.describe(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-1). Tests in the skipped
|
|
29
|
+
* group are never run.
|
|
30
|
+
*
|
|
31
|
+
* **Usage**
|
|
32
|
+
*
|
|
33
|
+
* ```js
|
|
34
|
+
* test.describe.skip('skipped group', () => {
|
|
35
|
+
* test('example', async ({ page }) => {
|
|
36
|
+
* // This test will not run
|
|
37
|
+
* });
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @param title Group title.
|
|
42
|
+
* @param callback A callback that is run immediately when calling
|
|
43
|
+
* [test.describe.skip(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-skip). Any tests
|
|
44
|
+
* added in this callback will belong to the group, and will not be run.
|
|
45
|
+
*/
|
|
46
|
+
skip: SuiteFunction;
|
|
47
|
+
/**
|
|
48
|
+
* Declares a test group similarly to
|
|
49
|
+
* [test.describe(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-1). Tests in this group
|
|
50
|
+
* are marked as "fixme" and will not be executed.
|
|
51
|
+
*
|
|
52
|
+
* **Usage**
|
|
53
|
+
*
|
|
54
|
+
* ```js
|
|
55
|
+
* test.describe.fixme('broken tests', () => {
|
|
56
|
+
* test('example', async ({ page }) => {
|
|
57
|
+
* // This test will not run
|
|
58
|
+
* });
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @param title Group title.
|
|
63
|
+
* @param callback A callback that is run immediately when calling
|
|
64
|
+
* [test.describe.fixme(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-fixme). Any tests
|
|
65
|
+
* added in this callback will belong to the group, and will not be run.
|
|
66
|
+
*/
|
|
67
|
+
fixme: SuiteFunction;
|
|
68
|
+
/**
|
|
69
|
+
* **NOTE** See [test.describe.configure([options])](https://playwright.dev/docs/api/class-test#test-describe-configure) for
|
|
70
|
+
* the preferred way of configuring the execution mode.
|
|
71
|
+
*
|
|
72
|
+
* Declares a group of tests that should always be run serially. If one of the tests fails, all subsequent tests are
|
|
73
|
+
* skipped. All tests in a group are retried together.
|
|
74
|
+
*
|
|
75
|
+
* **NOTE** Using serial is not recommended. It is usually better to make your tests isolated, so they can be run
|
|
76
|
+
* independently.
|
|
77
|
+
*
|
|
78
|
+
* **Usage**
|
|
79
|
+
*
|
|
80
|
+
* ```js
|
|
81
|
+
* test.describe.serial('group', () => {
|
|
82
|
+
* test('runs first', async ({ page }) => {});
|
|
83
|
+
* test('runs second', async ({ page }) => {});
|
|
84
|
+
* });
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @param title Group title.
|
|
88
|
+
* @param callback A callback that is run immediately when calling
|
|
89
|
+
* [test.describe.serial(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-serial). Any tests
|
|
90
|
+
* added in this callback will belong to the group.
|
|
91
|
+
*/
|
|
92
|
+
serial: SuiteFunction & {
|
|
93
|
+
/**
|
|
94
|
+
* **NOTE** See [test.describe.configure([options])](https://playwright.dev/docs/api/class-test#test-describe-configure) for
|
|
95
|
+
* the preferred way of configuring the execution mode.
|
|
96
|
+
*
|
|
97
|
+
* Declares a focused group of tests that should always be run serially. If one of the tests fails, all subsequent
|
|
98
|
+
* tests are skipped. All tests in a group are retried together. If there are some focused tests or suites, all of
|
|
99
|
+
* them will be run but nothing else.
|
|
100
|
+
*
|
|
101
|
+
* **NOTE** Using serial is not recommended. It is usually better to make your tests isolated, so they can be run
|
|
102
|
+
* independently.
|
|
103
|
+
*
|
|
104
|
+
* **Usage**
|
|
105
|
+
*
|
|
106
|
+
* ```js
|
|
107
|
+
* test.describe.serial.only('group', () => {
|
|
108
|
+
* test('runs first', async ({ page }) => {
|
|
109
|
+
* });
|
|
110
|
+
* test('runs second', async ({ page }) => {
|
|
111
|
+
* });
|
|
112
|
+
* });
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @param title Group title.
|
|
116
|
+
* @param callback A callback that is run immediately when calling
|
|
117
|
+
* [test.describe.serial.only(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-serial-only).
|
|
118
|
+
* Any tests added in this callback will belong to the group.
|
|
119
|
+
*/
|
|
120
|
+
only: SuiteFunction;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* **NOTE** See [test.describe.configure([options])](https://playwright.dev/docs/api/class-test#test-describe-configure) for
|
|
124
|
+
* the preferred way of configuring the execution mode.
|
|
125
|
+
*
|
|
126
|
+
* Declares a group of tests that could be run in parallel. By default, tests in a single test file run one after
|
|
127
|
+
* another, but using
|
|
128
|
+
* [test.describe.parallel(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel) allows
|
|
129
|
+
* them to run in parallel.
|
|
130
|
+
*
|
|
131
|
+
* **Usage**
|
|
132
|
+
*
|
|
133
|
+
* ```js
|
|
134
|
+
* test.describe.parallel('group', () => {
|
|
135
|
+
* test('runs in parallel 1', async ({ page }) => {});
|
|
136
|
+
* test('runs in parallel 2', async ({ page }) => {});
|
|
137
|
+
* });
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* Note that parallel tests are executed in separate processes and cannot share any state or global variables. Each of
|
|
141
|
+
* the parallel tests executes all relevant hooks.
|
|
142
|
+
* @param title Group title.
|
|
143
|
+
* @param callback A callback that is run immediately when calling
|
|
144
|
+
* [test.describe.parallel(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel). Any
|
|
145
|
+
* tests added in this callback will belong to the group.
|
|
146
|
+
*/
|
|
147
|
+
parallel: SuiteFunction & {
|
|
148
|
+
/**
|
|
149
|
+
* **NOTE** See [test.describe.configure([options])](https://playwright.dev/docs/api/class-test#test-describe-configure) for
|
|
150
|
+
* the preferred way of configuring the execution mode.
|
|
151
|
+
*
|
|
152
|
+
* Declares a focused group of tests that could be run in parallel. This is similar to
|
|
153
|
+
* [test.describe.parallel(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel), but
|
|
154
|
+
* focuses the group. If there are some focused tests or suites, all of them will be run but nothing else.
|
|
155
|
+
*
|
|
156
|
+
* **Usage**
|
|
157
|
+
*
|
|
158
|
+
* ```js
|
|
159
|
+
* test.describe.parallel.only('group', () => {
|
|
160
|
+
* test('runs in parallel 1', async ({ page }) => {});
|
|
161
|
+
* test('runs in parallel 2', async ({ page }) => {});
|
|
162
|
+
* });
|
|
163
|
+
* ```
|
|
164
|
+
*
|
|
165
|
+
* @param title Group title.
|
|
166
|
+
* @param callback A callback that is run immediately when calling
|
|
167
|
+
* [test.describe.parallel.only(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel-only).
|
|
168
|
+
* Any tests added in this callback will belong to the group.
|
|
169
|
+
*/
|
|
170
|
+
only: SuiteFunction;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Configures the enclosing scope. Can be executed either on the top level or inside a describe. Configuration applies
|
|
174
|
+
* to the entire scope, regardless of whether it run before or after the test declaration.
|
|
175
|
+
*
|
|
176
|
+
* Learn more about the execution modes [here](https://playwright.dev/docs/test-parallel).
|
|
177
|
+
*
|
|
178
|
+
* **Usage**
|
|
179
|
+
* - Running tests in parallel.
|
|
180
|
+
*
|
|
181
|
+
* ```js
|
|
182
|
+
* // Run all the tests in the file concurrently using parallel workers.
|
|
183
|
+
* test.describe.configure({ mode: 'parallel' });
|
|
184
|
+
* test('runs in parallel 1', async ({ page }) => {});
|
|
185
|
+
* test('runs in parallel 2', async ({ page }) => {});
|
|
186
|
+
* ```
|
|
187
|
+
*
|
|
188
|
+
* - Running tests serially, retrying from the start.
|
|
189
|
+
*
|
|
190
|
+
* **NOTE** Running serially is not recommended. It is usually better to make your tests isolated, so they can be
|
|
191
|
+
* run independently.
|
|
192
|
+
*
|
|
193
|
+
* ```js
|
|
194
|
+
* // Annotate tests as inter-dependent.
|
|
195
|
+
* test.describe.configure({ mode: 'serial' });
|
|
196
|
+
* test('runs first', async ({ page }) => {});
|
|
197
|
+
* test('runs second', async ({ page }) => {});
|
|
198
|
+
* ```
|
|
199
|
+
*
|
|
200
|
+
* - Configuring retries and timeout for each test.
|
|
201
|
+
*
|
|
202
|
+
* ```js
|
|
203
|
+
* // Each test in the file will be retried twice and have a timeout of 20 seconds.
|
|
204
|
+
* test.describe.configure({ retries: 2, timeout: 20_000 });
|
|
205
|
+
* test('runs first', async ({ page }) => {});
|
|
206
|
+
* test('runs second', async ({ page }) => {});
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* - Run multiple describes in parallel, but tests inside each describe in order.
|
|
210
|
+
*
|
|
211
|
+
* ```js
|
|
212
|
+
* test.describe.configure({ mode: 'parallel' });
|
|
213
|
+
*
|
|
214
|
+
* test.describe('A, runs in parallel with B', () => {
|
|
215
|
+
* test.describe.configure({ mode: 'default' });
|
|
216
|
+
* test('in order A1', async ({ page }) => {});
|
|
217
|
+
* test('in order A2', async ({ page }) => {});
|
|
218
|
+
* });
|
|
219
|
+
*
|
|
220
|
+
* test.describe('B, runs in parallel with A', () => {
|
|
221
|
+
* test.describe.configure({ mode: 'default' });
|
|
222
|
+
* test('in order B1', async ({ page }) => {});
|
|
223
|
+
* test('in order B2', async ({ page }) => {});
|
|
224
|
+
* });
|
|
225
|
+
* ```
|
|
226
|
+
*
|
|
227
|
+
* @param options
|
|
228
|
+
*/
|
|
229
|
+
configure: (options: {
|
|
230
|
+
mode?: 'default' | 'parallel' | 'serial';
|
|
231
|
+
retries?: number;
|
|
232
|
+
timeout?: number;
|
|
233
|
+
}) => void;
|
|
234
|
+
};
|
|
235
|
+
//# sourceMappingURL=DescribeFunction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DescribeFunction.d.ts","sourceRoot":"","sources":["../../src/api/DescribeFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC3C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,IAAI,EAAE,aAAa,CAAC;IACpB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,EAAE,aAAa,CAAC;IACpB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,EAAE,aAAa,CAAC;IACrB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,EAAE,aAAa,GAAG;QACpB;;;;;;;;;;;;;;;;;;;;;;;;;;WA0BG;QACH,IAAI,EAAE,aAAa,CAAC;KACvB,CAAC;IACF;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,QAAQ,EAAE,aAAa,GAAG;QACtB;;;;;;;;;;;;;;;;;;;;;WAqBG;QACH,IAAI,EAAE,aAAa,CAAC;KACvB,CAAC;IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAClH,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DescribeFunction.js","sourceRoot":"","sources":["../../src/api/DescribeFunction.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface SuiteFunction {
|
|
2
|
+
/**
|
|
3
|
+
* Declares a group of tests.
|
|
4
|
+
*
|
|
5
|
+
* **Usage**
|
|
6
|
+
*
|
|
7
|
+
* ```js
|
|
8
|
+
* test.describe('two tests', () => {
|
|
9
|
+
* test('one', async ({ page }) => {
|
|
10
|
+
* // ...
|
|
11
|
+
* });
|
|
12
|
+
*
|
|
13
|
+
* test('two', async ({ page }) => {
|
|
14
|
+
* // ...
|
|
15
|
+
* });
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param title Group title.
|
|
20
|
+
* @param callback A callback that is run immediately when calling
|
|
21
|
+
* [test.describe(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-1). Any tests added in
|
|
22
|
+
* this callback will belong to the group.
|
|
23
|
+
*/
|
|
24
|
+
(title: string, callback: () => void): void;
|
|
25
|
+
/**
|
|
26
|
+
* Declares an anonymous group of tests. This is convenient to give a group of tests a common option with
|
|
27
|
+
* [test.use(options)](https://playwright.dev/docs/api/class-test#test-use).
|
|
28
|
+
*
|
|
29
|
+
* **Usage**
|
|
30
|
+
*
|
|
31
|
+
* ```js
|
|
32
|
+
* test.describe(() => {
|
|
33
|
+
* test.use({ colorScheme: 'dark' });
|
|
34
|
+
*
|
|
35
|
+
* test('one', async ({ page }) => {
|
|
36
|
+
* // ...
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* test('two', async ({ page }) => {
|
|
40
|
+
* // ...
|
|
41
|
+
* });
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @param callback A callback that is run immediately when calling
|
|
46
|
+
* [test.describe(callback)](https://playwright.dev/docs/api/class-test#test-describe-2). Any tests added in this
|
|
47
|
+
* callback will belong to the group.
|
|
48
|
+
*/
|
|
49
|
+
(callback: () => void): void;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=SuiteFunction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SuiteFunction.d.ts","sourceRoot":"","sources":["../../src/api/SuiteFunction.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC1B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAC5C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SuiteFunction.js","sourceRoot":"","sources":["../../src/api/SuiteFunction.ts"],"names":[],"mappings":""}
|
package/lib/api/index.d.ts
CHANGED
package/lib/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
|
package/lib/api/index.js
CHANGED
|
@@ -14,8 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DescribeFunction"), exports);
|
|
17
18
|
__exportStar(require("./PlaywrightTestConfig"), exports);
|
|
18
19
|
__exportStar(require("./SerenityFixtures"), exports);
|
|
19
20
|
__exportStar(require("./SerenityOptions"), exports);
|
|
21
|
+
__exportStar(require("./SuiteFunction"), exports);
|
|
20
22
|
__exportStar(require("./test-api"), exports);
|
|
21
23
|
//# sourceMappingURL=index.js.map
|
package/lib/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,qDAAmC;AACnC,oDAAkC;AAClC,6CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,yDAAuC;AACvC,qDAAmC;AACnC,oDAAkC;AAClC,kDAAgC;AAChC,6CAA2B"}
|
package/lib/api/test-api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, TestInfo, TestType } from '@playwright/test';
|
|
2
|
-
import {
|
|
2
|
+
import type { DescribeFunction } from './DescribeFunction';
|
|
3
3
|
import type { SerenityFixtures } from './SerenityFixtures';
|
|
4
4
|
import type { SerenityOptions } from './SerenityOptions';
|
|
5
5
|
export declare const fixtures: Fixtures<Omit<SerenityOptions, 'actors'> & SerenityFixtures, object, PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
|
|
@@ -34,7 +34,7 @@ export type TestApi<TestArgs extends Record<string, any>, WorkerArgs extends Rec
|
|
|
34
34
|
useFixtures: <T extends Record<string, any>, W extends Record<string, any> = object>(customFixtures: Fixtures<T, W, TestArgs, WorkerArgs>) => TestApi<TestArgs & T, WorkerArgs & W>;
|
|
35
35
|
it: TestType<TestArgs, WorkerArgs>;
|
|
36
36
|
test: TestType<TestArgs, WorkerArgs>;
|
|
37
|
-
describe:
|
|
37
|
+
describe: DescribeFunction;
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
40
|
* Declares a single test scenario.
|
|
@@ -146,11 +146,23 @@ export declare const test: TestType<PlaywrightTestArgs & PlaywrightTestOptions &
|
|
|
146
146
|
* - [Playwright Test `describe` function](https://playwright.dev/docs/api/class-test#test-describe-1)
|
|
147
147
|
* - [Serenity/JS + Playwright Test project template](https://github.com/serenity-js/serenity-js-playwright-test-template/)
|
|
148
148
|
*/
|
|
149
|
-
export declare const describe:
|
|
150
|
-
export declare const beforeAll:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
export declare const describe: DescribeFunction;
|
|
150
|
+
export declare const beforeAll: {
|
|
151
|
+
(inner: (args: PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, "actors"> & SerenityFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions & object, testInfo: TestInfo) => any): void;
|
|
152
|
+
(title: string, inner: (args: PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, "actors"> & SerenityFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions & object, testInfo: TestInfo) => any): void;
|
|
153
|
+
};
|
|
154
|
+
export declare const beforeEach: {
|
|
155
|
+
(inner: (args: PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, "actors"> & SerenityFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions & object, testInfo: TestInfo) => any): void;
|
|
156
|
+
(title: string, inner: (args: PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, "actors"> & SerenityFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions & object, testInfo: TestInfo) => any): void;
|
|
157
|
+
};
|
|
158
|
+
export declare const afterEach: {
|
|
159
|
+
(inner: (args: PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, "actors"> & SerenityFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions & object, testInfo: TestInfo) => any): void;
|
|
160
|
+
(title: string, inner: (args: PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, "actors"> & SerenityFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions & object, testInfo: TestInfo) => any): void;
|
|
161
|
+
};
|
|
162
|
+
export declare const afterAll: {
|
|
163
|
+
(inner: (args: PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, "actors"> & SerenityFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions & object, testInfo: TestInfo) => any): void;
|
|
164
|
+
(title: string, inner: (args: PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, "actors"> & SerenityFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions & object, testInfo: TestInfo) => any): void;
|
|
165
|
+
};
|
|
154
166
|
export declare const expect: import("@playwright/test").Expect;
|
|
155
167
|
export declare const useFixtures: <T extends Record<string, any>, W extends Record<string, any> = object>(customFixtures: Fixtures<T, W, PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, "actors"> & SerenityFixtures, PlaywrightWorkerArgs & PlaywrightWorkerOptions & object>) => TestApi<PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, "actors"> & SerenityFixtures & T, PlaywrightWorkerArgs & PlaywrightWorkerOptions & object & W>;
|
|
156
168
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-api.d.ts","sourceRoot":"","sources":["../../src/api/test-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,QAAQ,EACR,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,EACR,QAAQ,EACX,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"test-api.d.ts","sourceRoot":"","sources":["../../src/api/test-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,QAAQ,EACR,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,EACR,QAAQ,EACX,MAAM,kBAAkB,CAAC;AAgB1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,gBAAgB,EAAE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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,eAAO,MAAM,QAAQ,kBAAe,CAAC;AAErC,eAAO,MAAM,SAAS;;;CAAgB,CAAC;AAEvC,eAAO,MAAM,UAAU;;;CAAiB,CAAC;AAEzC,eAAO,MAAM,SAAS;;;CAAgB,CAAC;AAEvC,eAAO,MAAM,QAAQ;;;CAAe,CAAC;AAErC,eAAO,MAAM,MAAM,mCAAa,CAAC;AAEjC,eAAO,MAAM,WAAW,gbAAkB,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyIG;AACH,wBAAgB,OAAO,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,EACzG,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,GACzC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,GAAG,gBAAgB,GAAG,QAAQ,EAAE,UAAU,CAAC,CAGpF"}
|
package/lib/api/test-api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-api.js","sourceRoot":"","sources":["../../src/api/test-api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AASA,
|
|
1
|
+
{"version":3,"file":"test-api.js","sourceRoot":"","sources":["../../src/api/test-api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AASA,2CAA8D;AAC9D,4CAA+G;AAC/G,yDAA0E;AAC1E,uDAAsE;AACtE,wDAA8F;AAC9F,0CAAsE;AACtE,uCAAyB;AAEzB,2CAA0D;AAE1D,0CAIqB;AAErB,6FAA0F;AAI1F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,CAAC,QAAQ,CAAC;AAExB,QAAA,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;AAEpB,QAAA,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyIG;AACH,SAAgB,OAAO,CACnB,QAAwC;IAExC,OAAO,aAAa,CAAC,QAAQ,CAAC;SACzB,WAAW,CAA4E,gBAAQ,CAAC,CAAC;AAC1G,CAAC;AALD,0BAKC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,aAAgC;IAChD,OAAO,aAAa,YAAY,eAAQ;QACpC,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,eAAQ,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;AACjD,CAAC;AAED;;;GAGG;AACH,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/playwright-test",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.4",
|
|
4
4
|
"description": "Serenity/JS reporter and test APIs for Playwright Test",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"node": "^16.13 || ^18.12 || ^20"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@playwright/test": "^1.
|
|
48
|
-
"@serenity-js/core": "3.10.
|
|
49
|
-
"@serenity-js/playwright": "3.10.
|
|
50
|
-
"@serenity-js/web": "3.10.
|
|
47
|
+
"@playwright/test": "^1.38.1",
|
|
48
|
+
"@serenity-js/core": "3.10.4",
|
|
49
|
+
"@serenity-js/playwright": "3.10.4",
|
|
50
|
+
"@serenity-js/web": "3.10.4",
|
|
51
51
|
"deepmerge": "^4.3.1",
|
|
52
52
|
"tiny-types": "^1.20.0"
|
|
53
53
|
},
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"ts-node": "^10.9.1",
|
|
62
62
|
"typescript": "5.1.6"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "28f12bd6029a9a6c1d8e492486138bf0c83916cd"
|
|
65
65
|
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import type { SuiteFunction } from './SuiteFunction';
|
|
2
|
+
|
|
3
|
+
// Playwright Test doesn't export all its public APIs, hence the need for this workaround
|
|
4
|
+
// See https://github.com/microsoft/playwright/pull/24146
|
|
5
|
+
export type DescribeFunction = SuiteFunction & {
|
|
6
|
+
/**
|
|
7
|
+
* Declares a focused group of tests. If there are some focused tests or suites, all of them will be run but nothing
|
|
8
|
+
* else.
|
|
9
|
+
*
|
|
10
|
+
* **Usage**
|
|
11
|
+
*
|
|
12
|
+
* ```js
|
|
13
|
+
* test.describe.only('focused group', () => {
|
|
14
|
+
* test('in the focused group', async ({ page }) => {
|
|
15
|
+
* // This test will run
|
|
16
|
+
* });
|
|
17
|
+
* });
|
|
18
|
+
* test('not in the focused group', async ({ page }) => {
|
|
19
|
+
* // This test will not run
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @param title Group title.
|
|
24
|
+
* @param callback A callback that is run immediately when calling
|
|
25
|
+
* [test.describe.only(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-only). Any tests
|
|
26
|
+
* added in this callback will belong to the group.
|
|
27
|
+
*/
|
|
28
|
+
only: SuiteFunction;
|
|
29
|
+
/**
|
|
30
|
+
* Declares a skipped test group, similarly to
|
|
31
|
+
* [test.describe(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-1). Tests in the skipped
|
|
32
|
+
* group are never run.
|
|
33
|
+
*
|
|
34
|
+
* **Usage**
|
|
35
|
+
*
|
|
36
|
+
* ```js
|
|
37
|
+
* test.describe.skip('skipped group', () => {
|
|
38
|
+
* test('example', async ({ page }) => {
|
|
39
|
+
* // This test will not run
|
|
40
|
+
* });
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param title Group title.
|
|
45
|
+
* @param callback A callback that is run immediately when calling
|
|
46
|
+
* [test.describe.skip(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-skip). Any tests
|
|
47
|
+
* added in this callback will belong to the group, and will not be run.
|
|
48
|
+
*/
|
|
49
|
+
skip: SuiteFunction;
|
|
50
|
+
/**
|
|
51
|
+
* Declares a test group similarly to
|
|
52
|
+
* [test.describe(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-1). Tests in this group
|
|
53
|
+
* are marked as "fixme" and will not be executed.
|
|
54
|
+
*
|
|
55
|
+
* **Usage**
|
|
56
|
+
*
|
|
57
|
+
* ```js
|
|
58
|
+
* test.describe.fixme('broken tests', () => {
|
|
59
|
+
* test('example', async ({ page }) => {
|
|
60
|
+
* // This test will not run
|
|
61
|
+
* });
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @param title Group title.
|
|
66
|
+
* @param callback A callback that is run immediately when calling
|
|
67
|
+
* [test.describe.fixme(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-fixme). Any tests
|
|
68
|
+
* added in this callback will belong to the group, and will not be run.
|
|
69
|
+
*/
|
|
70
|
+
fixme: SuiteFunction;
|
|
71
|
+
/**
|
|
72
|
+
* **NOTE** See [test.describe.configure([options])](https://playwright.dev/docs/api/class-test#test-describe-configure) for
|
|
73
|
+
* the preferred way of configuring the execution mode.
|
|
74
|
+
*
|
|
75
|
+
* Declares a group of tests that should always be run serially. If one of the tests fails, all subsequent tests are
|
|
76
|
+
* skipped. All tests in a group are retried together.
|
|
77
|
+
*
|
|
78
|
+
* **NOTE** Using serial is not recommended. It is usually better to make your tests isolated, so they can be run
|
|
79
|
+
* independently.
|
|
80
|
+
*
|
|
81
|
+
* **Usage**
|
|
82
|
+
*
|
|
83
|
+
* ```js
|
|
84
|
+
* test.describe.serial('group', () => {
|
|
85
|
+
* test('runs first', async ({ page }) => {});
|
|
86
|
+
* test('runs second', async ({ page }) => {});
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @param title Group title.
|
|
91
|
+
* @param callback A callback that is run immediately when calling
|
|
92
|
+
* [test.describe.serial(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-serial). Any tests
|
|
93
|
+
* added in this callback will belong to the group.
|
|
94
|
+
*/
|
|
95
|
+
serial: SuiteFunction & {
|
|
96
|
+
/**
|
|
97
|
+
* **NOTE** See [test.describe.configure([options])](https://playwright.dev/docs/api/class-test#test-describe-configure) for
|
|
98
|
+
* the preferred way of configuring the execution mode.
|
|
99
|
+
*
|
|
100
|
+
* Declares a focused group of tests that should always be run serially. If one of the tests fails, all subsequent
|
|
101
|
+
* tests are skipped. All tests in a group are retried together. If there are some focused tests or suites, all of
|
|
102
|
+
* them will be run but nothing else.
|
|
103
|
+
*
|
|
104
|
+
* **NOTE** Using serial is not recommended. It is usually better to make your tests isolated, so they can be run
|
|
105
|
+
* independently.
|
|
106
|
+
*
|
|
107
|
+
* **Usage**
|
|
108
|
+
*
|
|
109
|
+
* ```js
|
|
110
|
+
* test.describe.serial.only('group', () => {
|
|
111
|
+
* test('runs first', async ({ page }) => {
|
|
112
|
+
* });
|
|
113
|
+
* test('runs second', async ({ page }) => {
|
|
114
|
+
* });
|
|
115
|
+
* });
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* @param title Group title.
|
|
119
|
+
* @param callback A callback that is run immediately when calling
|
|
120
|
+
* [test.describe.serial.only(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-serial-only).
|
|
121
|
+
* Any tests added in this callback will belong to the group.
|
|
122
|
+
*/
|
|
123
|
+
only: SuiteFunction;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* **NOTE** See [test.describe.configure([options])](https://playwright.dev/docs/api/class-test#test-describe-configure) for
|
|
127
|
+
* the preferred way of configuring the execution mode.
|
|
128
|
+
*
|
|
129
|
+
* Declares a group of tests that could be run in parallel. By default, tests in a single test file run one after
|
|
130
|
+
* another, but using
|
|
131
|
+
* [test.describe.parallel(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel) allows
|
|
132
|
+
* them to run in parallel.
|
|
133
|
+
*
|
|
134
|
+
* **Usage**
|
|
135
|
+
*
|
|
136
|
+
* ```js
|
|
137
|
+
* test.describe.parallel('group', () => {
|
|
138
|
+
* test('runs in parallel 1', async ({ page }) => {});
|
|
139
|
+
* test('runs in parallel 2', async ({ page }) => {});
|
|
140
|
+
* });
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* Note that parallel tests are executed in separate processes and cannot share any state or global variables. Each of
|
|
144
|
+
* the parallel tests executes all relevant hooks.
|
|
145
|
+
* @param title Group title.
|
|
146
|
+
* @param callback A callback that is run immediately when calling
|
|
147
|
+
* [test.describe.parallel(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel). Any
|
|
148
|
+
* tests added in this callback will belong to the group.
|
|
149
|
+
*/
|
|
150
|
+
parallel: SuiteFunction & {
|
|
151
|
+
/**
|
|
152
|
+
* **NOTE** See [test.describe.configure([options])](https://playwright.dev/docs/api/class-test#test-describe-configure) for
|
|
153
|
+
* the preferred way of configuring the execution mode.
|
|
154
|
+
*
|
|
155
|
+
* Declares a focused group of tests that could be run in parallel. This is similar to
|
|
156
|
+
* [test.describe.parallel(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel), but
|
|
157
|
+
* focuses the group. If there are some focused tests or suites, all of them will be run but nothing else.
|
|
158
|
+
*
|
|
159
|
+
* **Usage**
|
|
160
|
+
*
|
|
161
|
+
* ```js
|
|
162
|
+
* test.describe.parallel.only('group', () => {
|
|
163
|
+
* test('runs in parallel 1', async ({ page }) => {});
|
|
164
|
+
* test('runs in parallel 2', async ({ page }) => {});
|
|
165
|
+
* });
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* @param title Group title.
|
|
169
|
+
* @param callback A callback that is run immediately when calling
|
|
170
|
+
* [test.describe.parallel.only(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel-only).
|
|
171
|
+
* Any tests added in this callback will belong to the group.
|
|
172
|
+
*/
|
|
173
|
+
only: SuiteFunction;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Configures the enclosing scope. Can be executed either on the top level or inside a describe. Configuration applies
|
|
177
|
+
* to the entire scope, regardless of whether it run before or after the test declaration.
|
|
178
|
+
*
|
|
179
|
+
* Learn more about the execution modes [here](https://playwright.dev/docs/test-parallel).
|
|
180
|
+
*
|
|
181
|
+
* **Usage**
|
|
182
|
+
* - Running tests in parallel.
|
|
183
|
+
*
|
|
184
|
+
* ```js
|
|
185
|
+
* // Run all the tests in the file concurrently using parallel workers.
|
|
186
|
+
* test.describe.configure({ mode: 'parallel' });
|
|
187
|
+
* test('runs in parallel 1', async ({ page }) => {});
|
|
188
|
+
* test('runs in parallel 2', async ({ page }) => {});
|
|
189
|
+
* ```
|
|
190
|
+
*
|
|
191
|
+
* - Running tests serially, retrying from the start.
|
|
192
|
+
*
|
|
193
|
+
* **NOTE** Running serially is not recommended. It is usually better to make your tests isolated, so they can be
|
|
194
|
+
* run independently.
|
|
195
|
+
*
|
|
196
|
+
* ```js
|
|
197
|
+
* // Annotate tests as inter-dependent.
|
|
198
|
+
* test.describe.configure({ mode: 'serial' });
|
|
199
|
+
* test('runs first', async ({ page }) => {});
|
|
200
|
+
* test('runs second', async ({ page }) => {});
|
|
201
|
+
* ```
|
|
202
|
+
*
|
|
203
|
+
* - Configuring retries and timeout for each test.
|
|
204
|
+
*
|
|
205
|
+
* ```js
|
|
206
|
+
* // Each test in the file will be retried twice and have a timeout of 20 seconds.
|
|
207
|
+
* test.describe.configure({ retries: 2, timeout: 20_000 });
|
|
208
|
+
* test('runs first', async ({ page }) => {});
|
|
209
|
+
* test('runs second', async ({ page }) => {});
|
|
210
|
+
* ```
|
|
211
|
+
*
|
|
212
|
+
* - Run multiple describes in parallel, but tests inside each describe in order.
|
|
213
|
+
*
|
|
214
|
+
* ```js
|
|
215
|
+
* test.describe.configure({ mode: 'parallel' });
|
|
216
|
+
*
|
|
217
|
+
* test.describe('A, runs in parallel with B', () => {
|
|
218
|
+
* test.describe.configure({ mode: 'default' });
|
|
219
|
+
* test('in order A1', async ({ page }) => {});
|
|
220
|
+
* test('in order A2', async ({ page }) => {});
|
|
221
|
+
* });
|
|
222
|
+
*
|
|
223
|
+
* test.describe('B, runs in parallel with A', () => {
|
|
224
|
+
* test.describe.configure({ mode: 'default' });
|
|
225
|
+
* test('in order B1', async ({ page }) => {});
|
|
226
|
+
* test('in order B2', async ({ page }) => {});
|
|
227
|
+
* });
|
|
228
|
+
* ```
|
|
229
|
+
*
|
|
230
|
+
* @param options
|
|
231
|
+
*/
|
|
232
|
+
configure: (options: { mode?: 'default' | 'parallel' | 'serial', retries?: number, timeout?: number }) => void;
|
|
233
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Playwright Test doesn't export all its public APIs, hence the need for this workaround
|
|
2
|
+
// See https://github.com/microsoft/playwright/pull/24146
|
|
3
|
+
export interface SuiteFunction {
|
|
4
|
+
/**
|
|
5
|
+
* Declares a group of tests.
|
|
6
|
+
*
|
|
7
|
+
* **Usage**
|
|
8
|
+
*
|
|
9
|
+
* ```js
|
|
10
|
+
* test.describe('two tests', () => {
|
|
11
|
+
* test('one', async ({ page }) => {
|
|
12
|
+
* // ...
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* test('two', async ({ page }) => {
|
|
16
|
+
* // ...
|
|
17
|
+
* });
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param title Group title.
|
|
22
|
+
* @param callback A callback that is run immediately when calling
|
|
23
|
+
* [test.describe(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-1). Any tests added in
|
|
24
|
+
* this callback will belong to the group.
|
|
25
|
+
*/
|
|
26
|
+
(title: string, callback: () => void): void;
|
|
27
|
+
/**
|
|
28
|
+
* Declares an anonymous group of tests. This is convenient to give a group of tests a common option with
|
|
29
|
+
* [test.use(options)](https://playwright.dev/docs/api/class-test#test-use).
|
|
30
|
+
*
|
|
31
|
+
* **Usage**
|
|
32
|
+
*
|
|
33
|
+
* ```js
|
|
34
|
+
* test.describe(() => {
|
|
35
|
+
* test.use({ colorScheme: 'dark' });
|
|
36
|
+
*
|
|
37
|
+
* test('one', async ({ page }) => {
|
|
38
|
+
* // ...
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* test('two', async ({ page }) => {
|
|
42
|
+
* // ...
|
|
43
|
+
* });
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @param callback A callback that is run immediately when calling
|
|
48
|
+
* [test.describe(callback)](https://playwright.dev/docs/api/class-test#test-describe-2). Any tests added in this
|
|
49
|
+
* callback will belong to the group.
|
|
50
|
+
*/
|
|
51
|
+
(callback: () => void): void;
|
|
52
|
+
}
|
package/src/api/index.ts
CHANGED
package/src/api/test-api.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
TestInfo,
|
|
8
8
|
TestType,
|
|
9
9
|
} from '@playwright/test';
|
|
10
|
-
import { test as playwrightBaseTest
|
|
10
|
+
import { test as playwrightBaseTest } from '@playwright/test';
|
|
11
11
|
import { AnsiDiffFormatter, Cast, Duration, serenity as serenityInstance, TakeNotes } from '@serenity-js/core';
|
|
12
12
|
import { SceneFinishes, SceneTagged } from '@serenity-js/core/lib/events';
|
|
13
13
|
import { BrowserTag, PlatformTag } from '@serenity-js/core/lib/model';
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
PlaywrightStepReporter,
|
|
23
23
|
SERENITY_JS_DOMAIN_EVENTS_ATTACHMENT_CONTENT_TYPE
|
|
24
24
|
} from '../reporter';
|
|
25
|
+
import type { DescribeFunction } from './DescribeFunction';
|
|
25
26
|
import { PerformActivitiesAsPlaywrightSteps } from './PerformActivitiesAsPlaywrightSteps';
|
|
26
27
|
import type { SerenityFixtures } from './SerenityFixtures';
|
|
27
28
|
import type { SerenityOptions } from './SerenityOptions';
|
|
@@ -185,7 +186,7 @@ export type TestApi<TestArgs extends Record<string, any>, WorkerArgs extends Rec
|
|
|
185
186
|
useFixtures: <T extends Record<string, any>, W extends Record<string, any> = object>(customFixtures: Fixtures<T, W, TestArgs, WorkerArgs>) => TestApi<TestArgs & T, WorkerArgs & W>,
|
|
186
187
|
it: TestType<TestArgs, WorkerArgs>,
|
|
187
188
|
test: TestType<TestArgs, WorkerArgs>,
|
|
188
|
-
describe:
|
|
189
|
+
describe: DescribeFunction,
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
function createTestApi<TestArgs extends Record<string, any>, WorkerArgs extends Record<string, any> = object>(baseTest: TestType<TestArgs, WorkerArgs>): TestApi<TestArgs, WorkerArgs> {
|
|
@@ -318,7 +319,7 @@ export const test = api.test;
|
|
|
318
319
|
* - [Playwright Test `describe` function](https://playwright.dev/docs/api/class-test#test-describe-1)
|
|
319
320
|
* - [Serenity/JS + Playwright Test project template](https://github.com/serenity-js/serenity-js-playwright-test-template/)
|
|
320
321
|
*/
|
|
321
|
-
export const describe
|
|
322
|
+
export const describe = api.describe;
|
|
322
323
|
|
|
323
324
|
export const beforeAll = api.beforeAll;
|
|
324
325
|
|