allure-playwright 2.15.0 → 3.0.0-beta.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.
- package/README.md +138 -66
- package/dist/cjs/autoconfig.js +6 -0
- package/dist/cjs/autoconfig.js.map +1 -0
- package/dist/cjs/index.js +572 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/legacy.js +176 -0
- package/dist/cjs/legacy.js.map +1 -0
- package/dist/cjs/model.js +2 -0
- package/dist/cjs/model.js.map +1 -0
- package/dist/cjs/runtime.js +58 -0
- package/dist/cjs/runtime.js.map +1 -0
- package/dist/cjs/testplan.js +18 -0
- package/dist/cjs/testplan.js.map +1 -0
- package/dist/cjs/utils.js +20 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/esm/autoconfig.js +4 -0
- package/dist/esm/autoconfig.js.map +1 -0
- package/dist/esm/index.js +556 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/legacy.js +168 -0
- package/dist/esm/legacy.js.map +1 -0
- package/dist/esm/model.js +2 -0
- package/dist/esm/model.js.map +1 -0
- package/dist/esm/runtime.js +51 -0
- package/dist/esm/runtime.js.map +1 -0
- package/dist/esm/testplan.js +12 -0
- package/dist/esm/testplan.js.map +1 -0
- package/dist/esm/utils.js +14 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/types/autoconfig.d.ts +1 -0
- package/dist/types/index.d.ts +51 -0
- package/dist/types/legacy.d.ts +34 -0
- package/dist/types/model.d.ts +7 -0
- package/dist/types/runtime.d.ts +6 -0
- package/dist/types/utils.d.ts +3 -0
- package/package.json +42 -13
- package/dist/helpers.d.ts +0 -30
- package/dist/helpers.js +0 -112
- package/dist/helpers.js.map +0 -1
- package/dist/index.d.ts +0 -41
- package/dist/index.js +0 -316
- package/dist/index.js.map +0 -1
- package/dist/testplan.js +0 -16
- package/dist/testplan.js.map +0 -1
- /package/dist/{testplan.d.ts → types/testplan.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -5,39 +5,47 @@
|
|
|
5
5
|
[<img src="https://allurereport.org/public/img/allure-report.svg" height="85px" alt="Allure Report logo" align="right" />](https://allurereport.org "Allure Report")
|
|
6
6
|
|
|
7
7
|
- Learn more about Allure Report at https://allurereport.org
|
|
8
|
-
- 📚 [Documentation](https://allurereport.org/docs/) – discover official documentation for Allure
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
|
|
8
|
+
- 📚 [Documentation](https://allurereport.org/docs/) – discover official documentation for Allure
|
|
9
|
+
Report
|
|
10
|
+
-
|
|
11
|
+
|
|
12
|
+
❓ [Questions and Support](https://github.com/orgs/allure-framework/discussions/categories/questions-support) –
|
|
13
|
+
get help from the team and community
|
|
14
|
+
|
|
15
|
+
-
|
|
16
|
+
|
|
17
|
+
📢 [Official annoucements](https://github.com/orgs/allure-framework/discussions/categories/announcements) –
|
|
18
|
+
be in touch with the latest updates
|
|
19
|
+
|
|
20
|
+
-
|
|
21
|
+
|
|
22
|
+
💬 [General Discussion ](https://github.com/orgs/allure-framework/discussions/categories/general-discussion) –
|
|
23
|
+
engage in casual conversations, share insights and ideas with the community
|
|
12
24
|
|
|
13
25
|
---
|
|
14
26
|
|
|
15
27
|
## Installation
|
|
16
28
|
|
|
17
|
-
|
|
18
|
-
npm i -D @playwright/test allure-playwright
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
or via yarn:
|
|
29
|
+
Use your favorite node package manager to install the package:
|
|
22
30
|
|
|
23
31
|
```bash
|
|
24
|
-
|
|
32
|
+
npm i -D allure-playwright
|
|
25
33
|
```
|
|
26
34
|
|
|
27
35
|
## Usage
|
|
28
36
|
|
|
29
|
-
|
|
37
|
+
Just add `allure-playwright` into Playwright configuration file:
|
|
30
38
|
|
|
31
39
|
```js
|
|
32
|
-
{
|
|
33
|
-
reporter: "allure-playwright"
|
|
40
|
+
module.exports = {
|
|
41
|
+
reporter: "allure-playwright",
|
|
34
42
|
}
|
|
35
43
|
```
|
|
36
44
|
|
|
37
|
-
Or
|
|
45
|
+
Or use the reporter with another ones:
|
|
38
46
|
|
|
39
47
|
```js
|
|
40
|
-
{
|
|
48
|
+
module.exports = {
|
|
41
49
|
reporter: [["line"], ["allure-playwright"]];
|
|
42
50
|
}
|
|
43
51
|
```
|
|
@@ -80,15 +88,16 @@ allure open allure-report
|
|
|
80
88
|
Some reporter settings can set by following options:
|
|
81
89
|
|
|
82
90
|
| Option | Description | Default |
|
|
83
|
-
|
|
91
|
+
|--------------|------------------------------------------------------------------------------|--------------------|
|
|
84
92
|
| outputFolder | Path to results folder. | `./allure-results` |
|
|
85
93
|
| detail | Hide `pw:api` and `hooks` steps in report. [See below](#hooks-and-api-calls) | `true` |
|
|
86
94
|
| suiteTitle | Use test title instead of `allure.suite()`. [See below](#suit-title) | `true` |
|
|
95
|
+
| links | Allure Runtime API links templates. [See below](#links-usage) | `undefined` |
|
|
87
96
|
|
|
88
97
|
### Options Usage
|
|
89
98
|
|
|
90
99
|
```js
|
|
91
|
-
|
|
100
|
+
module.exports = {
|
|
92
101
|
reporter: [
|
|
93
102
|
[
|
|
94
103
|
"allure-playwright",
|
|
@@ -104,12 +113,14 @@ const config = {
|
|
|
104
113
|
|
|
105
114
|
### Options for Allure TestOps compatibility
|
|
106
115
|
|
|
107
|
-
After exporting test results into Allure TestOps, the results may contain extra steps with
|
|
116
|
+
After exporting test results into Allure TestOps, the results may contain extra steps with
|
|
117
|
+
Playwright’s API calls, as
|
|
108
118
|
well as collisions in the name of the suits.
|
|
109
119
|
|
|
110
120
|
#### Hooks and API calls
|
|
111
121
|
|
|
112
|
-
By default, each step of the `test.step()` functions contains subsections Playwright’s API methods
|
|
122
|
+
By default, each step of the `test.step()` functions contains subsections Playwright’s API methods
|
|
123
|
+
calls.
|
|
113
124
|
|
|
114
125
|
The report looks like:
|
|
115
126
|
|
|
@@ -127,13 +138,15 @@ The report looks like:
|
|
|
127
138
|
> browserContext.close
|
|
128
139
|
```
|
|
129
140
|
|
|
130
|
-
To hide steps with `Before / After hooks` and API calls `page / expect / browser` set the
|
|
141
|
+
To hide steps with `Before / After hooks` and API calls `page / expect / browser` set the
|
|
142
|
+
option `detail: false`
|
|
131
143
|
|
|
132
144
|
#### Suite title
|
|
133
145
|
|
|
134
146
|
By default, the reporter uses the test file path as the suite name.
|
|
135
147
|
|
|
136
|
-
If tests uses the `allure.suite()` and it's value must be used in Allure TestOps custom fields, then
|
|
148
|
+
If tests uses the `allure.suite()` and it's value must be used in Allure TestOps custom fields, then
|
|
149
|
+
set the option `suiteTitle: false`
|
|
137
150
|
|
|
138
151
|
## Providing extra information
|
|
139
152
|
|
|
@@ -158,10 +171,10 @@ Tests extra information can be provided by labels:
|
|
|
158
171
|
|
|
159
172
|
```js
|
|
160
173
|
import { test, expect } from "@playwright/test";
|
|
161
|
-
import {
|
|
174
|
+
import { label } from "allure-js-commons";
|
|
162
175
|
|
|
163
|
-
test("basic test", async ({
|
|
164
|
-
await
|
|
176
|
+
test("basic test", async ({page}, testInfo) => {
|
|
177
|
+
await label("labelName", "labelValue");
|
|
165
178
|
});
|
|
166
179
|
```
|
|
167
180
|
|
|
@@ -169,21 +182,66 @@ test("basic test", async ({ page }, testInfo) => {
|
|
|
169
182
|
|
|
170
183
|
```js
|
|
171
184
|
import { test, expect } from "@playwright/test";
|
|
172
|
-
import {
|
|
185
|
+
import { link, issue } from "allure-js-commons";
|
|
173
186
|
|
|
174
187
|
test("basic test", async ({ page }, testInfo) => {
|
|
175
|
-
await
|
|
176
|
-
await
|
|
188
|
+
await link("https://playwright.dev", "link-type", "playwright-site"); // link with name and type
|
|
189
|
+
await issue("Issue Name", "https://github.com/allure-framework/allure-js/issues/352");
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
You can also configure links formatters to make usage much more convenient. `%s`
|
|
194
|
+
in `urlTemplate` parameter will be replaced by given value.
|
|
195
|
+
|
|
196
|
+
```diff
|
|
197
|
+
module.exports = {
|
|
198
|
+
reporter: [
|
|
199
|
+
[
|
|
200
|
+
"allure-playwright",
|
|
201
|
+
{
|
|
202
|
+
detail: true,
|
|
203
|
+
outputFolder: "my-allure-results",
|
|
204
|
+
+ links: [
|
|
205
|
+
+ {
|
|
206
|
+
+ type: "issue",
|
|
207
|
+
+ urlTemplate: "https://example.org/issues/%s",
|
|
208
|
+
+ nameTemplate: "Issue: %s",
|
|
209
|
+
+ },
|
|
210
|
+
+ {
|
|
211
|
+
+ type: "tms",
|
|
212
|
+
+ urlTemplate: "https://example.org/tasks/%s"
|
|
213
|
+
+ },
|
|
214
|
+
+ {
|
|
215
|
+
+ type: "custom",
|
|
216
|
+
+ urlTemplate: "https://example.org/custom/%s"
|
|
217
|
+
+ },
|
|
218
|
+
+ ]
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Then you can assign link using shorter notation:
|
|
226
|
+
|
|
227
|
+
```js
|
|
228
|
+
import {test, expect} from "@playwright/test";
|
|
229
|
+
import {issue, tms, link} from "allure-js-commons";
|
|
230
|
+
|
|
231
|
+
test("basic test", async () => {
|
|
232
|
+
await issue("Issue Name", "352");
|
|
233
|
+
await tms("Task Name", "352");
|
|
234
|
+
await link("352", "Link name", "custom");
|
|
177
235
|
});
|
|
178
236
|
```
|
|
179
237
|
|
|
180
238
|
### Id Usage
|
|
181
239
|
|
|
182
240
|
```js
|
|
183
|
-
import {
|
|
184
|
-
import {
|
|
241
|
+
import {test, expect} from "@playwright/test";
|
|
242
|
+
import {allure, LabelName} from "allure-playwright";
|
|
185
243
|
|
|
186
|
-
test("basic test", async ({
|
|
244
|
+
test("basic test", async ({page}, testInfo) => {
|
|
187
245
|
await allure.id("420");
|
|
188
246
|
});
|
|
189
247
|
```
|
|
@@ -191,10 +249,10 @@ test("basic test", async ({ page }, testInfo) => {
|
|
|
191
249
|
### Epics Usage
|
|
192
250
|
|
|
193
251
|
```js
|
|
194
|
-
import {
|
|
195
|
-
import {
|
|
252
|
+
import {test, expect} from "@playwright/test";
|
|
253
|
+
import {allure} from "allure-playwright";
|
|
196
254
|
|
|
197
|
-
test("basic test", async ({
|
|
255
|
+
test("basic test", async ({page}, testInfo) => {
|
|
198
256
|
await allure.epic("Some Epic");
|
|
199
257
|
});
|
|
200
258
|
```
|
|
@@ -202,10 +260,10 @@ test("basic test", async ({ page }, testInfo) => {
|
|
|
202
260
|
### Stories Usage
|
|
203
261
|
|
|
204
262
|
```js
|
|
205
|
-
import {
|
|
206
|
-
import {
|
|
263
|
+
import {test, expect} from "@playwright/test";
|
|
264
|
+
import {allure} from "allure-playwright";
|
|
207
265
|
|
|
208
|
-
test("basic test", async ({
|
|
266
|
+
test("basic test", async ({page}, testInfo) => {
|
|
209
267
|
await allure.story("Some Story");
|
|
210
268
|
});
|
|
211
269
|
```
|
|
@@ -213,10 +271,10 @@ test("basic test", async ({ page }, testInfo) => {
|
|
|
213
271
|
### Screenshot usage
|
|
214
272
|
|
|
215
273
|
```ts
|
|
216
|
-
import {
|
|
217
|
-
import {
|
|
274
|
+
import {test, expect} from "@playwright/test";
|
|
275
|
+
import {allure} from "allure-playwright";
|
|
218
276
|
|
|
219
|
-
test("basic test", async ({
|
|
277
|
+
test("basic test", async ({page}, testInfo) => {
|
|
220
278
|
await allure.attachment("basic-page-screen", await page.screenshot(), {
|
|
221
279
|
contentType: "image/png",
|
|
222
280
|
});
|
|
@@ -226,12 +284,12 @@ test("basic test", async ({ page }, testInfo) => {
|
|
|
226
284
|
### Attachments Usage
|
|
227
285
|
|
|
228
286
|
```js
|
|
229
|
-
import {
|
|
230
|
-
import {
|
|
287
|
+
import {test, expect} from "@playwright/test";
|
|
288
|
+
import {allure} from "allure-playwright";
|
|
231
289
|
|
|
232
290
|
export const TODO_ITEMS = ["buy some cheese", "feed the cat", "book a doctors appointment"];
|
|
233
291
|
|
|
234
|
-
test("basic test", async ({
|
|
292
|
+
test("basic test", async ({page}, testInfo) => {
|
|
235
293
|
await allure.attachment("TODO_ITEMS", JSON.stringify(TODO_ITEMS), {
|
|
236
294
|
contentType: "application/json",
|
|
237
295
|
});
|
|
@@ -241,12 +299,12 @@ test("basic test", async ({ page }, testInfo) => {
|
|
|
241
299
|
### Steps usage
|
|
242
300
|
|
|
243
301
|
```ts
|
|
244
|
-
import {
|
|
245
|
-
import {
|
|
302
|
+
import {test, expect} from "@playwright/test";
|
|
303
|
+
import {allure} from "allure-playwright";
|
|
246
304
|
|
|
247
305
|
export const TODO_ITEMS = ["buy some cheese", "feed the cat", "book a doctors appointment"];
|
|
248
306
|
|
|
249
|
-
test("basic test", async ({
|
|
307
|
+
test("basic test", async ({page}, testInfo) => {
|
|
250
308
|
await allure.step("Visit todolist page", async () => {
|
|
251
309
|
await page.goto("https://demo.playwright.dev/todomvc");
|
|
252
310
|
});
|
|
@@ -266,31 +324,33 @@ test("basic test", async ({ page }, testInfo) => {
|
|
|
266
324
|
### Parameters usage
|
|
267
325
|
|
|
268
326
|
```ts
|
|
269
|
-
import {
|
|
270
|
-
import {
|
|
327
|
+
import {test, expect} from "@playwright/test";
|
|
328
|
+
import {allure} from "allure-playwright";
|
|
271
329
|
|
|
272
|
-
test("basic test", async ({
|
|
330
|
+
test("basic test", async ({page}, testInfo) => {
|
|
273
331
|
await allure.parameter("parameterName", "parameterValue");
|
|
274
332
|
});
|
|
275
333
|
```
|
|
276
334
|
|
|
277
335
|
Also parameter takes an third optional parameter with the hidden and excluded options:
|
|
278
|
-
`mode: "hidden" | "masked"` - `masked` hide parameter value to secure sensitive data, and `hidden`
|
|
336
|
+
`mode: "hidden" | "masked"` - `masked` hide parameter value to secure sensitive data, and `hidden`
|
|
337
|
+
entirely hide parameter from report
|
|
279
338
|
|
|
280
339
|
`excluded: true` - excludes parameter from the history
|
|
281
340
|
|
|
282
341
|
```ts
|
|
283
|
-
import {
|
|
284
|
-
import {
|
|
342
|
+
import {test, expect} from "@playwright/test";
|
|
343
|
+
import {allure} from "allure-playwright";
|
|
285
344
|
|
|
286
|
-
test("basic test", async ({
|
|
287
|
-
await allure.parameter("parameterName", "parameterValue", {
|
|
345
|
+
test("basic test", async ({page}, testInfo) => {
|
|
346
|
+
await allure.parameter("parameterName", "parameterValue", {mode: "masked", excluded: true});
|
|
288
347
|
});
|
|
289
348
|
```
|
|
290
349
|
|
|
291
350
|
### Selective test execution
|
|
292
351
|
|
|
293
|
-
Allure allow you to execute only a subset of tests. This is useful when you want to run only a
|
|
352
|
+
Allure allow you to execute only a subset of tests. This is useful when you want to run only a
|
|
353
|
+
specific test or a group of tests.
|
|
294
354
|
|
|
295
355
|
To enable this feature, you need to add the following code to your `playwright.config.js`:
|
|
296
356
|
|
|
@@ -311,11 +371,13 @@ export default {
|
|
|
311
371
|
};
|
|
312
372
|
```
|
|
313
373
|
|
|
314
|
-
Allure will read `ALLURE_TESTPLAN_PATH` environment variable and read testplan from the specified
|
|
374
|
+
Allure will read `ALLURE_TESTPLAN_PATH` environment variable and read testplan from the specified
|
|
375
|
+
file.
|
|
315
376
|
|
|
316
377
|
### EnvironmentInfo usage
|
|
317
378
|
|
|
318
|
-
Allure allows you to add environment information to the report. This is useful when you want to add
|
|
379
|
+
Allure allows you to add environment information to the report. This is useful when you want to add
|
|
380
|
+
some additional information to the report.
|
|
319
381
|
|
|
320
382
|
to enable this feature, you need to add the following field to your `playwright.config.js`:
|
|
321
383
|
|
|
@@ -337,11 +399,13 @@ export default {
|
|
|
337
399
|
|
|
338
400
|
### Visual comparisons usage
|
|
339
401
|
|
|
340
|
-
Allure allows you to add visual comparisons to the report. This is useful when you want to add some
|
|
402
|
+
Allure allows you to add visual comparisons to the report. This is useful when you want to add some
|
|
403
|
+
additional information to the report.
|
|
341
404
|
|
|
342
405
|
```ts
|
|
343
|
-
import {
|
|
344
|
-
|
|
406
|
+
import {test, expect} from "@playwright/test";
|
|
407
|
+
|
|
408
|
+
test("screendiff", async ({page}) => {
|
|
345
409
|
await page.goto("https://playwright.dev/");
|
|
346
410
|
await expect(page).toHaveScreenshot();
|
|
347
411
|
});
|
|
@@ -354,16 +418,24 @@ If screenshots don't match, the report shows difference between them.
|
|
|
354
418
|
### Passing metadata from test title
|
|
355
419
|
|
|
356
420
|
You also can pass allure metadata from test title.
|
|
357
|
-
This is useful when you need to set allureId for the tests with failing before hooks. Just
|
|
421
|
+
This is useful when you need to set allureId for the tests with failing before hooks. Just
|
|
422
|
+
add `@allure.id={idValue}` for the allureId or `@allure.label.{labelName}={labelValue}` for other
|
|
423
|
+
types of labels.
|
|
358
424
|
|
|
359
425
|
```ts
|
|
360
|
-
import {
|
|
361
|
-
|
|
362
|
-
test("
|
|
363
|
-
|
|
364
|
-
test("
|
|
426
|
+
import {test, expect} from "@playwright/test";
|
|
427
|
+
|
|
428
|
+
test("test with allureId @allure.id=256", async ({}) => {
|
|
429
|
+
});
|
|
430
|
+
test("tst with severity @allure.label.severity=critical", async ({}) => {
|
|
431
|
+
});
|
|
432
|
+
test("test with epic @allure.label.epic=login", async ({}) => {
|
|
433
|
+
});
|
|
434
|
+
test("test with strangeLabel @allure.label.strangeLabel=strangeValue", async ({}) => {
|
|
435
|
+
});
|
|
365
436
|
```
|
|
366
437
|
|
|
367
438
|
> **Warning**
|
|
368
439
|
> Note that changing title can cause creating new testcases in history.
|
|
369
|
-
> To fix this please add `@allure.id={yourTestCaseId}` to the test name if you passing allure
|
|
440
|
+
> To fix this please add `@allure.id={yourTestCaseId}` to the test name if you passing allure
|
|
441
|
+
> metadata from test title
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoconfig.js","names":["_runtime","require","_runtime2","setGlobalTestRuntime","AllurePlaywrightTestRuntime"],"sources":["../../src/autoconfig.ts"],"sourcesContent":["import { setGlobalTestRuntime } from \"allure-js-commons/sdk/runtime\";\nimport { AllurePlaywrightTestRuntime } from \"./runtime.js\";\n\nsetGlobalTestRuntime(new AllurePlaywrightTestRuntime());\n"],"mappings":";;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,6BAAoB,EAAC,IAAIC,qCAA2B,CAAC,CAAC,CAAC","ignoreList":[]}
|