@piwitests/reporter 0.12.0 → 0.13.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.
Files changed (77) hide show
  1. package/dist/global-setup-module.d.ts +2 -1
  2. package/dist/global-setup-module.js +432 -3
  3. package/dist/index.d.ts +204 -8
  4. package/dist/index.js +4724 -23
  5. package/dist/internal/capture/attachments.d.ts +8 -3
  6. package/dist/internal/capture/attachments.js +46 -21
  7. package/dist/internal/capture/capture-fixtures.d.ts +16 -14
  8. package/dist/internal/capture/capture-fixtures.js +2211 -971
  9. package/dist/internal/capture/inspect-on-failure.d.ts +50 -0
  10. package/dist/internal/capture/inspect-on-failure.js +66 -0
  11. package/dist/internal/capture/locator-healing.d.ts +33 -190
  12. package/dist/internal/capture/locator-healing.js +599 -815
  13. package/dist/internal/capture/pick-on-failure.d.ts +198 -0
  14. package/dist/internal/capture/pick-on-failure.js +1203 -0
  15. package/package.json +9 -4
  16. package/dist/internal/collect/error-text.d.ts +0 -18
  17. package/dist/internal/collect/error-text.js +0 -79
  18. package/dist/internal/collect/metadata-collector.d.ts +0 -32
  19. package/dist/internal/collect/metadata-collector.js +0 -246
  20. package/dist/internal/collect/skip-classify.d.ts +0 -27
  21. package/dist/internal/collect/skip-classify.js +0 -40
  22. package/dist/internal/collect/step-analyzer.d.ts +0 -103
  23. package/dist/internal/collect/step-analyzer.js +0 -221
  24. package/dist/internal/config/env.d.ts +0 -46
  25. package/dist/internal/config/env.js +0 -162
  26. package/dist/internal/files/compression.d.ts +0 -5
  27. package/dist/internal/files/compression.js +0 -69
  28. package/dist/internal/files/file-handler.d.ts +0 -38
  29. package/dist/internal/files/file-handler.js +0 -207
  30. package/dist/internal/streaming/crash-recovery.d.ts +0 -23
  31. package/dist/internal/streaming/crash-recovery.js +0 -106
  32. package/dist/internal/streaming/stream-buffer.d.ts +0 -17
  33. package/dist/internal/streaming/stream-buffer.js +0 -102
  34. package/dist/internal/streaming/stream-manager.d.ts +0 -88
  35. package/dist/internal/streaming/stream-manager.js +0 -395
  36. package/dist/internal/submit/run-submitter.d.ts +0 -67
  37. package/dist/internal/submit/run-submitter.js +0 -190
  38. package/dist/internal/submit/serializer.d.ts +0 -45
  39. package/dist/internal/submit/serializer.js +0 -108
  40. package/dist/internal/submit/uploader.d.ts +0 -89
  41. package/dist/internal/submit/uploader.js +0 -226
  42. package/dist/internal/support/ci.d.ts +0 -2
  43. package/dist/internal/support/ci.js +0 -32
  44. package/dist/internal/support/cli-filters.d.ts +0 -1
  45. package/dist/internal/support/cli-filters.js +0 -51
  46. package/dist/internal/support/errors.d.ts +0 -8
  47. package/dist/internal/support/errors.js +0 -15
  48. package/dist/internal/support/instance-id.d.ts +0 -4
  49. package/dist/internal/support/instance-id.js +0 -48
  50. package/dist/internal/support/limiter.d.ts +0 -2
  51. package/dist/internal/support/limiter.js +0 -27
  52. package/dist/internal/support/logger.d.ts +0 -26
  53. package/dist/internal/support/logger.js +0 -43
  54. package/dist/internal/support/reporter-version.d.ts +0 -2
  55. package/dist/internal/support/reporter-version.js +0 -54
  56. package/dist/internal/support/setup-file.d.ts +0 -13
  57. package/dist/internal/support/setup-file.js +0 -61
  58. package/dist/internal/support/source-snippet.d.ts +0 -12
  59. package/dist/internal/support/source-snippet.js +0 -97
  60. package/dist/internal/support/worker-index.d.ts +0 -7
  61. package/dist/internal/support/worker-index.js +0 -14
  62. package/dist/internal/transport/http-client.d.ts +0 -52
  63. package/dist/internal/transport/http-client.js +0 -201
  64. package/dist/public/config-wrapper.d.ts +0 -21
  65. package/dist/public/config-wrapper.js +0 -64
  66. package/dist/public/global-setup.d.ts +0 -13
  67. package/dist/public/global-setup.js +0 -146
  68. package/dist/public/options.d.ts +0 -86
  69. package/dist/public/options.js +0 -2
  70. package/dist/public/reporter.d.ts +0 -68
  71. package/dist/public/reporter.js +0 -376
  72. package/dist/types/collected.d.ts +0 -97
  73. package/dist/types/collected.js +0 -10
  74. package/dist/types/wire.d.ts +0 -176
  75. package/dist/types/wire.js +0 -14
  76. package/dist/types.d.ts +0 -11
  77. package/dist/types.js +0 -27
