@piwitests/reporter 0.40.0 → 0.42.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/README.md +3 -3
- package/dist/cli/index.js +5310 -1221
- package/dist/global-setup-module.js +23 -5
- package/dist/index.d.ts +21 -0
- package/dist/index.js +3580 -2331
- package/dist/internal/capture/attachments.d.ts +1 -0
- package/dist/internal/capture/attachments.js +1 -0
- package/dist/internal/capture/capture-fixtures.d.ts +29 -2
- package/dist/internal/capture/capture-fixtures.js +1179 -102
- package/dist/internal/capture/locator-healing.js +2 -1
- package/dist/internal/capture/pick-on-failure.js +8 -1
- package/package.json +1 -1
- package/templates/skills/fix-a-reported-bug/SKILL.md +47 -0
- package/templates/skills/investigate-failure/SKILL.md +1 -1
- package/templates/skills/run-the-right-tests/SKILL.md +13 -1
- package/templates/skills/setup-piwi/SKILL.md +1 -1
- package/templates/skills/stabilize-flaky-tests/SKILL.md +30 -15
|
@@ -80,6 +80,8 @@ var DEFAULTS = {
|
|
|
80
80
|
// Off by default: the page inventory reads control and link names from every
|
|
81
81
|
// visited page, so it stays opt-in until a project turns it on.
|
|
82
82
|
capturePageInventory: false,
|
|
83
|
+
// Off by default: JavaScript coverage slows the page, so a scheduled job opts in.
|
|
84
|
+
captureCodeReach: false,
|
|
83
85
|
captureServerTraces: true,
|
|
84
86
|
sampleAriaOnPass: true,
|
|
85
87
|
uploadManifest: true,
|
|
@@ -116,6 +118,8 @@ var PIWI_ENV_KEYS = {
|
|
|
116
118
|
captureLocators: "PIWI_CAPTURE_LOCATORS",
|
|
117
119
|
capturePageState: "PIWI_CAPTURE_PAGE_STATE",
|
|
118
120
|
capturePageInventory: "PIWI_CAPTURE_PAGE_INVENTORY",
|
|
121
|
+
captureCodeReach: "PIWI_CAPTURE_CODE_REACH",
|
|
122
|
+
codeReachRoots: "PIWI_CODE_REACH_ROOTS",
|
|
119
123
|
captureServerTraces: "PIWI_CAPTURE_SERVER_TRACES",
|
|
120
124
|
sampleAriaOnPass: "PIWI_SAMPLE_ARIA_ON_PASS",
|
|
121
125
|
uploadManifest: "PIWI_UPLOAD_MANIFEST",
|
|
@@ -133,6 +137,7 @@ var PIWI_ENV_KEYS = {
|
|
|
133
137
|
aiScreenshotFallback: "PIWI_AI_SCREENSHOT_FALLBACK"
|
|
134
138
|
};
|
|
135
139
|
var PIWI_DESKTOP_CONFIG_ENV = "PIWI_DESKTOP_CONFIG";
|
|
140
|
+
var PIWI_SHARD_ENV = "PIWI_SHARD";
|
|
136
141
|
function readBool(val) {
|
|
137
142
|
if (val === void 0) return void 0;
|
|
138
143
|
return val === "true";
|
|
@@ -158,6 +163,7 @@ var ENV_FALLBACK_SPECS = [
|
|
|
158
163
|
{ option: "captureLocators", env: PIWI_ENV_KEYS.captureLocators, kind: "bool" },
|
|
159
164
|
{ option: "capturePageState", env: PIWI_ENV_KEYS.capturePageState, kind: "bool" },
|
|
160
165
|
{ option: "capturePageInventory", env: PIWI_ENV_KEYS.capturePageInventory, kind: "bool" },
|
|
166
|
+
{ option: "captureCodeReach", env: PIWI_ENV_KEYS.captureCodeReach, kind: "bool" },
|
|
161
167
|
{ option: "captureServerTraces", env: PIWI_ENV_KEYS.captureServerTraces, kind: "bool" },
|
|
162
168
|
{ option: "sampleAriaOnPass", env: PIWI_ENV_KEYS.sampleAriaOnPass, kind: "bool" },
|
|
163
169
|
{ option: "uploadManifest", env: PIWI_ENV_KEYS.uploadManifest, kind: "bool" },
|
|
@@ -484,6 +490,20 @@ function detectCiRunLabel() {
|
|
|
484
490
|
return null;
|
|
485
491
|
}
|
|
486
492
|
|
|
493
|
+
// src/internal/support/shard-info.ts
|
|
494
|
+
function parseShardSpec(raw) {
|
|
495
|
+
const match = raw?.trim().match(/^(\d+)\s*\/\s*(\d+)$/);
|
|
496
|
+
if (!match) return null;
|
|
497
|
+
const current = Number(match[1]);
|
|
498
|
+
const total = Number(match[2]);
|
|
499
|
+
return current >= 1 && current <= total && total > 1 ? { current, total } : null;
|
|
500
|
+
}
|
|
501
|
+
function resolveShardInfo(config, env = process.env) {
|
|
502
|
+
const pwShard = config.shard;
|
|
503
|
+
if (pwShard && pwShard.total > 1) return { current: pwShard.current, total: pwShard.total };
|
|
504
|
+
return parseShardSpec(env[PIWI_SHARD_ENV]);
|
|
505
|
+
}
|
|
506
|
+
|
|
487
507
|
// src/internal/collect/metadata-collector.ts
|
|
488
508
|
var import_node_child_process = require("child_process");
|
|
489
509
|
var DETACHED_HEAD = "HEAD";
|
|
@@ -683,9 +703,7 @@ function createGlobalSetup(options, userSetup) {
|
|
|
683
703
|
try {
|
|
684
704
|
const auth = await httpClient.resolveAuth(opts);
|
|
685
705
|
const runLabel = opts.runLabel || detectCiRunLabel();
|
|
686
|
-
const
|
|
687
|
-
const shardIndex = pwShard?.current;
|
|
688
|
-
const shardTotal = pwShard?.total;
|
|
706
|
+
const shard = resolveShardInfo(config);
|
|
689
707
|
const response = await httpClient.postJSON(
|
|
690
708
|
"/api/test-runs/setup",
|
|
691
709
|
{
|
|
@@ -696,8 +714,8 @@ function createGlobalSetup(options, userSetup) {
|
|
|
696
714
|
keep: opts.keep === true,
|
|
697
715
|
startTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
698
716
|
instanceId: computeInstanceId(opts.projectName, runLabel),
|
|
699
|
-
shardIndex,
|
|
700
|
-
shardTotal
|
|
717
|
+
shardIndex: shard?.current,
|
|
718
|
+
shardTotal: shard?.total
|
|
701
719
|
},
|
|
702
720
|
auth
|
|
703
721
|
);
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { PlaywrightTestConfig } from '@playwright/test';
|
|
|
4
4
|
export { PiwiFixtures, extendPiwiFixtures, piwiFixtures } from './internal/capture/capture-fixtures.js';
|
|
5
5
|
import '@piwitests/picker-dom';
|
|
6
6
|
import '@piwitests/core/wire';
|
|
7
|
+
import '@piwitests/core/code-reach';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Options for configuring the Piwi Dashboard reporter.
|
|
@@ -60,6 +61,26 @@ interface PiwiDashboardOptions {
|
|
|
60
61
|
* Automatically disabled when `collectPerformanceMetrics` is `false`.
|
|
61
62
|
*/
|
|
62
63
|
capturePageInventory?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Record which application source files each test executes: the files whose
|
|
66
|
+
* functions ran, from Chromium's JavaScript coverage, resolved through the
|
|
67
|
+
* dev server's module URLs or the bundle's source maps. It answers "which
|
|
68
|
+
* tests reach this file?" for test selection, change coverage and
|
|
69
|
+
* `piwi preflight`. Only repository-relative file paths are sent. Chromium only;
|
|
70
|
+
* other browsers record nothing. It slows the page's JavaScript, so run it on
|
|
71
|
+
* one scheduled job rather than every run. **Defaults to `false`** — opt in
|
|
72
|
+
* with `captureCodeReach: true` (or `PIWI_CAPTURE_CODE_REACH=true`).
|
|
73
|
+
* Automatically disabled when `collectPerformanceMetrics` is `false`.
|
|
74
|
+
*/
|
|
75
|
+
captureCodeReach?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* The directories module paths and source-map sources are resolved against
|
|
78
|
+
* for `captureCodeReach`, relative to the Playwright config, before the
|
|
79
|
+
* repository root, which is always tried last. Defaults to the Playwright
|
|
80
|
+
* config's directory. Set it to the dev server's root when that is not the
|
|
81
|
+
* config's directory (Nuxt: `['app']`).
|
|
82
|
+
*/
|
|
83
|
+
codeReachRoots?: string[];
|
|
63
84
|
/**
|
|
64
85
|
* Capture server-side spans for each API/document request the test makes,
|
|
65
86
|
* read from the `X-Piwi-Trace` response header emitted by a Piwi
|