reporting-labs 0.1.2 → 0.1.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/README.md +70 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,6 +35,73 @@ open reporting-labs/index.html
|
|
|
35
35
|
|
|
36
36
|
That is all. Everything below is optional.
|
|
37
37
|
|
|
38
|
+
## Keep the reporter options in their own file (recommended)
|
|
39
|
+
|
|
40
|
+
As soon as you set more than a title, put the reportingLabs options in a separate file. Your `playwright.config.ts` stays short, and all report settings live in one place.
|
|
41
|
+
|
|
42
|
+
**Step 1.** Create the file (or let the CLI do it with `npx reporting-labs init`):
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
// reporting-labs.config.ts (next to playwright.config.ts)
|
|
46
|
+
import type { ReportingLabsOptions } from 'reporting-labs';
|
|
47
|
+
|
|
48
|
+
const config: ReportingLabsOptions = {
|
|
49
|
+
title: 'My app – regression',
|
|
50
|
+
outputFolder: 'reports/reporting-labs',
|
|
51
|
+
embedVideos: true,
|
|
52
|
+
metadata: { env: process.env.TEST_ENV ?? 'local' },
|
|
53
|
+
// links: { story: 'https://yourteam.atlassian.net/browse/{id}' },
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default config;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Step 2.** Import it in `playwright.config.ts` and add one line to your reporter list. Your other reporters keep working as before.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { defineConfig } from '@playwright/test';
|
|
63
|
+
import reportingLabs from './reporting-labs.config';
|
|
64
|
+
|
|
65
|
+
export default defineConfig({
|
|
66
|
+
reporter: [
|
|
67
|
+
['list'],
|
|
68
|
+
['html', { open: 'never' }],
|
|
69
|
+
['reporting-labs', reportingLabs], // <- this line
|
|
70
|
+
],
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
That is it. The `ReportingLabsOptions` type gives you autocomplete for every option in your editor.
|
|
75
|
+
|
|
76
|
+
If your reporter list differs between CI and local (a common pattern), add the same line to both branches:
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
reporter: process.env.CI
|
|
80
|
+
? [['blob'], ['html', { open: 'never' }], ['reporting-labs', reportingLabs]]
|
|
81
|
+
: [['list'], ['html', { open: 'never' }], ['reporting-labs', reportingLabs]],
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Examples you can copy
|
|
85
|
+
|
|
86
|
+
The [`examples/`](https://github.com/naveenanimation20/reporting-labs/tree/main/examples) folder has one small spec per feature. Each one runs offline in a few seconds, so you can read it, run it, and copy what you need.
|
|
87
|
+
|
|
88
|
+
| Spec | What it shows |
|
|
89
|
+
|---|---|
|
|
90
|
+
| [01-tag-your-tests.spec.ts](https://github.com/naveenanimation20/reporting-labs/blob/main/examples/01-tag-your-tests.spec.ts) | `meta()` with priority, severity, owner, feature, story; the same via tags and annotations |
|
|
91
|
+
| [02-logs-and-test-data.spec.ts](https://github.com/naveenanimation20/reporting-labs/blob/main/examples/02-logs-and-test-data.spec.ts) | `log()` lines and `testData()` as key/value, table and CSV, with secrets masked |
|
|
92
|
+
| [03-api-calls.spec.ts](https://github.com/naveenanimation20/reporting-labs/blob/main/examples/03-api-calls.spec.ts) | `recordApi()` around `request.post`, `api()` for manual records, a 404 in the API tab |
|
|
93
|
+
| [04-steps-and-attachments.spec.ts](https://github.com/naveenanimation20/reporting-labs/blob/main/examples/04-steps-and-attachments.spec.ts) | `test.step()` bars, screenshot / JSON attachments, visual comparison viewer |
|
|
94
|
+
| [05-outcomes.spec.ts](https://github.com/naveenanimation20/reporting-labs/blob/main/examples/05-outcomes.spec.ts) | skip with a reason, fixme, expected failure, timeout, a plain failure, a flaky test |
|
|
95
|
+
| [06-bdd-style.spec.ts](https://github.com/naveenanimation20/reporting-labs/blob/main/examples/06-bdd-style.spec.ts) | Given / When / Then steps rendered as Gherkin |
|
|
96
|
+
| [reporting-labs.config.ts](https://github.com/naveenanimation20/reporting-labs/blob/main/examples/reporting-labs.config.ts) | A complete reporter config, every option commented |
|
|
97
|
+
| [playwright.config.ts](https://github.com/naveenanimation20/reporting-labs/blob/main/examples/playwright.config.ts) | How the reporter sits next to the built-in reporters |
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
git clone https://github.com/naveenanimation20/reporting-labs
|
|
101
|
+
cd reporting-labs/examples && npm install && npx playwright test
|
|
102
|
+
open reporting-labs/index.html
|
|
103
|
+
```
|
|
104
|
+
|
|
38
105
|
## A tour of the report
|
|
39
106
|
|
|
40
107
|
### Overview: the state of the run in one screen
|
|
@@ -86,7 +153,7 @@ test('completes purchase', async ({ page }) => {
|
|
|
86
153
|
});
|
|
87
154
|
```
|
|
88
155
|
|
|
89
|
-
Tags work too: `{ tag: ['@P1', '@severity:critical', '@owner:priya'] }`. Plain annotations (`test.info().annotations.push({ type: 'priority', description: 'P1' })`) are picked up as well.
|
|
156
|
+
Full example: [examples/01-tag-your-tests.spec.ts](https://github.com/naveenanimation20/reporting-labs/blob/main/examples/01-tag-your-tests.spec.ts). Tags work too: `{ tag: ['@P1', '@severity:critical', '@owner:priya'] }`. Plain annotations (`test.info().annotations.push({ type: 'priority', description: 'P1' })`) are picked up as well.
|
|
90
157
|
|
|
91
158
|
Turn story, epic or issue keys into links:
|
|
92
159
|
|
|
@@ -111,7 +178,7 @@ test('creates an order', async ({ request }) => {
|
|
|
111
178
|
});
|
|
112
179
|
```
|
|
113
180
|
|
|
114
|
-
Passwords, tokens, API keys, `Authorization` / `Cookie` headers, JWTs and `Bearer …` values are masked as `****` everywhere. Add your own keys with `maskKeys: ['otp', 'pan']`.
|
|
181
|
+
Full examples: [02-logs-and-test-data.spec.ts](https://github.com/naveenanimation20/reporting-labs/blob/main/examples/02-logs-and-test-data.spec.ts) and [03-api-calls.spec.ts](https://github.com/naveenanimation20/reporting-labs/blob/main/examples/03-api-calls.spec.ts). Passwords, tokens, API keys, `Authorization` / `Cookie` headers, JWTs and `Bearer …` values are masked as `****` everywhere. Add your own keys with `maskKeys: ['otp', 'pan']`.
|
|
115
182
|
|
|
116
183
|
## Run history: new vs known, flaky, slower
|
|
117
184
|
|
|
@@ -194,7 +261,7 @@ reporter: [['reporting-labs', {
|
|
|
194
261
|
}]]
|
|
195
262
|
```
|
|
196
263
|
|
|
197
|
-
`npx reporting-labs init` writes a starter `reporting-labs.config.ts
|
|
264
|
+
`npx reporting-labs init` writes a starter `reporting-labs.config.ts`; see [Keep the reporter options in their own file](#keep-the-reporter-options-in-their-own-file-recommended).
|
|
198
265
|
|
|
199
266
|
## Running in CI
|
|
200
267
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reporting-labs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "reportingLabs – beautiful, customizable single-file HTML test reports. One line of config. Playwright adapter included, more runners on the way.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"test-report",
|