@@ -5,7 +5,7 @@
5
5
  * the dogfooding `application/tests/fixtures.ts`, so producer and consumer can
6
6
  * never drift on a name.
7
7
  */
8
- export declare const ATTACHMENT_NAMES: {
8
+ declare const ATTACHMENT_NAMES: {
9
9
  readonly locators: "piwi-locators";
10
10
  readonly ariaSnapshot: "piwi-aria-snapshot";
11
11
  readonly console: "piwi-console";
@@ -13,8 +13,13 @@ export declare const ATTACHMENT_NAMES: {
13
13
  readonly webVitals: "piwi-web-vitals";
14
14
  readonly locatorSuggestion: "piwi-locator-suggestion";
15
15
  readonly pageState: "piwi-page-state";
16
+ readonly userPick: "piwi-user-pick";
16
17
  };
17
18
  /** Set of every internal attachment name — used to skip them when collecting user attachments. */
18
- export declare const INTERNAL_ATTACHMENT_NAMES: ReadonlySet<string>;
19
+ declare const INTERNAL_ATTACHMENT_NAMES: ReadonlySet<string>;
19
20
  /** Annotation type that surfaces a locator-healing suggestion in the report/trace. */
20
- export declare const LOCATOR_SUGGESTION_ANNOTATION: "piwi-locator-suggestion";
21
+ declare const LOCATOR_SUGGESTION_ANNOTATION: "piwi-locator-suggestion";
22
+ /** Annotation type that surfaces a human-confirmed replacement locator in the report/trace. */
23
+ declare const USER_PICK_ANNOTATION: "piwi-user-pick";
24
+
25
+ export { ATTACHMENT_NAMES, INTERNAL_ATTACHMENT_NAMES, LOCATOR_SUGGESTION_ANNOTATION, USER_PICK_ANNOTATION };
@@ -1,23 +1,48 @@
1
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
- * (`capture-fixtures.ts`), the consumers (`reporter.ts` / `file-handler.ts`), and
8
- * the 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
- pageState: 'piwi-page-state',
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
19
9
  };
20
- /** Set of every internal attachment name — used to skip them when collecting user attachments. */
21
- exports.INTERNAL_ATTACHMENT_NAMES = new Set(Object.values(exports.ATTACHMENT_NAMES));
22
- /** Annotation type that surfaces a locator-healing suggestion in the report/trace. */
23
- exports.LOCATOR_SUGGESTION_ANNOTATION = exports.ATTACHMENT_NAMES.locatorSuggestion;
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/internal/capture/attachments.ts
21
+ var attachments_exports = {};
22
+ __export(attachments_exports, {
23
+ ATTACHMENT_NAMES: () => ATTACHMENT_NAMES,
24
+ INTERNAL_ATTACHMENT_NAMES: () => INTERNAL_ATTACHMENT_NAMES,
25
+ LOCATOR_SUGGESTION_ANNOTATION: () => LOCATOR_SUGGESTION_ANNOTATION,
26
+ USER_PICK_ANNOTATION: () => USER_PICK_ANNOTATION
27
+ });
28
+ module.exports = __toCommonJS(attachments_exports);
29
+ var ATTACHMENT_NAMES = {
30
+ locators: "piwi-locators",
31
+ ariaSnapshot: "piwi-aria-snapshot",
32
+ console: "piwi-console",
33
+ network: "piwi-network",
34
+ webVitals: "piwi-web-vitals",
35
+ locatorSuggestion: "piwi-locator-suggestion",
36
+ pageState: "piwi-page-state",
37
+ userPick: "piwi-user-pick"
38
+ };
39
+ var INTERNAL_ATTACHMENT_NAMES = new Set(Object.values(ATTACHMENT_NAMES));
40
+ var LOCATOR_SUGGESTION_ANNOTATION = ATTACHMENT_NAMES.locatorSuggestion;
41
+ var USER_PICK_ANNOTATION = ATTACHMENT_NAMES.userPick;
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ ATTACHMENT_NAMES,
45
+ INTERNAL_ATTACHMENT_NAMES,
46
+ LOCATOR_SUGGESTION_ANNOTATION,
47
+ USER_PICK_ANNOTATION
48
+ });
@@ -1,4 +1,5 @@
1
- import type { Fixtures, Locator, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, TestType } from '@playwright/test';
1
+ import { TestType, Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, Locator } from '@playwright/test';
2
+
2
3
  type FixtureArgs = {
3
4
  [key: string]: any;
4
5
  };
