@piwitests/reporter 0.63.0 → 0.64.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,4 +1,4 @@
1
- export { FAILURE_SCREENSHOT_ATTACHMENT } from '@piwitests/core/wire';
1
+ export { F as FAILURE_SCREENSHOT_ATTACHMENT } from '../../wire-7zsqlBoY.js';
2
2
 
3
3
  /**
4
4
  * Names of the `testInfo` attachments the dashboard fixtures produce and the
@@ -1,10 +1,65 @@
1
- import { ProbeArg } from '@piwitests/picker-dom';
2
- export { ProbeArg, ProbedAttrs, probeElementAttrs } from '@piwitests/picker-dom';
3
- import { PageInteraction } from '@piwitests/core/page-interaction';
1
+ import { P as ProbeArg, a as ProbedAttrs } from '../../types-CGr9jJZ_.js';
4
2
  import { Page, TestInfo, TestType, Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, Locator } from '@playwright/test';
5
- import { LocatorPageUse, ProcessRole, RoleCost } from '@piwitests/core/wire';
6
- import { RunIntent, IntentAnswer } from '@piwitests/core/run-channel';
7
- import { JsCoverageEntry } from '@piwitests/core/code-reach';
3
+ import { L as LocatorPageUse, P as ProcessRole, R as RoleCost } from '../../wire-7zsqlBoY.js';
4
+
5
+ /**
6
+ * Runs inside the browser via `evaluate()` (live picker) or as part of a
7
+ * concatenated `<script>` (snapshot picker) — probes an element for its
8
+ * attributes, geometry, label association, and selector-uniqueness counts,
9
+ * plus (when `arg.includeStructural`) its position among same-role elements
10
+ * and anchor-worthy ancestors, which power name-free and ancestor-scoped
11
+ * locator alternatives. With `arg.countMatches` false it counts nothing and
12
+ * reports the anchors alone. The test id is read from `arg.testIdAttribute`,
13
+ * `data-testid` by default.
14
+ *
15
+ * Must stay a fully self-contained function (no references to this module's
16
+ * closure): both hosts re-serialize it via `Function.prototype.toString()`.
17
+ * `el` is browser-context (no DOM lib in this package), hence `any`.
18
+ */
19
+ declare function probeElementAttrs(el: any, arg: ProbeArg): ProbedAttrs;
20
+
21
+ /**
22
+ * What the page was doing at test end beyond its DOM, as the capture fixtures read it: the element holding
23
+ * keyboard focus, the element under the mouse, a text selection, the checkboxes in the indeterminate state. A
24
+ * trace snapshot records none of these, so the dashboard applies them to the failure-time DOM it renders.
25
+ *
26
+ * An element is named by its **element path**: the tag and the position among same-tag siblings
27
+ * (`:nth-of-type`) of each element from the root down, `/`-separated (`html:1/body:1/form:1/input:2`), with
28
+ * `|` stepping into the open shadow root of the element before it (`html:1/body:1/x-card:1|button:1`). Only
29
+ * same-tag siblings count, so the elements a trace snapshot drops (scripts, `noscript`, preload links) never
30
+ * shift it. A text position is an element path and a character offset into that element's text, scripts and
31
+ * styles left out, so it holds however the text was split into nodes. Positions only: a field's value and
32
+ * the selected text are never read.
33
+ */
34
+ /** One element of the page, by element path, with a short label for people (`input#email`, `button "Save"`). */
35
+ interface ElementRef {
36
+ path: string;
37
+ label: string;
38
+ }
39
+ /** A position in the page's text: an element and a character offset into its text. */
40
+ interface TextPoint {
41
+ path: string;
42
+ offset: number;
43
+ }
44
+ interface PageInteraction {
45
+ /** The focused element; `visible` when the browser drew its focus ring (`:focus-visible`). */
46
+ focus?: {
47
+ element: ElementRef;
48
+ visible: boolean;
49
+ /** The caret or selected range in a text field, as `[start, end]`. */
50
+ selection?: [number, number];
51
+ };
52
+ /** The innermost element under the mouse (`:hover`). */
53
+ hover?: ElementRef;
54
+ /** A text selection in the page outside a field, and its length in characters. */
55
+ selection?: {
56
+ start: TextPoint;
57
+ end: TextPoint;
58
+ length: number;
59
+ };
60
+ /** Checkboxes in the indeterminate state, which only a script can set. */
61
+ indeterminate?: ElementRef[];
62
+ }
8
63
 
