@piwitests/reporter 0.11.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.
- package/dist/global-setup-module.d.ts +2 -1
- package/dist/global-setup-module.js +432 -3
- package/dist/index.d.ts +204 -8
- package/dist/index.js +4724 -23
- package/dist/internal/capture/attachments.d.ts +9 -3
- package/dist/internal/capture/attachments.js +46 -20
- package/dist/internal/capture/capture-fixtures.d.ts +110 -7
- package/dist/internal/capture/capture-fixtures.js +2227 -639
- package/dist/internal/capture/inspect-on-failure.d.ts +50 -0
- package/dist/internal/capture/inspect-on-failure.js +66 -0
- package/dist/internal/capture/locator-healing.d.ts +33 -131
- package/dist/internal/capture/locator-healing.js +602 -711
- package/dist/internal/capture/pick-on-failure.d.ts +198 -0
- package/dist/internal/capture/pick-on-failure.js +1203 -0
- package/package.json +9 -4
- package/dist/internal/collect/error-text.d.ts +0 -18
- package/dist/internal/collect/error-text.js +0 -79
- package/dist/internal/collect/metadata-collector.d.ts +0 -32
- package/dist/internal/collect/metadata-collector.js +0 -246
- package/dist/internal/collect/skip-classify.d.ts +0 -27
- package/dist/internal/collect/skip-classify.js +0 -40
- package/dist/internal/collect/step-analyzer.d.ts +0 -103
- package/dist/internal/collect/step-analyzer.js +0 -221
- package/dist/internal/config/env.d.ts +0 -45
- package/dist/internal/config/env.js +0 -153
- package/dist/internal/files/compression.d.ts +0 -5
- package/dist/internal/files/compression.js +0 -69
- package/dist/internal/files/file-handler.d.ts +0 -38
- package/dist/internal/files/file-handler.js +0 -198
- package/dist/internal/streaming/crash-recovery.d.ts +0 -23
- package/dist/internal/streaming/crash-recovery.js +0 -106
- package/dist/internal/streaming/stream-buffer.d.ts +0 -17
- package/dist/internal/streaming/stream-buffer.js +0 -102
- package/dist/internal/streaming/stream-manager.d.ts +0 -88
- package/dist/internal/streaming/stream-manager.js +0 -395
- package/dist/internal/submit/run-submitter.d.ts +0 -67
- package/dist/internal/submit/run-submitter.js +0 -190
- package/dist/internal/submit/serializer.d.ts +0 -45
- package/dist/internal/submit/serializer.js +0 -107
- package/dist/internal/submit/uploader.d.ts +0 -89
- package/dist/internal/submit/uploader.js +0 -226
- package/dist/internal/support/ci.d.ts +0 -2
- package/dist/internal/support/ci.js +0 -32
- package/dist/internal/support/cli-filters.d.ts +0 -1
- package/dist/internal/support/cli-filters.js +0 -51
- package/dist/internal/support/errors.d.ts +0 -8
- package/dist/internal/support/errors.js +0 -15
- package/dist/internal/support/instance-id.d.ts +0 -4
- package/dist/internal/support/instance-id.js +0 -48
- package/dist/internal/support/limiter.d.ts +0 -2
- package/dist/internal/support/limiter.js +0 -27
- package/dist/internal/support/logger.d.ts +0 -26
- package/dist/internal/support/logger.js +0 -43
- package/dist/internal/support/reporter-version.d.ts +0 -2
- package/dist/internal/support/reporter-version.js +0 -54
- package/dist/internal/support/setup-file.d.ts +0 -13
- package/dist/internal/support/setup-file.js +0 -61
- package/dist/internal/support/source-snippet.d.ts +0 -12
- package/dist/internal/support/source-snippet.js +0 -97
- package/dist/internal/support/worker-index.d.ts +0 -7
- package/dist/internal/support/worker-index.js +0 -14
- package/dist/internal/transport/http-client.d.ts +0 -52
- package/dist/internal/transport/http-client.js +0 -201
- package/dist/public/config-wrapper.d.ts +0 -21
- package/dist/public/config-wrapper.js +0 -64
- package/dist/public/global-setup.d.ts +0 -13
- package/dist/public/global-setup.js +0 -146
- package/dist/public/options.d.ts +0 -78
- package/dist/public/options.js +0 -2
- package/dist/public/reporter.d.ts +0 -68
- package/dist/public/reporter.js +0 -376
- package/dist/types/collected.d.ts +0 -96
- package/dist/types/collected.js +0 -10
- package/dist/types/wire.d.ts +0 -174
- package/dist/types/wire.js +0 -14
- package/dist/types.d.ts +0 -11
- package/dist/types.js +0 -27
|
@@ -5,15 +5,21 @@
|
|
|
5
5
|
* the dogfooding `application/tests/fixtures.ts`, so producer and consumer can
|
|
6
6
|
* never drift on a name.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
declare const ATTACHMENT_NAMES: {
|
|
9
9
|
readonly locators: "piwi-locators";
|
|
10
10
|
readonly ariaSnapshot: "piwi-aria-snapshot";
|
|
11
11
|
readonly console: "piwi-console";
|
|
12
12
|
readonly network: "piwi-network";
|
|
13
13
|
readonly webVitals: "piwi-web-vitals";
|
|
14
14
|
readonly locatorSuggestion: "piwi-locator-suggestion";
|
|
15
|
+
readonly pageState: "piwi-page-state";
|
|
16
|
+
readonly userPick: "piwi-user-pick";
|
|
15
17
|
};
|
|
16
18
|
/** Set of every internal attachment name — used to skip them when collecting user attachments. */
|
|
17
|
-
|
|
19
|
+
declare const INTERNAL_ATTACHMENT_NAMES: ReadonlySet<string>;
|
|
18
20
|
/** Annotation type that surfaces a locator-healing suggestion in the report/trace. */
|
|
19
|
-
|
|
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,22 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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',
|
|
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 });
|
|
18
9
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
1
|
+
import { TestType, Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, Locator } from '@playwright/test';
|
|
2
|
+
|
|
2
3
|
type FixtureArgs = {
|
|
3
4
|
[key: string]: any;
|
|
4
5
|
};
|
|
@@ -20,7 +21,108 @@ interface CapturedAttrs {
|
|
|
20
21
|
name?: number;
|
|
21
22
|
classes?: Record<string, number>;
|
|
22
23
|
};
|
|
24
|
+
/** Position among same-role elements, document-wide (null when the element has no role). */
|
|
25
|
+
rolePosition: {
|
|
26
|
+
role: string;
|
|
27
|
+
count: number;
|
|
28
|
+
index: number;
|
|
29
|
+
levelCount?: number;
|
|
30
|
+
} | null;
|
|
31
|
+
/** Anchor-worthy ancestors, nearest first (empty when none found or probing failed). */
|
|
32
|
+
ancestors: Array<{
|
|
33
|
+
tag: string;
|
|
34
|
+
depth: number;
|
|
35
|
+
testId: string | null;
|
|
36
|
+
id: string | null;
|
|
37
|
+
role: string | null;
|
|
38
|
+
ariaLabel: string | null;
|
|
39
|
+
scopedRoleCount?: number;
|
|
40
|
+
testIdCount?: number;
|
|
41
|
+
idCount?: number;
|
|
42
|
+
roleCount?: number;
|
|
43
|
+
}>;
|
|
23
44
|
}
|
|
45
|
+
/** Plain-object projection of a performance entry, shipped out of the page. */
|
|
46
|
+
interface RawVitalEntry {
|
|
47
|
+
startTime?: number;
|
|
48
|
+
value?: number;
|
|
49
|
+
hadRecentInput?: boolean;
|
|
50
|
+
interactionId?: number;
|
|
51
|
+
duration?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Aggregate buffered performance entries into LCP/CLS/INP. Pure and Node-side
|
|
55
|
+
* so it is unit-testable; the in-page evaluate only ships raw entry projections.
|
|
56
|
+
* A null entry list means the entry type is unsupported (non-Chromium) — the
|
|
57
|
+
* metric is null rather than 0 so absence is distinguishable from "no shifts".
|
|
58
|
+
*/
|
|
59
|
+
declare function computeCoreVitals(lcpEntries: RawVitalEntry[] | null, shiftEntries: RawVitalEntry[] | null, eventEntries: RawVitalEntry[] | null): {
|
|
60
|
+
lcp: number | null;
|
|
61
|
+
cls: number | null;
|
|
62
|
+
inp: number | null;
|
|
63
|
+
} | null;
|
|
64
|
+
/** Page state captured at test end. Storage values and cookie values are NEVER included. */
|
|
65
|
+
interface PageState {
|
|
66
|
+
url: string;
|
|
67
|
+
hash: string | null;
|
|
68
|
+
/** `history.state` as JSON, capped and token-masked. */
|
|
69
|
+
historyState: string | null;
|
|
70
|
+
/** Key names + value lengths only. */
|
|
71
|
+
localStorage: Array<{
|
|
72
|
+
key: string;
|
|
73
|
+
length: number;
|
|
74
|
+
}>;
|
|
75
|
+
sessionStorage: Array<{
|
|
76
|
+
key: string;
|
|
77
|
+
length: number;
|
|
78
|
+
}>;
|
|
79
|
+
/** Cookie names + flags only (values are never read). */
|
|
80
|
+
cookies: Array<{
|
|
81
|
+
name: string;
|
|
82
|
+
domain: string;
|
|
83
|
+
path: string;
|
|
84
|
+
httpOnly: boolean;
|
|
85
|
+
secure: boolean;
|
|
86
|
+
sameSite?: string;
|
|
87
|
+
expires?: number;
|
|
88
|
+
}>;
|
|
89
|
+
}
|
|
90
|
+
/** Raw in-page reads shipped out of the evaluate (see `readPageState`). */
|
|
91
|
+
interface RawPageState {
|
|
92
|
+
url: string;
|
|
93
|
+
hash: string | null;
|
|
94
|
+
historyState: string | null;
|
|
95
|
+
localStorage: Array<{
|
|
96
|
+
key: string;
|
|
97
|
+
length: number;
|
|
98
|
+
}>;
|
|
99
|
+
sessionStorage: Array<{
|
|
100
|
+
key: string;
|
|
101
|
+
length: number;
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Assemble the wire page-state from the in-page reads and the context cookies.
|
|
106
|
+
* Pure and Node-side so the sanitization (token masking, caps, value-free
|
|
107
|
+
* cookies) is unit-testable.
|
|
108
|
+
*/
|
|
109
|
+
declare function buildPageState(raw: RawPageState, cookies: Array<Record<string, unknown>> | null): PageState;
|
|
110
|
+
/**
|
|
111
|
+
* Everything the in-page probe needs, serialized into the browser on every
|
|
112
|
+
* action. `tagRoles`/`inputRoles` are the shared role maps (single source of
|
|
113
|
+
* truth in `locator-healing.ts`), and `roleSources` is the CSS selector for
|
|
114
|
+
* every element the probe can resolve a role for — all derived from the map so
|
|
115
|
+
* nothing is hand-maintained twice. Exported so the dogfood mirror
|
|
116
|
+
* (`application/tests/fixtures.ts`) reuses the same assembled object.
|
|
117
|
+
*/
|
|
118
|
+
interface ProbeArg {
|
|
119
|
+
keep: string[];
|
|
120
|
+
tagRoles: Record<string, string>;
|
|
121
|
+
inputRoles: Record<string, string>;
|
|
122
|
+
roleSources: string;
|
|
123
|
+
}
|
|
124
|
+
/** Built once — passed verbatim into evaluate() on every action. */
|
|
125
|
+
declare const CAPTURED_ATTRS_ARG: ProbeArg;
|
|
24
126
|
/**
|
|
25
127
|
* ARIA snapshot that tolerates every Playwright version the reporter supports,
|
|
26
128
|
* returning null instead of throwing so a capture can never fail the test. The
|
|
@@ -34,7 +136,7 @@ interface CapturedAttrs {
|
|
|
34
136
|
* server-side, so the first call already returns a plain flat snapshot.
|
|
35
137
|
* - < 1.49: `locator.ariaSnapshot` does not exist — returns null up front.
|
|
36
138
|
*/
|
|
37
|
-
|
|
139
|
+
declare function ariaSnapshotBestEffort(target: Locator, timeout?: number): Promise<string | null>;
|
|
38
140
|
/**
|
|
39
141
|
* Runs inside the browser via `evaluate()` — probes a captured element for its
|
|
40
142
|
* attributes, geometry, label association, and selector-uniqueness counts.
|
|
@@ -43,7 +145,7 @@ export declare function ariaSnapshotBestEffort(target: Locator, timeout?: number
|
|
|
43
145
|
* `el` is browser-context (no DOM lib in this Node package), hence `any`.
|
|
44
146
|
* Exported for unit testing; still passed directly to `evaluate()` below.
|
|
45
147
|
*/
|
|
46
|
-
|
|
148
|
+
declare function probeElementAttrs(el: any, arg: ProbeArg): CapturedAttrs;
|
|
47
149
|
/**
|
|
48
150
|
* The fixtures `piwiFixtures` / `extendPiwiFixtures` contribute. The single
|
|
49
151
|
* added fixture is `piwiCapture`: an auto, test-scoped teardown hook that
|
|
@@ -52,7 +154,7 @@ export declare function probeElementAttrs(el: any, keep: string[]): CapturedAttr
|
|
|
52
154
|
* all capture. Exported so `piwiFixtures` and the extended `test` carry it in
|
|
53
155
|
* their types (and a collision surfaces to the type checker).
|
|
54
156
|
*/
|
|
55
|
-
|
|
157
|
+
interface PiwiFixtures {
|
|
56
158
|
piwiCapture: void;
|
|
57
159
|
}
|
|
58
160
|
/**
|
|
@@ -64,7 +166,7 @@ export interface PiwiFixtures {
|
|
|
64
166
|
* `browser.newContext()`. Collected data is attached as `piwi-*`
|
|
65
167
|
* test-info attachments which the Piwi Dashboard reporter parses on `onTestEnd`.
|
|
66
168
|
*/
|
|
67
|
-
|
|
169
|
+
declare const piwiFixtures: Fixtures<PiwiFixtures, {}, PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
|
|
68
170
|
/**
|
|
69
171
|
* Extend a Playwright `test` object with the Piwi capture fixtures. The
|
|
70
172
|
* returned `test` carries the existing fixtures plus {@link PiwiFixtures}.
|
|
@@ -81,5 +183,6 @@ export declare const piwiFixtures: Fixtures<PiwiFixtures, {}, PlaywrightTestArgs
|
|
|
81
183
|
* export const test = extendPiwiFixtures(base);
|
|
82
184
|
* ```
|
|
83
185
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
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 };
|