@piwitests/reporter 0.71.0 → 0.72.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/index.js
CHANGED
|
@@ -3280,7 +3280,9 @@ var RUN_REF_ENV = "PIWI_RUN_REF";
|
|
|
3280
3280
|
var TERMINAL_REF_PREFIX = "terminal-";
|
|
3281
3281
|
var UNATTENDED_REF_SUFFIX = "-unattended";
|
|
3282
3282
|
var RUN_HOLDS = ["failure"];
|
|
3283
|
-
var RUN_FEATURES = ["view-lane", "give-up", "front", "layers", "trace"];
|
|
3283
|
+
var RUN_FEATURES = ["view-lane", "give-up", "front", "layers", "trace", "positions"];
|
|
3284
|
+
var POSITIONS_PER_SECOND = 4;
|
|
3285
|
+
var MAX_POSITION_TITLE = 300;
|
|
3284
3286
|
var MAX_WAITING_TITLE = 500;
|
|
3285
3287
|
var RUN_INTENTS = ["pick", "record", "assert", "assert-region"];
|
|
3286
3288
|
var RUN_TAKES = [
|
|
@@ -3454,6 +3456,8 @@ function parseHubToRun(line) {
|
|
|
3454
3456
|
const layers = readLaneLayers(value.layers);
|
|
3455
3457
|
return layers ? { type: "layers", layers } : null;
|
|
3456
3458
|
}
|
|
3459
|
+
case "positions":
|
|
3460
|
+
return typeof value.on === "boolean" ? { type: "positions", on: value.on } : null;
|
|
3457
3461
|
case "share": {
|
|
3458
3462
|
if (typeof value.on !== "boolean") return null;
|
|
3459
3463
|
return isInt2(value.after, 1) ? { type: "share", on: value.on, after: value.after } : { type: "share", on: value.on };
|
|
@@ -25582,6 +25586,11 @@ var pickingAt = false;
|
|
|
25582
25586
|
var runName = "";
|
|
25583
25587
|
var eventsOn = false;
|
|
25584
25588
|
var testRunning = false;
|
|
25589
|
+
var runningTestId = null;
|
|
25590
|
+
var positionsOn = false;
|
|
25591
|
+
var positionToldAt = -Infinity;
|
|
25592
|
+
var pendingPosition = null;
|
|
25593
|
+
var positionTimer = null;
|
|
25585
25594
|
var eventRate = new RateWindow(MAX_RUN_EVENT_RATE);
|
|
25586
25595
|
var droppedEvents = 0;
|
|
25587
25596
|
var agentTurn = Promise.resolve();
|
|
@@ -25624,6 +25633,9 @@ async function openRunChannel(worker, handlers, env = process.env) {
|
|
|
25624
25633
|
shown = /* @__PURE__ */ new Set();
|
|
25625
25634
|
runName = `piwi-${ref}-w${worker.workerIndex}`;
|
|
25626
25635
|
eventsOn = false;
|
|
25636
|
+
positionsOn = false;
|
|
25637
|
+
positionToldAt = -Infinity;
|
|
25638
|
+
dropPendingPosition();
|
|
25627
25639
|
layersAsked = /* @__PURE__ */ new Set();
|
|
25628
25640
|
host = null;
|
|
25629
25641
|
opening.unref();
|
|
@@ -25724,11 +25736,15 @@ function runChannelOpen() {
|
|
|
25724
25736
|
function tellHub(message) {
|
|
25725
25737
|
if (message.type === "test-begin") {
|
|
25726
25738
|
testRunning = true;
|
|
25739
|
+
runningTestId = message.testId;
|
|
25740
|
+
dropPendingPosition();
|
|
25727
25741
|
laneGeneration++;
|
|
25728
25742
|
filmstrip2?.forget();
|
|
25729
25743
|
}
|
|
25730
25744
|
if (message.type === "test-end") {
|
|
25731
25745
|
testRunning = false;
|
|
25746
|
+
runningTestId = null;
|
|
25747
|
+
dropPendingPosition();
|
|
25732
25748
|
void unbind();
|
|
25733
25749
|
}
|
|
25734
25750
|
if (socket && !socket.destroyed) socket.write(`${JSON.stringify(message)}
|
|
@@ -25737,6 +25753,32 @@ function tellHub(message) {
|
|
|
25737
25753
|
function tellActing(stop2, what) {
|
|
25738
25754
|
if (held?.stop === stop2) tellHub({ type: "acting", stop: stop2, what });
|
|
25739
25755
|
}
|
|
25756
|
+
function positionsWanted() {
|
|
25757
|
+
return positionsOn && testRunning && runningTestId !== null && runChannelOpen();
|
|
25758
|
+
}
|
|
25759
|
+
function tellPosition(title, place) {
|
|
25760
|
+
if (!positionsWanted()) return;
|
|
25761
|
+
pendingPosition = { title, place };
|
|
25762
|
+
if (positionTimer) return;
|
|
25763
|
+
const wait = positionToldAt + 1e3 / POSITIONS_PER_SECOND - performance.now();
|
|
25764
|
+
if (wait <= 0) return sendPendingPosition();
|
|
25765
|
+
positionTimer = setTimeout(sendPendingPosition, wait);
|
|
25766
|
+
positionTimer.unref?.();
|
|
25767
|
+
}
|
|
25768
|
+
function sendPendingPosition() {
|
|
25769
|
+
if (positionTimer) clearTimeout(positionTimer);
|
|
25770
|
+
positionTimer = null;
|
|
25771
|
+
const position = pendingPosition;
|
|
25772
|
+
pendingPosition = null;
|
|
25773
|
+
if (!position || !positionsWanted()) return;
|
|
25774
|
+
positionToldAt = performance.now();
|
|
25775
|
+
tellHub({ type: "position", testId: runningTestId, title: position.title, place: position.place });
|
|
25776
|
+
}
|
|
25777
|
+
function dropPendingPosition() {
|
|
25778
|
+
pendingPosition = null;
|
|
25779
|
+
if (positionTimer) clearTimeout(positionTimer);
|
|
25780
|
+
positionTimer = null;
|
|
25781
|
+
}
|
|
25740
25782
|
function runEventsWanted() {
|
|
25741
25783
|
return eventsOn && testRunning && runChannelOpen();
|
|
25742
25784
|
}
|
|
@@ -26256,6 +26298,10 @@ function onMessage(message) {
|
|
|
26256
26298
|
eventRate = new RateWindow(MAX_RUN_EVENT_RATE);
|
|
26257
26299
|
droppedEvents = 0;
|
|
26258
26300
|
return;
|
|
26301
|
+
case "positions":
|
|
26302
|
+
positionsOn = message.on;
|
|
26303
|
+
if (!message.on) dropPendingPosition();
|
|
26304
|
+
return;
|
|
26259
26305
|
case "layers": {
|
|
26260
26306
|
const before = layersAsked;
|
|
26261
26307
|
layersAsked = new Set(message.layers);
|
|
@@ -26510,7 +26556,7 @@ function callPlace(frames, cwd = process.cwd(), windows = process.platform === "
|
|
|
26510
26556
|
function callTitle(zone, channel) {
|
|
26511
26557
|
const selector = typeof channel?.params?.selector === "string" ? ` ${channel.params.selector}` : "";
|
|
26512
26558
|
const title = zone.title || `${zone.apiName || "call"}${selector}`;
|
|
26513
|
-
return hideSecretsInText(hideTypedText(title)).slice(0,
|
|
26559
|
+
return hideSecretsInText(hideTypedText(title)).slice(0, MAX_POSITION_TITLE);
|
|
26514
26560
|
}
|
|
26515
26561
|
function errorText(error) {
|
|
26516
26562
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -26524,6 +26570,10 @@ function watchCalls(playwright) {
|
|
|
26524
26570
|
const titles = /* @__PURE__ */ new WeakMap();
|
|
26525
26571
|
instrumentation.addListener({
|
|
26526
26572
|
onApiCallBegin: (zone, channel) => {
|
|
26573
|
+
if (positionsWanted()) {
|
|
26574
|
+
const place = callPlace(zone.frames);
|
|
26575
|
+
if (place) tellPosition(callTitle(zone, channel), place);
|
|
26576
|
+
}
|
|
26527
26577
|
if (!runEventsWanted()) return;
|
|
26528
26578
|
begun.set(zone, Date.now());
|
|
26529
26579
|
titles.set(zone, callTitle(zone, channel));
|
|
@@ -8479,7 +8479,9 @@ var RUN_CHANNEL_ENV = "PIWI_RUN_CHANNEL";
|
|
|
8479
8479
|
var RUN_REF_ENV = "PIWI_RUN_REF";
|
|
8480
8480
|
var TERMINAL_REF_PREFIX = "terminal-";
|
|
8481
8481
|
var RUN_HOLDS = ["failure"];
|
|
8482
|
-
var RUN_FEATURES = ["view-lane", "give-up", "front", "layers", "trace"];
|
|
8482
|
+
var RUN_FEATURES = ["view-lane", "give-up", "front", "layers", "trace", "positions"];
|
|
8483
|
+
var POSITIONS_PER_SECOND = 4;
|
|
8484
|
+
var MAX_POSITION_TITLE = 300;
|
|
8483
8485
|
var MAX_WAITING_TITLE = 500;
|
|
8484
8486
|
var RUN_INTENTS = ["pick", "record", "assert", "assert-region"];
|
|
8485
8487
|
var RUN_TAKES = [
|
|
@@ -8644,6 +8646,8 @@ function parseHubToRun(line) {
|
|
|
8644
8646
|
const layers = readLaneLayers(value.layers);
|
|
8645
8647
|
return layers ? { type: "layers", layers } : null;
|
|
8646
8648
|
}
|
|
8649
|
+
case "positions":
|
|
8650
|
+
return typeof value.on === "boolean" ? { type: "positions", on: value.on } : null;
|
|
8647
8651
|
case "share": {
|
|
8648
8652
|
if (typeof value.on !== "boolean") return null;
|
|
8649
8653
|
return isInt2(value.after, 1) ? { type: "share", on: value.on, after: value.after } : { type: "share", on: value.on };
|
|
@@ -11570,6 +11574,11 @@ var pickingAt = false;
|
|
|
11570
11574
|
var runName = "";
|
|
11571
11575
|
var eventsOn = false;
|
|
11572
11576
|
var testRunning = false;
|
|
11577
|
+
var runningTestId = null;
|
|
11578
|
+
var positionsOn = false;
|
|
11579
|
+
var positionToldAt = -Infinity;
|
|
11580
|
+
var pendingPosition = null;
|
|
11581
|
+
var positionTimer = null;
|
|
11573
11582
|
var eventRate = new RateWindow(MAX_RUN_EVENT_RATE);
|
|
11574
11583
|
var droppedEvents = 0;
|
|
11575
11584
|
var agentTurn = Promise.resolve();
|
|
@@ -11612,6 +11621,9 @@ async function openRunChannel(worker, handlers, env = process.env) {
|
|
|
11612
11621
|
shown = /* @__PURE__ */ new Set();
|
|
11613
11622
|
runName = `piwi-${ref}-w${worker.workerIndex}`;
|
|
11614
11623
|
eventsOn = false;
|
|
11624
|
+
positionsOn = false;
|
|
11625
|
+
positionToldAt = -Infinity;
|
|
11626
|
+
dropPendingPosition();
|
|
11615
11627
|
layersAsked = /* @__PURE__ */ new Set();
|
|
11616
11628
|
host = null;
|
|
11617
11629
|
opening.unref();
|
|
@@ -11712,11 +11724,15 @@ function runChannelOpen() {
|
|
|
11712
11724
|
function tellHub(message) {
|
|
11713
11725
|
if (message.type === "test-begin") {
|
|
11714
11726
|
testRunning = true;
|
|
11727
|
+
runningTestId = message.testId;
|
|
11728
|
+
dropPendingPosition();
|
|
11715
11729
|
laneGeneration++;
|
|
11716
11730
|
filmstrip2?.forget();
|
|
11717
11731
|
}
|
|
11718
11732
|
if (message.type === "test-end") {
|
|
11719
11733
|
testRunning = false;
|
|
11734
|
+
runningTestId = null;
|
|
11735
|
+
dropPendingPosition();
|
|
11720
11736
|
void unbind();
|
|
11721
11737
|
}
|
|
11722
11738
|
if (socket && !socket.destroyed) socket.write(`${JSON.stringify(message)}
|
|
@@ -11725,6 +11741,32 @@ function tellHub(message) {
|
|
|
11725
11741
|
function tellActing(stop2, what) {
|
|
11726
11742
|
if (held?.stop === stop2) tellHub({ type: "acting", stop: stop2, what });
|
|
11727
11743
|
}
|
|
11744
|
+
function positionsWanted() {
|
|
11745
|
+
return positionsOn && testRunning && runningTestId !== null && runChannelOpen();
|
|
11746
|
+
}
|
|
11747
|
+
function tellPosition(title, place) {
|
|
11748
|
+
if (!positionsWanted()) return;
|
|
11749
|
+
pendingPosition = { title, place };
|
|
11750
|
+
if (positionTimer) return;
|
|
11751
|
+
const wait = positionToldAt + 1e3 / POSITIONS_PER_SECOND - performance.now();
|
|
11752
|
+
if (wait <= 0) return sendPendingPosition();
|
|
11753
|
+
positionTimer = setTimeout(sendPendingPosition, wait);
|
|
11754
|
+
positionTimer.unref?.();
|
|
11755
|
+
}
|
|
11756
|
+
function sendPendingPosition() {
|
|
11757
|
+
if (positionTimer) clearTimeout(positionTimer);
|
|
11758
|
+
positionTimer = null;
|
|
11759
|
+
const position = pendingPosition;
|
|
11760
|
+
pendingPosition = null;
|
|
11761
|
+
if (!position || !positionsWanted()) return;
|
|
11762
|
+
positionToldAt = performance.now();
|
|
11763
|
+
tellHub({ type: "position", testId: runningTestId, title: position.title, place: position.place });
|
|
11764
|
+
}
|
|
11765
|
+
function dropPendingPosition() {
|
|
11766
|
+
pendingPosition = null;
|
|
11767
|
+
if (positionTimer) clearTimeout(positionTimer);
|
|
11768
|
+
positionTimer = null;
|
|
11769
|
+
}
|
|
11728
11770
|
function runEventsWanted() {
|
|
11729
11771
|
return eventsOn && testRunning && runChannelOpen();
|
|
11730
11772
|
}
|
|
@@ -12244,6 +12286,10 @@ function onMessage(message) {
|
|
|
12244
12286
|
eventRate = new RateWindow(MAX_RUN_EVENT_RATE);
|
|
12245
12287
|
droppedEvents = 0;
|
|
12246
12288
|
return;
|
|
12289
|
+
case "positions":
|
|
12290
|
+
positionsOn = message.on;
|
|
12291
|
+
if (!message.on) dropPendingPosition();
|
|
12292
|
+
return;
|
|
12247
12293
|
case "layers": {
|
|
12248
12294
|
const before = layersAsked;
|
|
12249
12295
|
layersAsked = new Set(message.layers);
|
|
@@ -12498,7 +12544,7 @@ function callPlace(frames, cwd = process.cwd(), windows = process.platform === "
|
|
|
12498
12544
|
function callTitle(zone, channel) {
|
|
12499
12545
|
const selector = typeof channel?.params?.selector === "string" ? ` ${channel.params.selector}` : "";
|
|
12500
12546
|
const title = zone.title || `${zone.apiName || "call"}${selector}`;
|
|
12501
|
-
return hideSecretsInText(hideTypedText(title)).slice(0,
|
|
12547
|
+
return hideSecretsInText(hideTypedText(title)).slice(0, MAX_POSITION_TITLE);
|
|
12502
12548
|
}
|
|
12503
12549
|
function errorText(error) {
|
|
12504
12550
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -12512,6 +12558,10 @@ function watchCalls(playwright) {
|
|
|
12512
12558
|
const titles = /* @__PURE__ */ new WeakMap();
|
|
12513
12559
|
instrumentation.addListener({
|
|
12514
12560
|
onApiCallBegin: (zone, channel) => {
|
|
12561
|
+
if (positionsWanted()) {
|
|
12562
|
+
const place = callPlace(zone.frames);
|
|
12563
|
+
if (place) tellPosition(callTitle(zone, channel), place);
|
|
12564
|
+
}
|
|
12515
12565
|
if (!runEventsWanted()) return;
|
|
12516
12566
|
begun.set(zone, Date.now());
|
|
12517
12567
|
titles.set(zone, callTitle(zone, channel));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@piwitests/reporter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.72.0",
|
|
4
4
|
"description": "Playwright reporter that streams results, traces and HTML reports to a Piwi Dashboard instance",
|
|
5
5
|
"url": "https://github.com/PiwiTests/piwi",
|
|
6
6
|
"homepage": "https://piwitests.dev",
|