9
64
  /** A main-frame navigation, full or same-document: the page starts over. */
10
65
  declare function noteNavigation(page: object): void;
@@ -27,6 +82,42 @@ declare class LocatorPageLog {
27
82
  list(): LocatorPageUse[];
28
83
  }
29
84
 
85
+ /**
86
+ * The run channel: each worker of a test run the editor started keeps one connection, from before its first test to its
87
+ * end, to the local socket the editor service listens on for the record channel's hand-offs
88
+ * (`@piwitests/core/ide-recorder`). The run's environment names it as `PIWI_RUN_CHANNEL`, `<socket path>#<token>` as
89
+ * `PIWI_RECORD_CHANNEL` is (`formatRecordChannel`, `parseRecordChannel`). Its first line, `run-attach`, tells it from a
90
+ * hand-off's `attach`. Over it the worker says which test it runs and where it stopped, and the editor service steers
91
+ * it: pause, step, resume, finish, run to a line, end the test, the breakpoints, an image of the stopped page, and, at
92
+ * a stop the pause bar shows, the bar's own **Pick a locator** and **Record here**, the check panel's **Check an
93
+ * element** and a region's ARIA snapshot, started from outside the page; at any stop, the responses the test kept (an
94
+ * interactive run keeps the text bodies of its pages' fetch and XHR answers), one of them to mock, and a locator's
95
+ * matches; and, for a viewer outside the page, the stopped page's live view (`@piwitests/core/run-view`: its frames,
96
+ * the input played on it) and the locator of the element under a point of an image of it; and, for an agent (the
97
+ * editor's MCP server), the stopped page's ARIA snapshot in AI mode, an action on one of its elements by its ref, that
98
+ * element's ranked locators, what the run does as it goes (`events`), and its browser bound for Playwright's own tools
99
+ * on request (`bind`). A worker holds a failure for the editor only once the service said it shows and answers one
100
+ * (`holds` in its `run-attach`, answered by `attached`): a service that predates it says nothing, and the failure goes
101
+ * on. A person shares the run on the team instance's run page from the editor's surfaces (`share`, **Share live**):
102
+ * each worker then opens its live view stream there (`@piwitests/core/live-view`), and says how it stands (`live`).
103
+ * Each message is one line of JSON, at most `MAX_HANDOFF_LINE` long (`lineReader`), checked field by field on both
104
+ * sides. A side ignores a message it cannot read.
105
+ */
106
+
107
+ /**
108
+ * What a stop the pause bar shows starts from outside the page, in the test's window: the bar's **Pick a locator**
109
+ * (`pick`) and **Record here** (`record`), their results going where the bar's go; the check panel's **Check an
110
+ * element** (`assert`), through the record channel's hand-off in its `check` mode, the editor service writing the
111
+ * check; and a region picked with the bar's picker (`assert-region`), whose ARIA snapshot the worker reads and sends
112
+ * (`region`).
113
+ */
114
+ type RunIntent = 'pick' | 'record' | 'assert' | 'assert-region';
115
+ /** Whether an intent started, or why not, in one sentence. */
116
+ interface IntentAnswer {
117
+ ok: boolean;
118
+ message: string;
119
+ }
120
+
30
121
  /**
31
122
  * The pause bar's Pick a locator and Record here, started from outside the page (the editor's hub, for Piwi Picker):
32
123
  * the bar takes an intent while it waits for its answer, and one handed to it while it is about to (its highlight
@@ -68,6 +159,38 @@ declare function callMethod(target: object, prop: string | symbol, args: unknown
68
159
  */