@@ -42,7 +43,7 @@ interface CapturedAttrs {
42
43
  }>;
43
44
  }
44
45
  /** Plain-object projection of a performance entry, shipped out of the page. */
45
- export interface RawVitalEntry {
46
+ interface RawVitalEntry {
46
47
  startTime?: number;
47
48
  value?: number;
48
49
  hadRecentInput?: boolean;
@@ -55,13 +56,13 @@ export interface RawVitalEntry {
55
56
  * A null entry list means the entry type is unsupported (non-Chromium) — the
56
57
  * metric is null rather than 0 so absence is distinguishable from "no shifts".
57
58
  */
58
- export declare function computeCoreVitals(lcpEntries: RawVitalEntry[] | null, shiftEntries: RawVitalEntry[] | null, eventEntries: RawVitalEntry[] | null): {
59
+ declare function computeCoreVitals(lcpEntries: RawVitalEntry[] | null, shiftEntries: RawVitalEntry[] | null, eventEntries: RawVitalEntry[] | null): {
59
60
  lcp: number | null;
60
61
  cls: number | null;
61
62
  inp: number | null;
62
63
  } | null;
63
64
  /** Page state captured at test end. Storage values and cookie values are NEVER included. */
64
- export interface PageState {
65
+ interface PageState {
65
66
  url: string;
66
67
  hash: string | null;
67
68
  /** `history.state` as JSON, capped and token-masked. */
@@ -87,7 +88,7 @@ export interface PageState {
87
88
  }>;
88
89
  }
89
90
  /** Raw in-page reads shipped out of the evaluate (see `readPageState`). */
90
- export interface RawPageState {
91
+ interface RawPageState {
91
92
  url: string;
92
93
  hash: string | null;
93
94
  historyState: string | null;
@@ -105,7 +106,7 @@ export interface RawPageState {
105
106
  * Pure and Node-side so the sanitization (token masking, caps, value-free
106
107
  * cookies) is unit-testable.
107
108
  */
108
- export declare function buildPageState(raw: RawPageState, cookies: Array<Record<string, unknown>> | null): PageState;
109
+ declare function buildPageState(raw: RawPageState, cookies: Array<Record<string, unknown>> | null): PageState;
109
110
  /**
110
111
  * Everything the in-page probe needs, serialized into the browser on every
111
112
  * action. `tagRoles`/`inputRoles` are the shared role maps (single source of
@@ -114,14 +115,14 @@ export declare function buildPageState(raw: RawPageState, cookies: Array<Record<
114
115
  * nothing is hand-maintained twice. Exported so the dogfood mirror
115
116
  * (`application/tests/fixtures.ts`) reuses the same assembled object.
116
117
  */
117
- export interface ProbeArg {
118
+ interface ProbeArg {
118
119
  keep: string[];
119
120
  tagRoles: Record<string, string>;
120
121
  inputRoles: Record<string, string>;
121
122
  roleSources: string;
122
123
  }
123
124
  /** Built once — passed verbatim into evaluate() on every action. */
124
- export declare const CAPTURED_ATTRS_ARG: ProbeArg;
125
+ declare const CAPTURED_ATTRS_ARG: ProbeArg;
125
126
  /**
126
127
  * ARIA snapshot that tolerates every Playwright version the reporter supports,
127
128
  * returning null instead of throwing so a capture can never fail the test. The
@@ -135,7 +136,7 @@ export declare const CAPTURED_ATTRS_ARG: ProbeArg;
135
136
  * server-side, so the first call already returns a plain flat snapshot.
136
137
  * - < 1.49: `locator.ariaSnapshot` does not exist — returns null up front.
137
138
  */
138
- export declare function ariaSnapshotBestEffort(target: Locator, timeout?: number): Promise<string | null>;
139
+ declare function ariaSnapshotBestEffort(target: Locator, timeout?: number): Promise<string | null>;
139
140
  /**
140
141
  * Runs inside the browser via `evaluate()` — probes a captured element for its
141
142
  * attributes, geometry, label association, and selector-uniqueness counts.
@@ -144,7 +145,7 @@ export declare function ariaSnapshotBestEffort(target: Locator, timeout?: number
144
145
  * `el` is browser-context (no DOM lib in this Node package), hence `any`.
145
146
  * Exported for unit testing; still passed directly to `evaluate()` below.
146
147
  */
147
- export declare function probeElementAttrs(el: any, arg: ProbeArg): CapturedAttrs;
148
+ declare function probeElementAttrs(el: any, arg: ProbeArg): CapturedAttrs;
148
149
  /**
149
150
  * The fixtures `piwiFixtures` / `extendPiwiFixtures` contribute. The single
150
151
  * added fixture is `piwiCapture`: an auto, test-scoped teardown hook that
@@ -153,7 +154,7 @@ export declare function probeElementAttrs(el: any, arg: ProbeArg): CapturedAttrs
153
154
  * all capture. Exported so `piwiFixtures` and the extended `test` carry it in
154
155
  * their types (and a collision surfaces to the type checker).
155
156
  */
156
- export interface PiwiFixtures {
157
+ interface PiwiFixtures {
157
158
  piwiCapture: void;
158
159
  }
159
160
  /**
@@ -165,7 +166,7 @@ export interface PiwiFixtures {
165
166
  * `browser.newContext()`. Collected data is attached as `piwi-*`
166
167
  * test-info attachments which the Piwi Dashboard reporter parses on `onTestEnd`.
167
168
  */
168
- export declare const piwiFixtures: Fixtures<PiwiFixtures, {}, PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
169
+ declare const piwiFixtures: Fixtures<PiwiFixtures, {}, PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
169
170
  /**
170
171
  * Extend a Playwright `test` object with the Piwi capture fixtures. The
171
172
  * returned `test` carries the existing fixtures plus {@link PiwiFixtures}.
@@ -182,5 +183,6 @@ export declare const piwiFixtures: Fixtures<PiwiFixtures, {}, PlaywrightTestArgs
182
183
  * export const test = extendPiwiFixtures(base);
183
184
  * ```
184
185
  */
185
- export declare function extendPiwiFixtures<TestArgs extends FixtureArgs, WorkerArgs extends FixtureArgs>(test: TestType<TestArgs, WorkerArgs>): TestType<TestArgs & PiwiFixtures, WorkerArgs>;
186
- export {};
186
+ declare function extendPiwiFixtures<TestArgs extends FixtureArgs, WorkerArgs extends FixtureArgs>(test: TestType<TestArgs, WorkerArgs>): TestType<TestArgs & PiwiFixtures, WorkerArgs>;
187
+
188
+ export { CAPTURED_ATTRS_ARG, type PageState, type PiwiFixtures, type ProbeArg, type RawPageState, type RawVitalEntry, ariaSnapshotBestEffort, buildPageState, computeCoreVitals, extendPiwiFixtures, piwiFixtures, probeElementAttrs };