@piwitests/reporter 0.5.0 → 0.6.0
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 +37 -26
- package/dist/global-setup-module.js +2 -2
- package/dist/index.d.ts +13 -4
- package/dist/index.js +19 -5
- package/dist/internal/capture/attachments.d.ts +19 -0
- package/dist/internal/capture/attachments.js +22 -0
- package/dist/{fixtures.d.ts → internal/capture/capture-fixtures.d.ts} +5 -3
- package/dist/internal/capture/capture-fixtures.js +495 -0
- package/dist/{locator-healing.js → internal/capture/locator-healing.js} +11 -6
- package/dist/internal/collect/error-text.d.ts +18 -0
- package/dist/internal/collect/error-text.js +79 -0
- package/dist/{metadata-collector.d.ts → internal/collect/metadata-collector.d.ts} +2 -2
- package/dist/{metadata-collector.js → internal/collect/metadata-collector.js} +12 -9
- package/dist/{skip-classify.d.ts → internal/collect/skip-classify.d.ts} +1 -1
- package/dist/{step-analyzer.d.ts → internal/collect/step-analyzer.d.ts} +6 -0
- package/dist/{step-analyzer.js → internal/collect/step-analyzer.js} +7 -2
- package/dist/internal/config/env.d.ts +45 -0
- package/dist/{config.js → internal/config/env.js} +50 -35
- package/dist/internal/files/compression.js +69 -0
- package/dist/{file-handler.d.ts → internal/files/file-handler.d.ts} +4 -4
- package/dist/{file-handler.js → internal/files/file-handler.js} +61 -29
- package/dist/{crash-recovery.d.ts → internal/streaming/crash-recovery.d.ts} +5 -5
- package/dist/{crash-recovery.js → internal/streaming/crash-recovery.js} +9 -8
- package/dist/{stream-buffer.d.ts → internal/streaming/stream-buffer.d.ts} +2 -2
- package/dist/{stream-buffer.js → internal/streaming/stream-buffer.js} +5 -5
- package/dist/{stream-manager.d.ts → internal/streaming/stream-manager.d.ts} +8 -8
- package/dist/{stream-manager.js → internal/streaming/stream-manager.js} +16 -13
- package/dist/{run-submitter.d.ts → internal/submit/run-submitter.d.ts} +7 -7
- package/dist/{run-submitter.js → internal/submit/run-submitter.js} +11 -9
- package/dist/{serializer.d.ts → internal/submit/serializer.d.ts} +1 -1
- package/dist/{uploader.d.ts → internal/submit/uploader.d.ts} +8 -8
- package/dist/{uploader.js → internal/submit/uploader.js} +45 -10
- package/dist/internal/support/ci.d.ts +2 -0
- package/dist/internal/support/ci.js +32 -0
- package/dist/internal/support/cli-filters.d.ts +1 -0
- package/dist/internal/support/cli-filters.js +51 -0
- package/dist/internal/support/errors.d.ts +8 -0
- package/dist/internal/support/errors.js +15 -0
- package/dist/internal/support/instance-id.d.ts +4 -0
- package/dist/internal/support/instance-id.js +48 -0
- package/dist/internal/support/limiter.d.ts +2 -0
- package/dist/internal/support/limiter.js +27 -0
- package/dist/internal/support/setup-file.d.ts +13 -0
- package/dist/internal/support/setup-file.js +61 -0
- package/dist/internal/support/source-snippet.d.ts +12 -0
- package/dist/internal/support/source-snippet.js +97 -0
- package/dist/internal/support/worker-index.d.ts +7 -0
- package/dist/internal/support/worker-index.js +14 -0
- package/dist/{http-client.d.ts → internal/transport/http-client.d.ts} +11 -1
- package/dist/{http-client.js → internal/transport/http-client.js} +57 -10
- package/dist/{config-wrapper.d.ts → public/config-wrapper.d.ts} +1 -1
- package/dist/{config-wrapper.js → public/config-wrapper.js} +4 -4
- package/dist/public/global-setup.d.ts +13 -0
- package/dist/public/global-setup.js +146 -0
- package/dist/{config.d.ts → public/options.d.ts} +7 -45
- package/dist/public/options.js +2 -0
- package/dist/{reporter.d.ts → public/reporter.d.ts} +1 -1
- package/dist/{reporter.js → public/reporter.js} +44 -54
- package/dist/types/collected.d.ts +96 -0
- package/dist/types/collected.js +10 -0
- package/dist/types/wire.d.ts +174 -0
- package/dist/types/wire.js +14 -0
- package/dist/types.d.ts +8 -253
- package/dist/types.js +23 -10
- package/package.json +1 -6
- package/dist/compression.js +0 -39
- package/dist/fixtures.js +0 -336
- package/dist/helpers.d.ts +0 -44
- package/dist/helpers.js +0 -312
- /package/dist/{locator-healing.d.ts → internal/capture/locator-healing.d.ts} +0 -0
- /package/dist/{skip-classify.js → internal/collect/skip-classify.js} +0 -0
- /package/dist/{compression.d.ts → internal/files/compression.d.ts} +0 -0
- /package/dist/{serializer.js → internal/submit/serializer.js} +0 -0
- /package/dist/{logger.d.ts → internal/support/logger.d.ts} +0 -0
- /package/dist/{logger.js → internal/support/logger.js} +0 -0
package/README.md
CHANGED
|
@@ -12,7 +12,34 @@ npm install --save-dev @piwitests/reporter
|
|
|
12
12
|
|
|
13
13
|
## Quick start
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
`wrapConfig` is the recommended setup. It injects the reporter **and** a global
|
|
16
|
+
setup step (so the run shows up as "initialising" while your `globalSetup` runs),
|
|
17
|
+
and forwards your options to that setup:
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { defineConfig } from '@playwright/test'
|
|
21
|
+
import { wrapConfig } from '@piwitests/reporter'
|
|
22
|
+
|
|
23
|
+
export default wrapConfig(
|
|
24
|
+
defineConfig({
|
|
25
|
+
use: {
|
|
26
|
+
trace: 'retain-on-failure',
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
{
|
|
30
|
+
serverUrl: 'http://localhost:3000',
|
|
31
|
+
projectName: 'my-project',
|
|
32
|
+
},
|
|
33
|
+
)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Run your tests — results are uploaded automatically:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx playwright test
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Prefer to wire it up by hand? Add the reporter to the `reporter` array instead:
|
|
16
43
|
|
|
17
44
|
```typescript
|
|
18
45
|
import { defineConfig } from '@playwright/test'
|
|
@@ -31,12 +58,6 @@ export default defineConfig({
|
|
|
31
58
|
})
|
|
32
59
|
```
|
|
33
60
|
|
|
34
|
-
Run your tests — results are uploaded automatically:
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
npx playwright test
|
|
38
|
-
```
|
|
39
|
-
|
|
40
61
|
## Configuration Options
|
|
41
62
|
|
|
42
63
|
| Option | Type | Default | Description |
|
|
@@ -109,16 +130,20 @@ To capture network request timing and browser Web Vitals, use the provided fixtu
|
|
|
109
130
|
```typescript
|
|
110
131
|
// tests/fixtures.ts
|
|
111
132
|
import { test as base, expect } from '@playwright/test'
|
|
112
|
-
import { dashboardFixtures } from '@piwitests/reporter
|
|
133
|
+
import { dashboardFixtures } from '@piwitests/reporter'
|
|
113
134
|
|
|
114
135
|
export const test = base.extend(dashboardFixtures)
|
|
115
136
|
export { expect }
|
|
116
137
|
```
|
|
117
138
|
|
|
118
|
-
Or
|
|
139
|
+
Or extend the base `test` in one line with `extendDashboardFixtures`:
|
|
119
140
|
|
|
120
141
|
```typescript
|
|
121
|
-
import { test
|
|
142
|
+
import { test as base } from '@playwright/test'
|
|
143
|
+
import { extendDashboardFixtures } from '@piwitests/reporter'
|
|
144
|
+
|
|
145
|
+
export const test = extendDashboardFixtures(base)
|
|
146
|
+
export { expect } from '@playwright/test'
|
|
122
147
|
```
|
|
123
148
|
|
|
124
149
|
### What gets captured
|
|
@@ -192,21 +217,7 @@ npm run reporter:dev # watch mode — auto-recompile on changes
|
|
|
192
217
|
|
|
193
218
|
### Source layout
|
|
194
219
|
|
|
195
|
-
|
|
196
|
-
|----------------------------|---------------------------------------------|
|
|
197
|
-
| `src/reporter.ts` | Orchestrator — Playwright hooks + fallback |
|
|
198
|
-
| `src/config.ts` | Options interface + defaults |
|
|
199
|
-
| `src/http-client.ts` | HTTP transport layer |
|
|
200
|
-
| `src/uploader.ts` | Upload strategies (JSON, multipart) |
|
|
201
|
-
| `src/stream-buffer.ts` | Persistent JSONL buffer |
|
|
202
|
-
| `src/crash-recovery.ts` | Recovery data management |
|
|
203
|
-
| `src/file-handler.ts` | Report/trace/attachment file operations |
|
|
204
|
-
| `src/metadata-collector.ts`| CI, SCM, Playwright config metadata |
|
|
205
|
-
| `src/step-analyzer.ts` | Step categorization + performance analysis |
|
|
206
|
-
| `src/helpers.ts` | Pure utility functions |
|
|
207
|
-
| `src/compression.ts` | Directory gzip archiver |
|
|
208
|
-
| `src/fixtures.ts` | Playwright fixtures |
|
|
209
|
-
| `src/index.ts` | Package entry point |
|
|
220
|
+
The package keeps its **public API** (`src/index.ts`, `src/fixtures.ts`, `src/public/`) separate from internal plumbing (`src/internal/<domain>/`) and the type model (`src/types/`). See [`ARCHITECTURE.md`](./ARCHITECTURE.md) for the full map — the public/internal split, the collect-and-submit data flow, the fallback ladder, and the conventions.
|
|
210
221
|
|
|
211
222
|
The `package.json` `exports` field maps the main entry and `./fixtures` to their `dist/` counterparts.
|
|
212
223
|
|
|
@@ -220,7 +231,7 @@ The `package.json` `exports` field maps the main entry and `./fixtures` to their
|
|
|
220
231
|
|
|
221
232
|
### Network/Web Vitals not appearing
|
|
222
233
|
|
|
223
|
-
-
|
|
234
|
+
- Extend your `test` with `dashboardFixtures` / `extendDashboardFixtures` from `@piwitests/reporter`
|
|
224
235
|
- Verify `collectPerformanceMetrics` is not set to `false`
|
|
225
236
|
- Ensure tests navigate to at least one page (`await page.goto(...)`)
|
|
226
237
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
exports.default = (0,
|
|
3
|
+
const global_setup_js_1 = require("./public/global-setup.js");
|
|
4
|
+
exports.default = (0, global_setup_js_1.createGlobalSetup)();
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Public API of `@piwitests/reporter`.
|
|
3
|
+
*
|
|
4
|
+
* This barrel is the *entire* external surface of the package — the reporter
|
|
5
|
+
* class, the config helpers, the capture fixtures, and the public types.
|
|
6
|
+
* Everything under `internal/` is deliberately NOT re-exported here; if it isn't
|
|
7
|
+
* exported from this file, it isn't part of the supported API.
|
|
8
|
+
*/
|
|
9
|
+
import { PiwiDashboardReporter } from './public/reporter.js';
|
|
2
10
|
export default PiwiDashboardReporter;
|
|
3
11
|
export { PiwiDashboardReporter };
|
|
4
|
-
export { wrapConfig } from './config-wrapper.js';
|
|
5
|
-
export { createGlobalSetup } from './
|
|
6
|
-
export
|
|
12
|
+
export { wrapConfig } from './public/config-wrapper.js';
|
|
13
|
+
export { createGlobalSetup } from './public/global-setup.js';
|
|
14
|
+
export { dashboardFixtures, extendDashboardFixtures } from './internal/capture/capture-fixtures.js';
|
|
15
|
+
export type { PiwiDashboardOptions, PlaywrightTestConfig } from './public/options.js';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createGlobalSetup = exports.wrapConfig = exports.PiwiDashboardReporter = void 0;
|
|
4
|
-
|
|
3
|
+
exports.extendDashboardFixtures = exports.dashboardFixtures = exports.createGlobalSetup = exports.wrapConfig = exports.PiwiDashboardReporter = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Public API of `@piwitests/reporter`.
|
|
6
|
+
*
|
|
7
|
+
* This barrel is the *entire* external surface of the package — the reporter
|
|
8
|
+
* class, the config helpers, the capture fixtures, and the public types.
|
|
9
|
+
* Everything under `internal/` is deliberately NOT re-exported here; if it isn't
|
|
10
|
+
* exported from this file, it isn't part of the supported API.
|
|
11
|
+
*/
|
|
12
|
+
const reporter_js_1 = require("./public/reporter.js");
|
|
5
13
|
Object.defineProperty(exports, "PiwiDashboardReporter", { enumerable: true, get: function () { return reporter_js_1.PiwiDashboardReporter; } });
|
|
14
|
+
// ── Reporter (default + named export) ────────────────────────────────────────
|
|
6
15
|
exports.default = reporter_js_1.PiwiDashboardReporter;
|
|
7
|
-
|
|
16
|
+
// ── Config helpers ───────────────────────────────────────────────────────────
|
|
17
|
+
var config_wrapper_js_1 = require("./public/config-wrapper.js");
|
|
8
18
|
Object.defineProperty(exports, "wrapConfig", { enumerable: true, get: function () { return config_wrapper_js_1.wrapConfig; } });
|
|
9
|
-
var
|
|
10
|
-
Object.defineProperty(exports, "createGlobalSetup", { enumerable: true, get: function () { return
|
|
19
|
+
var global_setup_js_1 = require("./public/global-setup.js");
|
|
20
|
+
Object.defineProperty(exports, "createGlobalSetup", { enumerable: true, get: function () { return global_setup_js_1.createGlobalSetup; } });
|
|
21
|
+
// ── Capture fixtures ─────────────────────────────────────────────────────────
|
|
22
|
+
var capture_fixtures_js_1 = require("./internal/capture/capture-fixtures.js");
|
|
23
|
+
Object.defineProperty(exports, "dashboardFixtures", { enumerable: true, get: function () { return capture_fixtures_js_1.dashboardFixtures; } });
|
|
24
|
+
Object.defineProperty(exports, "extendDashboardFixtures", { enumerable: true, get: function () { return capture_fixtures_js_1.extendDashboardFixtures; } });
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names of the `testInfo` attachments the dashboard fixtures produce and the
|
|
3
|
+
* reporter parses. Single source of truth — imported by the producer
|
|
4
|
+
* (`fixtures.ts`), the consumers (`reporter.ts` / `file-handler.ts`), and the
|
|
5
|
+
* dogfooding `application/tests/fixtures.ts`, so producer and consumer can
|
|
6
|
+
* never drift on a name.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ATTACHMENT_NAMES: {
|
|
9
|
+
readonly locators: "piwi-locators";
|
|
10
|
+
readonly ariaSnapshot: "piwi-aria-snapshot";
|
|
11
|
+
readonly console: "piwi-console";
|
|
12
|
+
readonly network: "piwi-network";
|
|
13
|
+
readonly webVitals: "piwi-web-vitals";
|
|
14
|
+
readonly locatorSuggestion: "piwi-locator-suggestion";
|
|
15
|
+
};
|
|
16
|
+
/** Set of every internal attachment name — used to skip them when collecting user attachments. */
|
|
17
|
+
export declare const INTERNAL_ATTACHMENT_NAMES: ReadonlySet<string>;
|
|
18
|
+
/** Annotation type that surfaces a locator-healing suggestion in the report/trace. */
|
|
19
|
+
export declare const LOCATOR_SUGGESTION_ANNOTATION: "piwi-locator-suggestion";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LOCATOR_SUGGESTION_ANNOTATION = exports.INTERNAL_ATTACHMENT_NAMES = exports.ATTACHMENT_NAMES = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Names of the `testInfo` attachments the dashboard fixtures produce and the
|
|
6
|
+
* reporter parses. Single source of truth — imported by the producer
|
|
7
|
+
* (`fixtures.ts`), the consumers (`reporter.ts` / `file-handler.ts`), and the
|
|
8
|
+
* dogfooding `application/tests/fixtures.ts`, so producer and consumer can
|
|
9
|
+
* never drift on a name.
|
|
10
|
+
*/
|
|
11
|
+
exports.ATTACHMENT_NAMES = {
|
|
12
|
+
locators: 'piwi-locators',
|
|
13
|
+
ariaSnapshot: 'piwi-aria-snapshot',
|
|
14
|
+
console: 'piwi-console',
|
|
15
|
+
network: 'piwi-network',
|
|
16
|
+
webVitals: 'piwi-web-vitals',
|
|
17
|
+
locatorSuggestion: 'piwi-locator-suggestion',
|
|
18
|
+
};
|
|
19
|
+
/** Set of every internal attachment name — used to skip them when collecting user attachments. */
|
|
20
|
+
exports.INTERNAL_ATTACHMENT_NAMES = new Set(Object.values(exports.ATTACHMENT_NAMES));
|
|
21
|
+
/** Annotation type that surfaces a locator-healing suggestion in the report/trace. */
|
|
22
|
+
exports.LOCATOR_SUGGESTION_ANNOTATION = exports.ATTACHMENT_NAMES.locatorSuggestion;
|
|
@@ -3,8 +3,10 @@ import type { Fixtures } from '@playwright/test';
|
|
|
3
3
|
* Playwright fixtures that collect network requests, console entries,
|
|
4
4
|
* web vitals, ARIA snapshots, and locator interaction data during a test.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Capture is wired at the `browser` level, so it works whether a test uses the
|
|
7
|
+
* standard `page` fixture or builds its own pages from `browser` /
|
|
8
|
+
* `browser.newContext()`. Collected data is attached as `piwi-*`
|
|
9
|
+
* test-info attachments which the Piwi Dashboard reporter parses on `onTestEnd`.
|
|
8
10
|
*/
|
|
9
11
|
export declare const dashboardFixtures: Fixtures;
|
|
10
12
|
/**
|
|
@@ -17,7 +19,7 @@ export declare const dashboardFixtures: Fixtures;
|
|
|
17
19
|
* @example
|
|
18
20
|
* ```ts
|
|
19
21
|
* import { test as base } from '@playwright/test';
|
|
20
|
-
* import { extendDashboardFixtures } from '@piwitests/reporter
|
|
22
|
+
* import { extendDashboardFixtures } from '@piwitests/reporter';
|
|
21
23
|
*
|
|
22
24
|
* export const test = extendDashboardFixtures(base);
|
|
23
25
|
* ```
|