@piwitests/reporter 0.20.0 → 0.22.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.
@@ -1,47 +1,10 @@
1
+ import { ProbeArg } from '@piwitests/picker-dom';
2
+ export { ProbeArg, ProbedAttrs, probeElementAttrs } from '@piwitests/picker-dom';
1
3
  import { TestType, Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, Locator } from '@playwright/test';
2
4
 
3
5
  type FixtureArgs = {
4
6
  [key: string]: any;
5
7
  };
6
- /** Shape returned by the in-page element probe (see `wrapLocator`). */
7
- interface CapturedAttrs {
8
- tagName: string;
9
- attributes: Record<string, string | null>;
10
- textContent: string;
11
- center: {
12
- x: number;
13
- y: number;
14
- };
15
- /** True when the element has an associated <label> — gates getByLabel. */
16
- hasLabel: boolean;
17
- /** querySelectorAll match counts for candidate selectors (uniqueness probe). */
18
- selectorCounts: {
19
- testId?: number;
20
- id?: number;
21
- name?: number;
22
- classes?: Record<string, number>;
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
- }>;
44
- }
45
8
  /** Plain-object projection of a performance entry, shipped out of the page. */
46
9
  interface RawVitalEntry {
47
10
  startTime?: number;
@@ -115,13 +78,6 @@ declare function buildPageState(raw: RawPageState, cookies: Array<Record<string,
115
78
  * nothing is hand-maintained twice. Exported so the dogfood mirror
116
79
  * (`application/tests/fixtures.ts`) reuses the same assembled object.
117
80
  */
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
81
  declare const CAPTURED_ATTRS_ARG: ProbeArg;
126
82
  /**
127
83
  * ARIA snapshot that tolerates every Playwright version the reporter supports,
@@ -137,15 +93,6 @@ declare const CAPTURED_ATTRS_ARG: ProbeArg;
137
93
  * - < 1.49: `locator.ariaSnapshot` does not exist — returns null up front.
138
94
  */
139
95
  declare function ariaSnapshotBestEffort(target: Locator, timeout?: number): Promise<string | null>;
140
- /**
141
- * Runs inside the browser via `evaluate()` — probes a captured element for its
142
- * attributes, geometry, label association, and selector-uniqueness counts.
143
- * Must stay a fully self-contained function (no references to this module's
144
- * closure): Playwright serializes it and executes it in the page, browser-side.
145
- * `el` is browser-context (no DOM lib in this Node package), hence `any`.
146
- * Exported for unit testing; still passed directly to `evaluate()` below.
147
- */
148
- declare function probeElementAttrs(el: any, arg: ProbeArg): CapturedAttrs;
149
96
  /**
150
97
  * The fixtures `piwiFixtures` / `extendPiwiFixtures` contribute. The single
151
98
  * added fixture is `piwiCapture`: an auto, test-scoped teardown hook that
@@ -185,4 +132,4 @@ declare const piwiFixtures: Fixtures<PiwiFixtures, {}, PlaywrightTestArgs & Play
185
132
  */
186
133
  declare function extendPiwiFixtures<TestArgs extends FixtureArgs, WorkerArgs extends FixtureArgs>(test: TestType<TestArgs, WorkerArgs>): TestType<TestArgs & PiwiFixtures, WorkerArgs>;
187
134
 
188
- export { CAPTURED_ATTRS_ARG, type PageState, type PiwiFixtures, type ProbeArg, type RawPageState, type RawVitalEntry, ariaSnapshotBestEffort, buildPageState, computeCoreVitals, extendPiwiFixtures, piwiFixtures, probeElementAttrs };
135
+ export { CAPTURED_ATTRS_ARG, type PageState, type PiwiFixtures, type RawPageState, type RawVitalEntry, ariaSnapshotBestEffort, buildPageState, computeCoreVitals, extendPiwiFixtures, piwiFixtures };