@piwitests/reporter 0.53.0 → 0.55.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/cli/index.js +1442 -294
- package/dist/global-setup-module.js +71 -42
- package/dist/index.d.ts +21 -9
- package/dist/index.js +2421 -1555
- package/dist/internal/capture/attachments.d.ts +2 -0
- package/dist/internal/capture/attachments.js +2 -0
- package/dist/internal/capture/capture-fixtures.d.ts +47 -21
- package/dist/internal/capture/capture-fixtures.js +1027 -391
- package/package.json +1 -1
- package/templates/skills/investigate-failure/SKILL.md +1 -1
- package/templates/skills/stabilize-flaky-tests/SKILL.md +1 -1
- package/templates/skills/write-the-missing-test/SKILL.md +32 -6
|
@@ -17,6 +17,8 @@ declare const ATTACHMENT_NAMES: {
|
|
|
17
17
|
readonly pageInventory: "piwi-page-inventory";
|
|
18
18
|
readonly locatorPages: "piwi-locator-pages";
|
|
19
19
|
readonly codeReach: "piwi-code-reach";
|
|
20
|
+
readonly browserCoverage: "piwi-browser-coverage";
|
|
21
|
+
readonly browserFunctions: "piwi-browser-functions";
|
|
20
22
|
readonly serverCoverageRequests: "piwi-server-coverage-requests";
|
|
21
23
|
readonly webVitals: "piwi-web-vitals";
|
|
22
24
|
readonly locatorSuggestion: "piwi-locator-suggestion";
|
|
@@ -42,6 +42,8 @@ var ATTACHMENT_NAMES = {
|
|
|
42
42
|
pageInventory: "piwi-page-inventory",
|
|
43
43
|
locatorPages: "piwi-locator-pages",
|
|
44
44
|
codeReach: "piwi-code-reach",
|
|
45
|
+
browserCoverage: "piwi-browser-coverage",
|
|
46
|
+
browserFunctions: "piwi-browser-functions",
|
|
45
47
|
serverCoverageRequests: "piwi-server-coverage-requests",
|
|
46
48
|
webVitals: "piwi-web-vitals",
|
|
47
49
|
locatorSuggestion: "piwi-locator-suggestion",
|
|
@@ -35,6 +35,13 @@ declare class LocatorPageLog {
|
|
|
35
35
|
* layout leaves Playwright's defaults untouched.
|
|
36
36
|
*/
|
|
37
37
|
declare function boxCaptureFrames(extraPrefixes?: readonly string[]): void;
|
|
38
|
+
/**
|
|
39
|
+
* Call a Playwright method on its own receiver. Playwright names an API call
|
|
40
|
+
* after the method frame the call enters, so the call keeps its real name
|
|
41
|
+
* (`locator.fill: Timeout …`); a call through `Function.prototype.apply` is
|
|
42
|
+
* named `apply`.
|
|
43
|
+
*/
|
|
44
|
+
declare function callMethod(target: object, prop: string | symbol, args: unknown[]): unknown;
|
|
38
45
|
/**
|
|
39
46
|
* Run a page read as an internal Playwright call: every API call made inside
|
|
40
47
|
* `run` is kept out of the test's steps and the trace. `owner` is the page (or
|
|
@@ -47,9 +54,17 @@ declare function internalCall<T>(owner: unknown, run: () => Promise<T>): Promise
|
|
|
47
54
|
interface CodeReachRoots {
|
|
48
55
|
/** Directories a module path or a map source is tried against, first match wins; the repository root is last. */
|
|
49
56
|
roots: string[];
|
|
57
|
+
/**
|
|
58
|
+
* Directories tried before `roots` for the scripts an origin serves, or, when the script's own origin has none,
|
|
59
|
+
* that a page at the origin loads: an application served by several dev servers (one per portal) resolves each
|
|
60
|
+
* one's modules against its own directory.
|
|
61
|
+
*/
|
|
62
|
+
byOrigin?: Map<string, string[]>;
|
|
50
63
|
/** Paths go out relative to it. */
|
|
51
64
|
repoRoot: string;
|
|
52
65
|
}
|
|
66
|
+
/** The `codeReachRoots` option: directories for every script, or directories per origin, `*` for the rest. */
|
|
67
|
+
type CodeReachRootsOption = string[] | Record<string, string | string[]>;
|
|
53
68
|
/** Fetches a source map's text; null when it cannot. */
|
|
54
69
|
type MapFetcher = (url: string) => Promise<string | null>;
|
|
55
70
|
/**
|
|
@@ -60,20 +75,30 @@ type MapFetcher = (url: string) => Promise<string | null>;
|
|
|
60
75
|
interface CoveredScript extends JsCoverageEntry {
|
|
61
76
|
/** V8's content hash of the script; without it, the version is a hash of `source`. */
|
|
62
77
|
hash?: string;
|
|
78
|
+
/** The address of the page's document as it parsed the script, whose origin's roots it falls back on. */
|
|
79
|
+
pageUrl?: string;
|
|
63
80
|
}
|
|
64
81
|
/**
|
|
65
|
-
* The roots for a test: `codeReachRoots` when set,
|
|
66
|
-
* directory; the repository root always
|
|
67
|
-
* sources from the project root (Turbopack's
|
|
82
|
+
* The roots for a test: `codeReachRoots` when set (an array, or the `*` entry of
|
|
83
|
+
* an object), else the Playwright config's directory; the repository root always
|
|
84
|
+
* comes last, since bundlers name sources from the project root (Turbopack's
|
|
85
|
+
* `[project]/`). An object's other keys are origins, each with the directories
|
|
86
|
+
* tried first for its scripts. Relative directories resolve against the config's.
|
|
87
|
+
*/
|
|
88
|
+
declare function codeReachRoots(configDir: string, configured: CodeReachRootsOption | null | undefined): CodeReachRoots;
|
|
89
|
+
/**
|
|
90
|
+
* The repository-relative files the covered scripts reached, sorted and capped.
|
|
91
|
+
* A script whose own origin has no roots takes those of its page's origin: the
|
|
92
|
+
* page's address as it parsed the script, else `pageUrl`.
|
|
68
93
|
*/
|
|
69
|
-
declare function
|
|
70
|
-
/** The repository-relative files the covered scripts reached, sorted and capped. */
|
|
71
|
-
declare function resolveCodeReach(entries: CoveredScript[], roots: CodeReachRoots, fetchMap: MapFetcher): Promise<string[]>;
|
|
94
|
+
declare function resolveCodeReach(entries: CoveredScript[], roots: CodeReachRoots, fetchMap: MapFetcher, pageUrl?: string): Promise<string[]>;
|
|
72
95
|
/** A map fetcher through the page's request context, bounded in size and time. */
|
|
73
96
|
declare function pageMapFetcher(page: Page): MapFetcher;
|
|
74
97
|
/**
|
|
75
98
|
* Start function coverage on a page, with the debugger on to learn each
|
|
76
|
-
* script's version
|
|
99
|
+
* script's version and to stop as each document is left (its `beforeunload`,
|
|
100
|
+
* from a listener the capture adds in an isolated world); false when the
|
|
101
|
+
* browser has none or it fails.
|
|
77
102
|
*/
|
|
78
103
|
declare function startCodeReach(page: Page): Promise<boolean>;
|
|
79
104
|
/**
|
|
@@ -474,8 +499,11 @@ declare function computeCoreVitals(lcpEntries: RawVitalEntry[] | null, shiftEntr
|
|
|
474
499
|
cls: number | null;
|
|
475
500
|
inp: number | null;
|
|
476
501
|
} | null;
|
|
477
|
-
/**
|
|
478
|
-
|
|
502
|
+
/**
|
|
503
|
+
* The code reach roots from `PIWI_CODE_REACH_ROOTS`: a JSON array, a JSON object
|
|
504
|
+
* of directories per origin (`*` for every other origin), or a path list.
|
|
505
|
+
*/
|
|
506
|
+
declare function configuredCodeReachRoots(): CodeReachRootsOption | null;
|
|
479
507
|
/** Page state captured at test end. Storage values and cookie values are NEVER included. */
|
|
480
508
|
interface PageState extends PageInteraction {
|
|
481
509
|
url: string;
|
|
@@ -553,13 +581,6 @@ declare function ariaSnapshotBestEffort(target: Locator, timeout?: number): Prom
|
|
|
553
581
|
* yields null and the capture proceeds with the YAML alone.
|
|
554
582
|
*/
|
|
555
583
|
declare function ariaSnapshotJSONBestEffort(target: Locator, timeout?: number): Promise<string | null>;
|
|
556
|
-
/**
|
|
557
|
-
* Call a Playwright method on its own receiver. Playwright names an API call
|
|
558
|
-
* after the method frame the call enters, so the call keeps its real name
|
|
559
|
-
* (`locator.fill: Timeout …`); a call through `Function.prototype.apply` is
|
|
560
|
-
* named `apply`.
|
|
561
|
-
*/
|
|
562
|
-
declare function callMethod(target: object, prop: string | symbol, args: unknown[]): unknown;
|
|
563
584
|
/**
|
|
564
585
|
* The fixtures `piwiFixtures` / `extendPiwiFixtures` contribute. The single
|
|
565
586
|
* added fixture is `piwiCapture`: an auto, test-scoped teardown hook that
|
|
@@ -575,9 +596,11 @@ interface PiwiFixtures {
|
|
|
575
596
|
* The worker fixture `piwiFixtures` / `extendPiwiFixtures` contribute:
|
|
576
597
|
* `piwiResources`, an auto, worker-scoped fixture that keeps the worker's
|
|
577
598
|
* resource ledger (the browsers, contexts, pages and API request contexts its
|
|
578
|
-
* tests open) from before the first hook to the worker's shutdown
|
|
579
|
-
*
|
|
580
|
-
*
|
|
599
|
+
* tests open) from before the first hook to the worker's shutdown, and records
|
|
600
|
+
* the calls tests make through the API request contexts `playwright.request`
|
|
601
|
+
* creates, the `request` fixture's among them. Its name is **reserved** like
|
|
602
|
+
* `piwiCapture`'s: a fixture of your own with that name replaces it and turns
|
|
603
|
+
* the ledger and those calls' capture off.
|
|
581
604
|
*/
|
|
582
605
|
interface PiwiWorkerFixtures {
|
|
583
606
|
piwiResources: void;
|
|
@@ -588,8 +611,11 @@ interface PiwiWorkerFixtures {
|
|
|
588
611
|
*
|
|
589
612
|
* Capture is wired at the `browser` level, so it works whether a test uses the
|
|
590
613
|
* standard `page` fixture or builds its own pages from `browser` /
|
|
591
|
-
* `browser.newContext()`.
|
|
592
|
-
*
|
|
614
|
+
* `browser.newContext()`. The calls a test makes through an API request
|
|
615
|
+
* context (the `request` fixture, `playwright.request.newContext()`,
|
|
616
|
+
* `page.request`) are recorded with its network requests. Collected data is
|
|
617
|
+
* attached as `piwi-*` test-info attachments which the Piwi Dashboard reporter
|
|
618
|
+
* parses on `onTestEnd`.
|
|
593
619
|
*/
|
|
594
620
|
declare const piwiFixtures: Fixtures<PiwiFixtures, PiwiWorkerFixtures, PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
|
|
595
621
|
/**
|