@piwitests/reporter 0.62.0 → 0.63.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 +14 -13
- package/dist/global-setup-module.js +27 -12
- package/dist/index.d.ts +8 -0
- package/dist/index.js +16258 -13784
- package/dist/internal/capture/capture-fixtures.d.ts +13 -1
- package/dist/internal/capture/capture-fixtures.js +2791 -560
- package/dist/internal/capture/locator-healing.d.ts +11 -1
- package/dist/internal/capture/locator-healing.js +22 -10
- package/dist/internal/capture/pick-on-failure.js +29 -5
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -36,6 +36,7 @@ var path2 = __toESM(require("path"));
|
|
|
36
36
|
|
|
37
37
|
// src/internal/capture/locator-healing.ts
|
|
38
38
|
var path = __toESM(require("path"));
|
|
39
|
+
var import_node_url = require("url");
|
|
39
40
|
|
|
40
41
|
// ../core/src/locator-chain.ts
|
|
41
42
|
var LOCATING_METHODS = /* @__PURE__ */ new Set([
|
|
@@ -1191,9 +1192,9 @@ function realFolder(dir) {
|
|
|
1191
1192
|
return path10.join(fs7.realpathSync(current), ...rest);
|
|
1192
1193
|
}
|
|
1193
1194
|
function folderInRepository(root, dir) {
|
|
1194
|
-
const
|
|
1195
|
-
if (
|
|
1196
|
-
return
|
|
1195
|
+
const relative8 = path10.relative(realFolder(root), realFolder(dir));
|
|
1196
|
+
if (relative8.startsWith("..") || path10.isAbsolute(relative8)) return void 0;
|
|
1197
|
+
return relative8.split(path10.sep).join("/");
|
|
1197
1198
|
}
|
|
1198
1199
|
function fileFilter(file) {
|
|
1199
1200
|
const escape = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -3825,8 +3826,8 @@ function relativeTo(path25, root) {
|
|
|
3825
3826
|
const head = path25.slice(0, base.length);
|
|
3826
3827
|
const inside = drive ? head.toLowerCase() === base.toLowerCase() : head === base;
|
|
3827
3828
|
if (!inside) return null;
|
|
3828
|
-
const
|
|
3829
|
-
return
|
|
3829
|
+
const relative8 = path25.slice(base.length);
|
|
3830
|
+
return relative8 || null;
|
|
3830
3831
|
}
|
|
3831
3832
|
function reportPathCandidates(raw, { repoRoot, bases }) {
|
|
3832
3833
|
const slash = (value) => value.replace(/\\/g, "/");
|
|
@@ -3837,8 +3838,8 @@ function reportPathCandidates(raw, { repoRoot, bases }) {
|
|
|
3837
3838
|
const add = (absolute) => {
|
|
3838
3839
|
const normalized = normalizeSlashPath(absolute);
|
|
3839
3840
|
if (!normalized) return;
|
|
3840
|
-
const
|
|
3841
|
-
if (
|
|
3841
|
+
const relative8 = normalized.startsWith("/_/") ? normalized.slice(3) : relativeTo(normalized, root);
|
|
3842
|
+
if (relative8 && !out.includes(relative8)) out.push(relative8);
|
|
3842
3843
|
};
|
|
3843
3844
|
if (isAbsolutePath(path25)) {
|
|
3844
3845
|
add(path25);
|
|
@@ -6106,9 +6107,9 @@ function pathGlobToRegExp(glob) {
|
|
|
6106
6107
|
return new RegExp(`^(?:${parts.join("|")})$`);
|
|
6107
6108
|
}
|
|
6108
6109
|
function isTranslationFile(path25, globs = DEFAULT_TRANSLATION_GLOBS) {
|
|
6109
|
-
const
|
|
6110
|
-
if (!TRANSLATION_EXTENSIONS.test(
|
|
6111
|
-
return globs.some((g) => pathGlobToRegExp(g).test(
|
|
6110
|
+
const posix2 = path25.replace(/\\/g, "/");
|
|
6111
|
+
if (!TRANSLATION_EXTENSIONS.test(posix2)) return false;
|
|
6112
|
+
return globs.some((g) => pathGlobToRegExp(g).test(posix2));
|
|
6112
6113
|
}
|
|
6113
6114
|
function keepable(value) {
|
|
6114
6115
|
const v = value.trim();
|
|
@@ -7790,9 +7791,9 @@ function escapeRegex2(s) {
|
|
|
7790
7791
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7791
7792
|
}
|
|
7792
7793
|
async function runProbe(argv) {
|
|
7793
|
-
const
|
|
7794
|
-
const own =
|
|
7795
|
-
const playwrightArgs2 =
|
|
7794
|
+
const sep6 = argv.indexOf("--");
|
|
7795
|
+
const own = sep6 < 0 ? argv : argv.slice(0, sep6);
|
|
7796
|
+
const playwrightArgs2 = sep6 < 0 ? [] : argv.slice(sep6 + 1);
|
|
7796
7797
|
if (own.includes("-h") || own.includes("--help")) {
|
|
7797
7798
|
console.log(USAGE11);
|
|
7798
7799
|
return EXIT_OK8;
|
|
@@ -43,9 +43,6 @@ function errorMessage(error) {
|
|
|
43
43
|
return String(error);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
// src/public/global-setup.ts
|
|
47
|
-
var fs7 = __toESM(require("fs"));
|
|
48
|
-
|
|
49
46
|
// src/internal/config/env.ts
|
|
50
47
|
var path2 = __toESM(require("path"));
|
|
51
48
|
|
|
@@ -693,6 +690,16 @@ function normalizeRef(ref) {
|
|
|
693
690
|
return ref.replace(/^refs\/heads\//, "");
|
|
694
691
|
}
|
|
695
692
|
|
|
693
|
+
// ../core/src/live-view.ts
|
|
694
|
+
var LIVE_FRAME_BYTE_RATE = 256 * 1024;
|
|
695
|
+
var MAX_LIVE_FRAME = 192 * 1024;
|
|
696
|
+
var MAX_LIVE_FRAME_BASE64 = 4 * Math.ceil(MAX_LIVE_FRAME / 3);
|
|
697
|
+
var MAX_LIVE_MESSAGE = MAX_LIVE_FRAME_BASE64 + 8 * 1024;
|
|
698
|
+
var KEY = /^pdl_[A-Za-z0-9_-]{43}$/;
|
|
699
|
+
function isLiveViewKey(value) {
|
|
700
|
+
return typeof value === "string" && KEY.test(value);
|
|
701
|
+
}
|
|
702
|
+
|
|
696
703
|
// src/internal/support/setup-file.ts
|
|
697
704
|
var path4 = __toESM(require("path"));
|
|
698
705
|
var os3 = __toESM(require("os"));
|
|
@@ -700,6 +707,10 @@ var fs3 = __toESM(require("fs"));
|
|
|
700
707
|
function getSetupFilePath(projectName) {
|
|
701
708
|
return path4.join(os3.tmpdir(), `piwi-dashboard-setup-${hashForProject(projectName)}.json`);
|
|
702
709
|
}
|
|
710
|
+
function writeSetupInfo(info) {
|
|
711
|
+
const setupFile = getSetupFilePath(info.projectName);
|
|
712
|
+
fs3.writeFileSync(setupFile, JSON.stringify(info), { mode: 384 });
|
|
713
|
+
}
|
|
703
714
|
|
|
704
715
|
// src/internal/support/aria-sampling.ts
|
|
705
716
|
var path5 = __toESM(require("path"));
|
|
@@ -1101,19 +1112,23 @@ function createGlobalSetup(options, userSetup) {
|
|
|
1101
1112
|
startTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1102
1113
|
instanceId: computeInstanceId(opts.projectName, resolveRunLabel(opts.runLabel, shard !== null)),
|
|
1103
1114
|
shardIndex: shard?.current,
|
|
1104
|
-
shardTotal: shard?.total
|
|
1115
|
+
shardTotal: shard?.total,
|
|
1116
|
+
// A key for the run's live view: the instance hands one out only for a project that turned it on, and the
|
|
1117
|
+
// desktop app none. A CI run's workers stream with it at once; a run outside CI sends nothing with it until a
|
|
1118
|
+
// person shares the run.
|
|
1119
|
+
liveView: true
|
|
1105
1120
|
},
|
|
1106
1121
|
auth
|
|
1107
1122
|
);
|
|
1108
1123
|
if (response?.runId && response?.setupToken) {
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
}
|
|
1116
|
-
);
|
|
1124
|
+
const liveViewKey = response.liveView?.key;
|
|
1125
|
+
writeSetupInfo({
|
|
1126
|
+
runId: response.runId,
|
|
1127
|
+
setupToken: response.setupToken,
|
|
1128
|
+
projectName: opts.projectName,
|
|
1129
|
+
...isLiveViewKey(liveViewKey) ? { liveViewKey } : {},
|
|
1130
|
+
...response.liveView?.refused === "local" ? { liveViewLocal: true } : {}
|
|
1131
|
+
});
|
|
1117
1132
|
logger.debug(`Global setup: initializing run #${response.runId}`);
|
|
1118
1133
|
}
|
|
1119
1134
|
if (opts.projectName) clearAriaSampleFile(opts.projectName);
|
package/dist/index.d.ts
CHANGED
|
@@ -579,6 +579,14 @@ declare class PiwiDashboardReporter {
|
|
|
579
579
|
printsToStdio(): boolean;
|
|
580
580
|
/** Playwright reporter hook: called once at the start of the test run */
|
|
581
581
|
onBegin(config: FullConfig, suite: Suite): void;
|
|
582
|
+
/**
|
|
583
|
+
* Name the run's live view on the instance for the workers, which Playwright starts after this hook with this
|
|
584
|
+
* environment: the key the instance gave the global setup, for a project that turned its live view on, for this run
|
|
585
|
+
* alone. A CI run's workers stream with it at once; a run outside CI's hold it until a person shares the run (Share
|
|
586
|
+
* live), and such a run without a key names why instead, for the surfaces that would share it. Read before the
|
|
587
|
+
* stream starts, which takes the setup file.
|
|
588
|
+
*/
|
|
589
|
+
private shareLiveView;
|
|
582
590
|
/**
|
|
583
591
|
* Settle each planned test's external ID before any test runs, name the IDs two tests share, and record them on
|
|
584
592
|
* the run so the dashboard lists them too.
|