69
160
  declare function internalCall<T>(owner: unknown, run: () => Promise<T>): Promise<T>;
70
161
 
162
+ /**
163
+ * Code reach: the application source files whose functions ran during a test,
164
+ * from Chromium's JavaScript coverage. A file counts when at least one of its
165
+ * functions ran, not counting a script's top-level code (importing a module
166
+ * runs its top level, so it says nothing about the test) and code that maps to
167
+ * no source.
168
+ *
169
+ * Through a source map, a function belongs to the source its start maps to,
170
+ * when some code inside it maps there too. Code a bundler or a dev server
171
+ * generates (a module factory, a preload helper, a hot-reload hook) has no
172
+ * mapping of its own and would otherwise take that of whatever precedes it;
173
+ * it runs when a module is imported, so it counts for no file.
174
+ *
175
+ * The reporter feeds this with V8's function coverage, read over a CDP
176
+ * session; this module holds the pure part.
177
+ */
178
+
179
+ /** One script of a JavaScript coverage report: V8's `Profiler.takePreciseCoverage` entry, with its source when read. */
180
+ interface JsCoverageEntry {
181
+ url: string;
182
+ source?: string;
183
+ functions: Array<{
184
+ functionName: string;
185
+ isBlockCoverage?: boolean;
186
+ ranges: Array<{
187
+ startOffset: number;
188
+ endOffset: number;
189
+ count: number;
190
+ }>;
191
+ }>;
192
+ }
193
+
71
194
  /** Where code reach resolves paths. */
72
195
  interface CodeReachRoots {
73
196
  /** Directories a module path or a map source is tried against, first match wins; the repository root is last. */
@@ -757,4 +880,4 @@ declare const piwiFixtures: Fixtures<PiwiFixtures, PiwiWorkerFixtures, Playwrigh
757
880
  */
758
881
  declare function extendPiwiFixtures<TestArgs extends FixtureArgs, WorkerArgs extends FixtureArgs>(test: TestType<TestArgs, WorkerArgs>): TestType<TestArgs & PiwiFixtures, WorkerArgs & PiwiWorkerFixtures>;
759
882
 
760
- export { CAPTURED_ATTRS_ARG, type IntentStop, LocatorPageLog, type PageState, type PiwiFixtures, type PiwiWorkerFixtures, type RawPageState, type RawVitalEntry, activeResourceLedger, ariaSnapshotBestEffort, ariaSnapshotJSONBestEffort, boxCaptureFrames, buildPageState, callMethod, codeReachRoots, computeCoreVitals, configuredCodeReachRoots, errorPlace, extendPiwiFixtures, failureError, intentAt, internalCall, noteLocatorCall, noteNavigation, noteResourceUse, pageMapFetcher, piwiFixtures, readPageInteraction, recordResourceCensus, resolveCodeReach, startCodeReach, startResourceLedger, stopCodeReach, stopResourceLedger };
883
+ export { CAPTURED_ATTRS_ARG, type IntentStop, LocatorPageLog, type PageState, type PiwiFixtures, type PiwiWorkerFixtures, ProbeArg, ProbedAttrs, type RawPageState, type RawVitalEntry, activeResourceLedger, ariaSnapshotBestEffort, ariaSnapshotJSONBestEffort, boxCaptureFrames, buildPageState, callMethod, codeReachRoots, computeCoreVitals, configuredCodeReachRoots, errorPlace, extendPiwiFixtures, failureError, intentAt, internalCall, noteLocatorCall, noteNavigation, noteResourceUse, pageMapFetcher, piwiFixtures, probeElementAttrs, readPageInteraction, recordResourceCensus, resolveCodeReach, startCodeReach, startResourceLedger, stopCodeReach, stopResourceLedger };