@riddledc/riddle-proof 0.7.164 → 0.7.166
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/{chunk-RXJ7YQBJ.js → chunk-L6WJP5IY.js} +93 -3
- package/dist/cli.cjs +123 -4
- package/dist/cli.js +31 -2
- package/dist/index.cjs +93 -3
- package/dist/index.js +1 -1
- package/dist/profile.cjs +93 -3
- package/dist/profile.js +1 -1
- package/package.json +1 -1
|
@@ -551,6 +551,24 @@ function profileSetupRangeValueReceipts(results) {
|
|
|
551
551
|
reason: result.reason ?? result.error ?? null
|
|
552
552
|
}));
|
|
553
553
|
}
|
|
554
|
+
function profileSetupDragReceipts(results) {
|
|
555
|
+
return results.filter((result) => profileSetupResultAction(result) === "drag").map((result) => ({
|
|
556
|
+
ordinal: result.ordinal ?? null,
|
|
557
|
+
ok: result.ok !== false,
|
|
558
|
+
selector: result.selector ?? null,
|
|
559
|
+
frame_selector: result.frame_selector ?? null,
|
|
560
|
+
pointer_type: result.pointer_type ?? null,
|
|
561
|
+
input_dispatch: result.input_dispatch ?? null,
|
|
562
|
+
coordinate_mode: result.coordinate_mode ?? null,
|
|
563
|
+
from_x: result.from_x ?? null,
|
|
564
|
+
from_y: result.from_y ?? null,
|
|
565
|
+
to_x: result.to_x ?? null,
|
|
566
|
+
to_y: result.to_y ?? null,
|
|
567
|
+
steps: result.steps ?? null,
|
|
568
|
+
duration_ms: result.duration_ms ?? null,
|
|
569
|
+
reason: result.reason ?? result.error ?? null
|
|
570
|
+
}));
|
|
571
|
+
}
|
|
554
572
|
function profileSetupCanvasSignatureReceipts(results) {
|
|
555
573
|
return results.filter((result) => profileSetupResultAction(result) === "canvas_signature").map((result) => ({
|
|
556
574
|
ordinal: result.ordinal ?? null,
|
|
@@ -650,6 +668,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
650
668
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
651
669
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
652
670
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
671
|
+
const dragReceipts = profileSetupDragReceipts(results);
|
|
672
|
+
const sampledDragReceipts = sampleProfileSetupSummaryItems(dragReceipts, 8);
|
|
653
673
|
const canvasSignatureReceipts = profileSetupCanvasSignatureReceipts(results);
|
|
654
674
|
const sampledCanvasSignatureReceipts = sampleProfileSetupSummaryItems(canvasSignatureReceipts, 8);
|
|
655
675
|
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
@@ -703,6 +723,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
703
723
|
set_range_value_total: rangeValueReceipts.length,
|
|
704
724
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
705
725
|
set_range_value: sampledRangeValueReceipts,
|
|
726
|
+
drag_total: dragReceipts.length,
|
|
727
|
+
drag_truncated: dragReceipts.length > sampledDragReceipts.length,
|
|
728
|
+
drag: sampledDragReceipts,
|
|
706
729
|
canvas_signature_total: canvasSignatureReceipts.length,
|
|
707
730
|
canvas_signature_truncated: canvasSignatureReceipts.length > sampledCanvasSignatureReceipts.length,
|
|
708
731
|
canvas_signature: sampledCanvasSignatureReceipts,
|
|
@@ -891,12 +914,27 @@ function normalizeSetupAction(input, index) {
|
|
|
891
914
|
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "canvas_signature" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
892
915
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
893
916
|
}
|
|
894
|
-
const fromX = numberValue(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
895
|
-
const fromY = numberValue(valueFromOwn(input, "from_y", "fromY", "start_y", "startY", "y1"));
|
|
917
|
+
const fromX = type === "click" ? numberValue(valueFromOwn(input, "from_x", "fromX", "x", "click_x", "clickX", "start_x", "startX", "x1")) : numberValue(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
918
|
+
const fromY = type === "click" ? numberValue(valueFromOwn(input, "from_y", "fromY", "y", "click_y", "clickY", "start_y", "startY", "y1")) : numberValue(valueFromOwn(input, "from_y", "fromY", "start_y", "startY", "y1"));
|
|
896
919
|
const toX = numberValue(valueFromOwn(input, "to_x", "toX", "end_x", "endX", "x2"));
|
|
897
920
|
const toY = numberValue(valueFromOwn(input, "to_y", "toY", "end_y", "endY", "y2"));
|
|
898
921
|
const coordinateMode = normalizeSetupActionCoordinateMode(valueFromOwn(input, "coordinate_mode", "coordinateMode", "coords", "units"), index);
|
|
899
922
|
const pointerType = normalizeSetupActionPointerType(valueFromOwn(input, "pointer_type", "pointerType", "input_type", "inputType"), type, index);
|
|
923
|
+
if (type === "click") {
|
|
924
|
+
const hasClickCoordinate = fromX !== void 0 || fromY !== void 0;
|
|
925
|
+
if (hasClickCoordinate && (fromX === void 0 || fromY === void 0)) {
|
|
926
|
+
throw new Error(`target.setup_actions[${index}] click coordinates require both x and y.`);
|
|
927
|
+
}
|
|
928
|
+
if (hasClickCoordinate && fromX !== void 0 && fromY !== void 0) {
|
|
929
|
+
const clickCoordinates = [fromX, fromY];
|
|
930
|
+
if (coordinateMode === "ratio" && clickCoordinates.some((value2) => value2 < 0 || value2 > 1)) {
|
|
931
|
+
throw new Error(`target.setup_actions[${index}] click ratio coordinates must be between 0 and 1.`);
|
|
932
|
+
}
|
|
933
|
+
if ((coordinateMode === void 0 || coordinateMode === "pixels") && clickCoordinates.some((value2) => value2 < 0)) {
|
|
934
|
+
throw new Error(`target.setup_actions[${index}] click pixel coordinates must be non-negative.`);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
}
|
|
900
938
|
if (type === "drag") {
|
|
901
939
|
if (fromX === void 0 || fromY === void 0 || toX === void 0 || toY === void 0) {
|
|
902
940
|
throw new Error(`target.setup_actions[${index}] drag requires from_x, from_y, to_x, and to_y.`);
|
|
@@ -4166,6 +4204,26 @@ function profileSetupRangeValueReceipts(results) {
|
|
|
4166
4204
|
reason: result.reason || result.error || null,
|
|
4167
4205
|
}));
|
|
4168
4206
|
}
|
|
4207
|
+
function profileSetupDragReceipts(results) {
|
|
4208
|
+
return (results || [])
|
|
4209
|
+
.filter((result) => result && profileSetupResultAction(result) === "drag")
|
|
4210
|
+
.map((result) => ({
|
|
4211
|
+
ordinal: result.ordinal ?? null,
|
|
4212
|
+
ok: result.ok !== false,
|
|
4213
|
+
selector: result.selector ?? null,
|
|
4214
|
+
frame_selector: result.frame_selector ?? null,
|
|
4215
|
+
pointer_type: result.pointer_type ?? null,
|
|
4216
|
+
input_dispatch: result.input_dispatch ?? null,
|
|
4217
|
+
coordinate_mode: result.coordinate_mode ?? null,
|
|
4218
|
+
from_x: result.from_x ?? null,
|
|
4219
|
+
from_y: result.from_y ?? null,
|
|
4220
|
+
to_x: result.to_x ?? null,
|
|
4221
|
+
to_y: result.to_y ?? null,
|
|
4222
|
+
steps: result.steps ?? null,
|
|
4223
|
+
duration_ms: result.duration_ms ?? null,
|
|
4224
|
+
reason: result.reason || result.error || null,
|
|
4225
|
+
}));
|
|
4226
|
+
}
|
|
4169
4227
|
function profileSetupCanvasSignatureReceipts(results) {
|
|
4170
4228
|
return (results || [])
|
|
4171
4229
|
.filter((result) => result && profileSetupResultAction(result) === "canvas_signature")
|
|
@@ -4288,6 +4346,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
4288
4346
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
4289
4347
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
4290
4348
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
4349
|
+
const dragReceipts = profileSetupDragReceipts(results);
|
|
4350
|
+
const sampledDragReceipts = sampleProfileSetupSummaryItems(dragReceipts, 8);
|
|
4291
4351
|
const canvasSignatureReceipts = profileSetupCanvasSignatureReceipts(results);
|
|
4292
4352
|
const sampledCanvasSignatureReceipts = sampleProfileSetupSummaryItems(canvasSignatureReceipts, 8);
|
|
4293
4353
|
const clickedItems = results
|
|
@@ -4351,6 +4411,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
4351
4411
|
set_range_value_total: rangeValueReceipts.length,
|
|
4352
4412
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
4353
4413
|
set_range_value: sampledRangeValueReceipts,
|
|
4414
|
+
drag_total: dragReceipts.length,
|
|
4415
|
+
drag_truncated: dragReceipts.length > sampledDragReceipts.length,
|
|
4416
|
+
drag: sampledDragReceipts,
|
|
4354
4417
|
canvas_signature_total: canvasSignatureReceipts.length,
|
|
4355
4418
|
canvas_signature_truncated: canvasSignatureReceipts.length > sampledCanvasSignatureReceipts.length,
|
|
4356
4419
|
canvas_signature: sampledCanvasSignatureReceipts,
|
|
@@ -6329,8 +6392,35 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
6329
6392
|
: { timeout, noWaitAfter: true };
|
|
6330
6393
|
const clickCount = setupNumber(action.click_count, 1);
|
|
6331
6394
|
if (Number.isInteger(clickCount) && clickCount > 1) clickOptions.clickCount = clickCount;
|
|
6395
|
+
const fromX = setupFiniteNumber(action.from_x ?? action.fromX ?? action.x ?? action.click_x ?? action.clickX);
|
|
6396
|
+
const fromY = setupFiniteNumber(action.from_y ?? action.fromY ?? action.y ?? action.click_y ?? action.clickY);
|
|
6397
|
+
const hasClickPosition = fromX !== undefined || fromY !== undefined;
|
|
6398
|
+
let position;
|
|
6399
|
+
let mode;
|
|
6400
|
+
if (hasClickPosition) {
|
|
6401
|
+
if (fromX === undefined || fromY === undefined) return { ...base, ...setupScopeEvidence(scope), reason: "missing_click_coordinates", count, target_index: targetIndex };
|
|
6402
|
+
const target = locator.nth(targetIndex);
|
|
6403
|
+
const box = await target.boundingBox();
|
|
6404
|
+
if (!box) return { ...base, ...setupScopeEvidence(scope), reason: "bounding_box_unavailable", count, target_index: targetIndex };
|
|
6405
|
+
mode = String(action.coordinate_mode || action.coordinateMode || "pixels").trim();
|
|
6406
|
+
const coordinate = (value, size) => mode === "ratio" ? value * size : value;
|
|
6407
|
+
position = { x: coordinate(fromX, box.width), y: coordinate(fromY, box.height) };
|
|
6408
|
+
clickOptions.position = position;
|
|
6409
|
+
}
|
|
6332
6410
|
await locator.nth(targetIndex).click(clickOptions);
|
|
6333
|
-
return {
|
|
6411
|
+
return {
|
|
6412
|
+
...base,
|
|
6413
|
+
...setupScopeEvidence(scope),
|
|
6414
|
+
ok: true,
|
|
6415
|
+
count,
|
|
6416
|
+
target_index: targetIndex,
|
|
6417
|
+
text: matchedText,
|
|
6418
|
+
force: action.force === true || undefined,
|
|
6419
|
+
click_count: clickCount > 1 ? clickCount : undefined,
|
|
6420
|
+
coordinate_mode: mode,
|
|
6421
|
+
x: position ? fromX : undefined,
|
|
6422
|
+
y: position ? fromY : undefined,
|
|
6423
|
+
};
|
|
6334
6424
|
}
|
|
6335
6425
|
if (type === "fill" || type === "set_input_value") {
|
|
6336
6426
|
const scope = await setupActionScope(action, timeout);
|
package/dist/cli.cjs
CHANGED
|
@@ -7508,6 +7508,24 @@ function profileSetupRangeValueReceipts(results) {
|
|
|
7508
7508
|
reason: result.reason ?? result.error ?? null
|
|
7509
7509
|
}));
|
|
7510
7510
|
}
|
|
7511
|
+
function profileSetupDragReceipts(results) {
|
|
7512
|
+
return results.filter((result) => profileSetupResultAction(result) === "drag").map((result) => ({
|
|
7513
|
+
ordinal: result.ordinal ?? null,
|
|
7514
|
+
ok: result.ok !== false,
|
|
7515
|
+
selector: result.selector ?? null,
|
|
7516
|
+
frame_selector: result.frame_selector ?? null,
|
|
7517
|
+
pointer_type: result.pointer_type ?? null,
|
|
7518
|
+
input_dispatch: result.input_dispatch ?? null,
|
|
7519
|
+
coordinate_mode: result.coordinate_mode ?? null,
|
|
7520
|
+
from_x: result.from_x ?? null,
|
|
7521
|
+
from_y: result.from_y ?? null,
|
|
7522
|
+
to_x: result.to_x ?? null,
|
|
7523
|
+
to_y: result.to_y ?? null,
|
|
7524
|
+
steps: result.steps ?? null,
|
|
7525
|
+
duration_ms: result.duration_ms ?? null,
|
|
7526
|
+
reason: result.reason ?? result.error ?? null
|
|
7527
|
+
}));
|
|
7528
|
+
}
|
|
7511
7529
|
function profileSetupCanvasSignatureReceipts(results) {
|
|
7512
7530
|
return results.filter((result) => profileSetupResultAction(result) === "canvas_signature").map((result) => ({
|
|
7513
7531
|
ordinal: result.ordinal ?? null,
|
|
@@ -7607,6 +7625,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
7607
7625
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
7608
7626
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
7609
7627
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
7628
|
+
const dragReceipts = profileSetupDragReceipts(results);
|
|
7629
|
+
const sampledDragReceipts = sampleProfileSetupSummaryItems(dragReceipts, 8);
|
|
7610
7630
|
const canvasSignatureReceipts = profileSetupCanvasSignatureReceipts(results);
|
|
7611
7631
|
const sampledCanvasSignatureReceipts = sampleProfileSetupSummaryItems(canvasSignatureReceipts, 8);
|
|
7612
7632
|
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
@@ -7660,6 +7680,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
7660
7680
|
set_range_value_total: rangeValueReceipts.length,
|
|
7661
7681
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
7662
7682
|
set_range_value: sampledRangeValueReceipts,
|
|
7683
|
+
drag_total: dragReceipts.length,
|
|
7684
|
+
drag_truncated: dragReceipts.length > sampledDragReceipts.length,
|
|
7685
|
+
drag: sampledDragReceipts,
|
|
7663
7686
|
canvas_signature_total: canvasSignatureReceipts.length,
|
|
7664
7687
|
canvas_signature_truncated: canvasSignatureReceipts.length > sampledCanvasSignatureReceipts.length,
|
|
7665
7688
|
canvas_signature: sampledCanvasSignatureReceipts,
|
|
@@ -7848,12 +7871,27 @@ function normalizeSetupAction(input, index) {
|
|
|
7848
7871
|
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "canvas_signature" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
7849
7872
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
7850
7873
|
}
|
|
7851
|
-
const fromX = numberValue(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
7852
|
-
const fromY = numberValue(valueFromOwn(input, "from_y", "fromY", "start_y", "startY", "y1"));
|
|
7874
|
+
const fromX = type === "click" ? numberValue(valueFromOwn(input, "from_x", "fromX", "x", "click_x", "clickX", "start_x", "startX", "x1")) : numberValue(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
7875
|
+
const fromY = type === "click" ? numberValue(valueFromOwn(input, "from_y", "fromY", "y", "click_y", "clickY", "start_y", "startY", "y1")) : numberValue(valueFromOwn(input, "from_y", "fromY", "start_y", "startY", "y1"));
|
|
7853
7876
|
const toX = numberValue(valueFromOwn(input, "to_x", "toX", "end_x", "endX", "x2"));
|
|
7854
7877
|
const toY = numberValue(valueFromOwn(input, "to_y", "toY", "end_y", "endY", "y2"));
|
|
7855
7878
|
const coordinateMode = normalizeSetupActionCoordinateMode(valueFromOwn(input, "coordinate_mode", "coordinateMode", "coords", "units"), index);
|
|
7856
7879
|
const pointerType = normalizeSetupActionPointerType(valueFromOwn(input, "pointer_type", "pointerType", "input_type", "inputType"), type, index);
|
|
7880
|
+
if (type === "click") {
|
|
7881
|
+
const hasClickCoordinate = fromX !== void 0 || fromY !== void 0;
|
|
7882
|
+
if (hasClickCoordinate && (fromX === void 0 || fromY === void 0)) {
|
|
7883
|
+
throw new Error(`target.setup_actions[${index}] click coordinates require both x and y.`);
|
|
7884
|
+
}
|
|
7885
|
+
if (hasClickCoordinate && fromX !== void 0 && fromY !== void 0) {
|
|
7886
|
+
const clickCoordinates = [fromX, fromY];
|
|
7887
|
+
if (coordinateMode === "ratio" && clickCoordinates.some((value2) => value2 < 0 || value2 > 1)) {
|
|
7888
|
+
throw new Error(`target.setup_actions[${index}] click ratio coordinates must be between 0 and 1.`);
|
|
7889
|
+
}
|
|
7890
|
+
if ((coordinateMode === void 0 || coordinateMode === "pixels") && clickCoordinates.some((value2) => value2 < 0)) {
|
|
7891
|
+
throw new Error(`target.setup_actions[${index}] click pixel coordinates must be non-negative.`);
|
|
7892
|
+
}
|
|
7893
|
+
}
|
|
7894
|
+
}
|
|
7857
7895
|
if (type === "drag") {
|
|
7858
7896
|
if (fromX === void 0 || fromY === void 0 || toX === void 0 || toY === void 0) {
|
|
7859
7897
|
throw new Error(`target.setup_actions[${index}] drag requires from_x, from_y, to_x, and to_y.`);
|
|
@@ -11107,6 +11145,26 @@ function profileSetupRangeValueReceipts(results) {
|
|
|
11107
11145
|
reason: result.reason || result.error || null,
|
|
11108
11146
|
}));
|
|
11109
11147
|
}
|
|
11148
|
+
function profileSetupDragReceipts(results) {
|
|
11149
|
+
return (results || [])
|
|
11150
|
+
.filter((result) => result && profileSetupResultAction(result) === "drag")
|
|
11151
|
+
.map((result) => ({
|
|
11152
|
+
ordinal: result.ordinal ?? null,
|
|
11153
|
+
ok: result.ok !== false,
|
|
11154
|
+
selector: result.selector ?? null,
|
|
11155
|
+
frame_selector: result.frame_selector ?? null,
|
|
11156
|
+
pointer_type: result.pointer_type ?? null,
|
|
11157
|
+
input_dispatch: result.input_dispatch ?? null,
|
|
11158
|
+
coordinate_mode: result.coordinate_mode ?? null,
|
|
11159
|
+
from_x: result.from_x ?? null,
|
|
11160
|
+
from_y: result.from_y ?? null,
|
|
11161
|
+
to_x: result.to_x ?? null,
|
|
11162
|
+
to_y: result.to_y ?? null,
|
|
11163
|
+
steps: result.steps ?? null,
|
|
11164
|
+
duration_ms: result.duration_ms ?? null,
|
|
11165
|
+
reason: result.reason || result.error || null,
|
|
11166
|
+
}));
|
|
11167
|
+
}
|
|
11110
11168
|
function profileSetupCanvasSignatureReceipts(results) {
|
|
11111
11169
|
return (results || [])
|
|
11112
11170
|
.filter((result) => result && profileSetupResultAction(result) === "canvas_signature")
|
|
@@ -11229,6 +11287,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
11229
11287
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
11230
11288
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
11231
11289
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
11290
|
+
const dragReceipts = profileSetupDragReceipts(results);
|
|
11291
|
+
const sampledDragReceipts = sampleProfileSetupSummaryItems(dragReceipts, 8);
|
|
11232
11292
|
const canvasSignatureReceipts = profileSetupCanvasSignatureReceipts(results);
|
|
11233
11293
|
const sampledCanvasSignatureReceipts = sampleProfileSetupSummaryItems(canvasSignatureReceipts, 8);
|
|
11234
11294
|
const clickedItems = results
|
|
@@ -11292,6 +11352,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
11292
11352
|
set_range_value_total: rangeValueReceipts.length,
|
|
11293
11353
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
11294
11354
|
set_range_value: sampledRangeValueReceipts,
|
|
11355
|
+
drag_total: dragReceipts.length,
|
|
11356
|
+
drag_truncated: dragReceipts.length > sampledDragReceipts.length,
|
|
11357
|
+
drag: sampledDragReceipts,
|
|
11295
11358
|
canvas_signature_total: canvasSignatureReceipts.length,
|
|
11296
11359
|
canvas_signature_truncated: canvasSignatureReceipts.length > sampledCanvasSignatureReceipts.length,
|
|
11297
11360
|
canvas_signature: sampledCanvasSignatureReceipts,
|
|
@@ -13270,8 +13333,35 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
13270
13333
|
: { timeout, noWaitAfter: true };
|
|
13271
13334
|
const clickCount = setupNumber(action.click_count, 1);
|
|
13272
13335
|
if (Number.isInteger(clickCount) && clickCount > 1) clickOptions.clickCount = clickCount;
|
|
13336
|
+
const fromX = setupFiniteNumber(action.from_x ?? action.fromX ?? action.x ?? action.click_x ?? action.clickX);
|
|
13337
|
+
const fromY = setupFiniteNumber(action.from_y ?? action.fromY ?? action.y ?? action.click_y ?? action.clickY);
|
|
13338
|
+
const hasClickPosition = fromX !== undefined || fromY !== undefined;
|
|
13339
|
+
let position;
|
|
13340
|
+
let mode;
|
|
13341
|
+
if (hasClickPosition) {
|
|
13342
|
+
if (fromX === undefined || fromY === undefined) return { ...base, ...setupScopeEvidence(scope), reason: "missing_click_coordinates", count, target_index: targetIndex };
|
|
13343
|
+
const target = locator.nth(targetIndex);
|
|
13344
|
+
const box = await target.boundingBox();
|
|
13345
|
+
if (!box) return { ...base, ...setupScopeEvidence(scope), reason: "bounding_box_unavailable", count, target_index: targetIndex };
|
|
13346
|
+
mode = String(action.coordinate_mode || action.coordinateMode || "pixels").trim();
|
|
13347
|
+
const coordinate = (value, size) => mode === "ratio" ? value * size : value;
|
|
13348
|
+
position = { x: coordinate(fromX, box.width), y: coordinate(fromY, box.height) };
|
|
13349
|
+
clickOptions.position = position;
|
|
13350
|
+
}
|
|
13273
13351
|
await locator.nth(targetIndex).click(clickOptions);
|
|
13274
|
-
return {
|
|
13352
|
+
return {
|
|
13353
|
+
...base,
|
|
13354
|
+
...setupScopeEvidence(scope),
|
|
13355
|
+
ok: true,
|
|
13356
|
+
count,
|
|
13357
|
+
target_index: targetIndex,
|
|
13358
|
+
text: matchedText,
|
|
13359
|
+
force: action.force === true || undefined,
|
|
13360
|
+
click_count: clickCount > 1 ? clickCount : undefined,
|
|
13361
|
+
coordinate_mode: mode,
|
|
13362
|
+
x: position ? fromX : undefined,
|
|
13363
|
+
y: position ? fromY : undefined,
|
|
13364
|
+
};
|
|
13275
13365
|
}
|
|
13276
13366
|
if (type === "fill" || type === "set_input_value") {
|
|
13277
13367
|
const scope = await setupActionScope(action, timeout);
|
|
@@ -15864,6 +15954,7 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
15864
15954
|
const windowCallUntilTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_total) || 0), 0);
|
|
15865
15955
|
const windowCallUntilCallTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_call_total) || 0), 0);
|
|
15866
15956
|
const rangeValueTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.set_range_value_total) || 0), 0);
|
|
15957
|
+
const dragTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.drag_total) || 0), 0);
|
|
15867
15958
|
const canvasSignatureTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.canvas_signature_total) || 0), 0);
|
|
15868
15959
|
const failedTotal = viewports.reduce((sum, viewport) => sum + (Array.isArray(viewport.failed) ? viewport.failed.length : 0), 0);
|
|
15869
15960
|
const lines = [
|
|
@@ -15887,6 +15978,9 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
15887
15978
|
if (rangeValueTotal) {
|
|
15888
15979
|
lines.push(`- set_range_value: ${rangeValueTotal} action(s)`);
|
|
15889
15980
|
}
|
|
15981
|
+
if (dragTotal) {
|
|
15982
|
+
lines.push(`- drag: ${dragTotal} action(s)`);
|
|
15983
|
+
}
|
|
15890
15984
|
if (canvasSignatureTotal) {
|
|
15891
15985
|
lines.push(`- canvas_signature: ${canvasSignatureTotal} action(s)`);
|
|
15892
15986
|
}
|
|
@@ -15906,10 +16000,35 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
15906
16000
|
const windowCallUntilActions = cliFiniteNumber(viewport.window_call_until_total) || 0;
|
|
15907
16001
|
const windowCallUntilCalls = cliFiniteNumber(viewport.window_call_until_call_total) || 0;
|
|
15908
16002
|
const rangeValueActions = cliFiniteNumber(viewport.set_range_value_total) || 0;
|
|
16003
|
+
const dragActions = cliFiniteNumber(viewport.drag_total) || 0;
|
|
15909
16004
|
const canvasSignatureActions = cliFiniteNumber(viewport.canvas_signature_total) || 0;
|
|
15910
16005
|
const observedPath = cliString(viewport.observed_path);
|
|
15911
|
-
lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${rangeValueActions ? `, ${rangeValueActions} set_range_value action(s)` : ""}${canvasSignatureActions ? `, ${canvasSignatureActions} canvas_signature action(s)` : ""}${windowCallActions ? `, ${windowCallActions} window_call action(s), ${windowCallStored} stored return(s), ${windowCallCaptured} captured return(s)` : ""}${windowEvalActions ? `, ${windowEvalActions} window_eval action(s), ${windowEvalStored} stored return(s), ${windowEvalCaptured} captured return(s)` : ""}${windowCallUntilActions ? `, ${windowCallUntilActions} window_call_until action(s), ${windowCallUntilCalls} call(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
|
|
16006
|
+
lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${rangeValueActions ? `, ${rangeValueActions} set_range_value action(s)` : ""}${dragActions ? `, ${dragActions} drag action(s)` : ""}${canvasSignatureActions ? `, ${canvasSignatureActions} canvas_signature action(s)` : ""}${windowCallActions ? `, ${windowCallActions} window_call action(s), ${windowCallStored} stored return(s), ${windowCallCaptured} captured return(s)` : ""}${windowEvalActions ? `, ${windowEvalActions} window_eval action(s), ${windowEvalStored} stored return(s), ${windowEvalCaptured} captured return(s)` : ""}${windowCallUntilActions ? `, ${windowCallUntilActions} window_call_until action(s), ${windowCallUntilCalls} call(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
|
|
16007
|
+
}
|
|
16008
|
+
const dragGroups = viewports.map((viewport) => {
|
|
16009
|
+
const name = cliString(viewport.name) || "viewport";
|
|
16010
|
+
const receipts = Array.isArray(viewport.drag) ? viewport.drag.map(cliRecord).filter((item) => Boolean(item)) : [];
|
|
16011
|
+
return receipts.map((receipt) => ({ name, receipt }));
|
|
16012
|
+
});
|
|
16013
|
+
const dragDetails = dragGroups.flat();
|
|
16014
|
+
const sampledDragDetails = balancedSetupReceiptDetails(dragGroups, 12);
|
|
16015
|
+
for (const { name, receipt } of sampledDragDetails) {
|
|
16016
|
+
const selector = cliString(receipt.selector) || "target";
|
|
16017
|
+
const pointerType = cliString(receipt.pointer_type);
|
|
16018
|
+
const inputDispatch = cliString(receipt.input_dispatch);
|
|
16019
|
+
const coordinateMode = cliString(receipt.coordinate_mode);
|
|
16020
|
+
const fromX = cliValueLabel(receipt.from_x);
|
|
16021
|
+
const fromY = cliValueLabel(receipt.from_y);
|
|
16022
|
+
const toX = cliValueLabel(receipt.to_x);
|
|
16023
|
+
const toY = cliValueLabel(receipt.to_y);
|
|
16024
|
+
const steps = cliFiniteNumber(receipt.steps);
|
|
16025
|
+
const durationMs = cliFiniteNumber(receipt.duration_ms);
|
|
16026
|
+
const ok = receipt.ok === false ? "failed" : "ok";
|
|
16027
|
+
const reason = cliString(receipt.reason);
|
|
16028
|
+
const coordinateText = fromX && fromY && toX && toY ? `, ${coordinateMode ? `${coordinateMode} ` : ""}${markdownInlineCode(`${fromX},${fromY}`)} -> ${markdownInlineCode(`${toX},${toY}`)}` : "";
|
|
16029
|
+
lines.push(`- ${name} drag: ${ok}, ${markdownInlineCode(selector)}${pointerType ? ` ${markdownInlineCode(pointerType)}` : ""}${inputDispatch ? ` via ${markdownInlineCode(inputDispatch)}` : ""}${coordinateText}${steps === void 0 ? "" : `, steps ${steps}`}${durationMs === void 0 ? "" : `, duration ${durationMs}ms`}${reason ? `, reason ${markdownInlineCode(reason, 100)}` : ""}`);
|
|
15912
16030
|
}
|
|
16031
|
+
if (dragDetails.length > sampledDragDetails.length) lines.push(`- ${dragDetails.length - sampledDragDetails.length} additional drag receipt(s) omitted.`);
|
|
15913
16032
|
const canvasSignatureGroups = viewports.map((viewport) => {
|
|
15914
16033
|
const name = cliString(viewport.name) || "viewport";
|
|
15915
16034
|
const receipts = Array.isArray(viewport.canvas_signature) ? viewport.canvas_signature.map(cliRecord).filter((item) => Boolean(item)) : [];
|
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
profileStatusExitCode,
|
|
14
14
|
resolveRiddleProofProfileTargetUrl,
|
|
15
15
|
resolveRiddleProofProfileTimeoutSec
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-L6WJP5IY.js";
|
|
17
17
|
import {
|
|
18
18
|
createRiddleApiClient,
|
|
19
19
|
isTerminalRiddleJobStatus,
|
|
@@ -787,6 +787,7 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
787
787
|
const windowCallUntilTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_total) || 0), 0);
|
|
788
788
|
const windowCallUntilCallTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_call_total) || 0), 0);
|
|
789
789
|
const rangeValueTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.set_range_value_total) || 0), 0);
|
|
790
|
+
const dragTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.drag_total) || 0), 0);
|
|
790
791
|
const canvasSignatureTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.canvas_signature_total) || 0), 0);
|
|
791
792
|
const failedTotal = viewports.reduce((sum, viewport) => sum + (Array.isArray(viewport.failed) ? viewport.failed.length : 0), 0);
|
|
792
793
|
const lines = [
|
|
@@ -810,6 +811,9 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
810
811
|
if (rangeValueTotal) {
|
|
811
812
|
lines.push(`- set_range_value: ${rangeValueTotal} action(s)`);
|
|
812
813
|
}
|
|
814
|
+
if (dragTotal) {
|
|
815
|
+
lines.push(`- drag: ${dragTotal} action(s)`);
|
|
816
|
+
}
|
|
813
817
|
if (canvasSignatureTotal) {
|
|
814
818
|
lines.push(`- canvas_signature: ${canvasSignatureTotal} action(s)`);
|
|
815
819
|
}
|
|
@@ -829,10 +833,35 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
829
833
|
const windowCallUntilActions = cliFiniteNumber(viewport.window_call_until_total) || 0;
|
|
830
834
|
const windowCallUntilCalls = cliFiniteNumber(viewport.window_call_until_call_total) || 0;
|
|
831
835
|
const rangeValueActions = cliFiniteNumber(viewport.set_range_value_total) || 0;
|
|
836
|
+
const dragActions = cliFiniteNumber(viewport.drag_total) || 0;
|
|
832
837
|
const canvasSignatureActions = cliFiniteNumber(viewport.canvas_signature_total) || 0;
|
|
833
838
|
const observedPath = cliString(viewport.observed_path);
|
|
834
|
-
lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${rangeValueActions ? `, ${rangeValueActions} set_range_value action(s)` : ""}${canvasSignatureActions ? `, ${canvasSignatureActions} canvas_signature action(s)` : ""}${windowCallActions ? `, ${windowCallActions} window_call action(s), ${windowCallStored} stored return(s), ${windowCallCaptured} captured return(s)` : ""}${windowEvalActions ? `, ${windowEvalActions} window_eval action(s), ${windowEvalStored} stored return(s), ${windowEvalCaptured} captured return(s)` : ""}${windowCallUntilActions ? `, ${windowCallUntilActions} window_call_until action(s), ${windowCallUntilCalls} call(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
|
|
839
|
+
lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${rangeValueActions ? `, ${rangeValueActions} set_range_value action(s)` : ""}${dragActions ? `, ${dragActions} drag action(s)` : ""}${canvasSignatureActions ? `, ${canvasSignatureActions} canvas_signature action(s)` : ""}${windowCallActions ? `, ${windowCallActions} window_call action(s), ${windowCallStored} stored return(s), ${windowCallCaptured} captured return(s)` : ""}${windowEvalActions ? `, ${windowEvalActions} window_eval action(s), ${windowEvalStored} stored return(s), ${windowEvalCaptured} captured return(s)` : ""}${windowCallUntilActions ? `, ${windowCallUntilActions} window_call_until action(s), ${windowCallUntilCalls} call(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
|
|
840
|
+
}
|
|
841
|
+
const dragGroups = viewports.map((viewport) => {
|
|
842
|
+
const name = cliString(viewport.name) || "viewport";
|
|
843
|
+
const receipts = Array.isArray(viewport.drag) ? viewport.drag.map(cliRecord).filter((item) => Boolean(item)) : [];
|
|
844
|
+
return receipts.map((receipt) => ({ name, receipt }));
|
|
845
|
+
});
|
|
846
|
+
const dragDetails = dragGroups.flat();
|
|
847
|
+
const sampledDragDetails = balancedSetupReceiptDetails(dragGroups, 12);
|
|
848
|
+
for (const { name, receipt } of sampledDragDetails) {
|
|
849
|
+
const selector = cliString(receipt.selector) || "target";
|
|
850
|
+
const pointerType = cliString(receipt.pointer_type);
|
|
851
|
+
const inputDispatch = cliString(receipt.input_dispatch);
|
|
852
|
+
const coordinateMode = cliString(receipt.coordinate_mode);
|
|
853
|
+
const fromX = cliValueLabel(receipt.from_x);
|
|
854
|
+
const fromY = cliValueLabel(receipt.from_y);
|
|
855
|
+
const toX = cliValueLabel(receipt.to_x);
|
|
856
|
+
const toY = cliValueLabel(receipt.to_y);
|
|
857
|
+
const steps = cliFiniteNumber(receipt.steps);
|
|
858
|
+
const durationMs = cliFiniteNumber(receipt.duration_ms);
|
|
859
|
+
const ok = receipt.ok === false ? "failed" : "ok";
|
|
860
|
+
const reason = cliString(receipt.reason);
|
|
861
|
+
const coordinateText = fromX && fromY && toX && toY ? `, ${coordinateMode ? `${coordinateMode} ` : ""}${markdownInlineCode(`${fromX},${fromY}`)} -> ${markdownInlineCode(`${toX},${toY}`)}` : "";
|
|
862
|
+
lines.push(`- ${name} drag: ${ok}, ${markdownInlineCode(selector)}${pointerType ? ` ${markdownInlineCode(pointerType)}` : ""}${inputDispatch ? ` via ${markdownInlineCode(inputDispatch)}` : ""}${coordinateText}${steps === void 0 ? "" : `, steps ${steps}`}${durationMs === void 0 ? "" : `, duration ${durationMs}ms`}${reason ? `, reason ${markdownInlineCode(reason, 100)}` : ""}`);
|
|
835
863
|
}
|
|
864
|
+
if (dragDetails.length > sampledDragDetails.length) lines.push(`- ${dragDetails.length - sampledDragDetails.length} additional drag receipt(s) omitted.`);
|
|
836
865
|
const canvasSignatureGroups = viewports.map((viewport) => {
|
|
837
866
|
const name = cliString(viewport.name) || "viewport";
|
|
838
867
|
const receipts = Array.isArray(viewport.canvas_signature) ? viewport.canvas_signature.map(cliRecord).filter((item) => Boolean(item)) : [];
|
package/dist/index.cjs
CHANGED
|
@@ -9284,6 +9284,24 @@ function profileSetupRangeValueReceipts(results) {
|
|
|
9284
9284
|
reason: result.reason ?? result.error ?? null
|
|
9285
9285
|
}));
|
|
9286
9286
|
}
|
|
9287
|
+
function profileSetupDragReceipts(results) {
|
|
9288
|
+
return results.filter((result) => profileSetupResultAction(result) === "drag").map((result) => ({
|
|
9289
|
+
ordinal: result.ordinal ?? null,
|
|
9290
|
+
ok: result.ok !== false,
|
|
9291
|
+
selector: result.selector ?? null,
|
|
9292
|
+
frame_selector: result.frame_selector ?? null,
|
|
9293
|
+
pointer_type: result.pointer_type ?? null,
|
|
9294
|
+
input_dispatch: result.input_dispatch ?? null,
|
|
9295
|
+
coordinate_mode: result.coordinate_mode ?? null,
|
|
9296
|
+
from_x: result.from_x ?? null,
|
|
9297
|
+
from_y: result.from_y ?? null,
|
|
9298
|
+
to_x: result.to_x ?? null,
|
|
9299
|
+
to_y: result.to_y ?? null,
|
|
9300
|
+
steps: result.steps ?? null,
|
|
9301
|
+
duration_ms: result.duration_ms ?? null,
|
|
9302
|
+
reason: result.reason ?? result.error ?? null
|
|
9303
|
+
}));
|
|
9304
|
+
}
|
|
9287
9305
|
function profileSetupCanvasSignatureReceipts(results) {
|
|
9288
9306
|
return results.filter((result) => profileSetupResultAction(result) === "canvas_signature").map((result) => ({
|
|
9289
9307
|
ordinal: result.ordinal ?? null,
|
|
@@ -9383,6 +9401,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
9383
9401
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
9384
9402
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
9385
9403
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
9404
|
+
const dragReceipts = profileSetupDragReceipts(results);
|
|
9405
|
+
const sampledDragReceipts = sampleProfileSetupSummaryItems(dragReceipts, 8);
|
|
9386
9406
|
const canvasSignatureReceipts = profileSetupCanvasSignatureReceipts(results);
|
|
9387
9407
|
const sampledCanvasSignatureReceipts = sampleProfileSetupSummaryItems(canvasSignatureReceipts, 8);
|
|
9388
9408
|
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
@@ -9436,6 +9456,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
9436
9456
|
set_range_value_total: rangeValueReceipts.length,
|
|
9437
9457
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
9438
9458
|
set_range_value: sampledRangeValueReceipts,
|
|
9459
|
+
drag_total: dragReceipts.length,
|
|
9460
|
+
drag_truncated: dragReceipts.length > sampledDragReceipts.length,
|
|
9461
|
+
drag: sampledDragReceipts,
|
|
9439
9462
|
canvas_signature_total: canvasSignatureReceipts.length,
|
|
9440
9463
|
canvas_signature_truncated: canvasSignatureReceipts.length > sampledCanvasSignatureReceipts.length,
|
|
9441
9464
|
canvas_signature: sampledCanvasSignatureReceipts,
|
|
@@ -9624,12 +9647,27 @@ function normalizeSetupAction(input, index) {
|
|
|
9624
9647
|
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "canvas_signature" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
9625
9648
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
9626
9649
|
}
|
|
9627
|
-
const fromX = numberValue3(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
9628
|
-
const fromY = numberValue3(valueFromOwn(input, "from_y", "fromY", "start_y", "startY", "y1"));
|
|
9650
|
+
const fromX = type === "click" ? numberValue3(valueFromOwn(input, "from_x", "fromX", "x", "click_x", "clickX", "start_x", "startX", "x1")) : numberValue3(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
9651
|
+
const fromY = type === "click" ? numberValue3(valueFromOwn(input, "from_y", "fromY", "y", "click_y", "clickY", "start_y", "startY", "y1")) : numberValue3(valueFromOwn(input, "from_y", "fromY", "start_y", "startY", "y1"));
|
|
9629
9652
|
const toX = numberValue3(valueFromOwn(input, "to_x", "toX", "end_x", "endX", "x2"));
|
|
9630
9653
|
const toY = numberValue3(valueFromOwn(input, "to_y", "toY", "end_y", "endY", "y2"));
|
|
9631
9654
|
const coordinateMode = normalizeSetupActionCoordinateMode(valueFromOwn(input, "coordinate_mode", "coordinateMode", "coords", "units"), index);
|
|
9632
9655
|
const pointerType = normalizeSetupActionPointerType(valueFromOwn(input, "pointer_type", "pointerType", "input_type", "inputType"), type, index);
|
|
9656
|
+
if (type === "click") {
|
|
9657
|
+
const hasClickCoordinate = fromX !== void 0 || fromY !== void 0;
|
|
9658
|
+
if (hasClickCoordinate && (fromX === void 0 || fromY === void 0)) {
|
|
9659
|
+
throw new Error(`target.setup_actions[${index}] click coordinates require both x and y.`);
|
|
9660
|
+
}
|
|
9661
|
+
if (hasClickCoordinate && fromX !== void 0 && fromY !== void 0) {
|
|
9662
|
+
const clickCoordinates = [fromX, fromY];
|
|
9663
|
+
if (coordinateMode === "ratio" && clickCoordinates.some((value2) => value2 < 0 || value2 > 1)) {
|
|
9664
|
+
throw new Error(`target.setup_actions[${index}] click ratio coordinates must be between 0 and 1.`);
|
|
9665
|
+
}
|
|
9666
|
+
if ((coordinateMode === void 0 || coordinateMode === "pixels") && clickCoordinates.some((value2) => value2 < 0)) {
|
|
9667
|
+
throw new Error(`target.setup_actions[${index}] click pixel coordinates must be non-negative.`);
|
|
9668
|
+
}
|
|
9669
|
+
}
|
|
9670
|
+
}
|
|
9633
9671
|
if (type === "drag") {
|
|
9634
9672
|
if (fromX === void 0 || fromY === void 0 || toX === void 0 || toY === void 0) {
|
|
9635
9673
|
throw new Error(`target.setup_actions[${index}] drag requires from_x, from_y, to_x, and to_y.`);
|
|
@@ -12899,6 +12937,26 @@ function profileSetupRangeValueReceipts(results) {
|
|
|
12899
12937
|
reason: result.reason || result.error || null,
|
|
12900
12938
|
}));
|
|
12901
12939
|
}
|
|
12940
|
+
function profileSetupDragReceipts(results) {
|
|
12941
|
+
return (results || [])
|
|
12942
|
+
.filter((result) => result && profileSetupResultAction(result) === "drag")
|
|
12943
|
+
.map((result) => ({
|
|
12944
|
+
ordinal: result.ordinal ?? null,
|
|
12945
|
+
ok: result.ok !== false,
|
|
12946
|
+
selector: result.selector ?? null,
|
|
12947
|
+
frame_selector: result.frame_selector ?? null,
|
|
12948
|
+
pointer_type: result.pointer_type ?? null,
|
|
12949
|
+
input_dispatch: result.input_dispatch ?? null,
|
|
12950
|
+
coordinate_mode: result.coordinate_mode ?? null,
|
|
12951
|
+
from_x: result.from_x ?? null,
|
|
12952
|
+
from_y: result.from_y ?? null,
|
|
12953
|
+
to_x: result.to_x ?? null,
|
|
12954
|
+
to_y: result.to_y ?? null,
|
|
12955
|
+
steps: result.steps ?? null,
|
|
12956
|
+
duration_ms: result.duration_ms ?? null,
|
|
12957
|
+
reason: result.reason || result.error || null,
|
|
12958
|
+
}));
|
|
12959
|
+
}
|
|
12902
12960
|
function profileSetupCanvasSignatureReceipts(results) {
|
|
12903
12961
|
return (results || [])
|
|
12904
12962
|
.filter((result) => result && profileSetupResultAction(result) === "canvas_signature")
|
|
@@ -13021,6 +13079,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
13021
13079
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
13022
13080
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
13023
13081
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
13082
|
+
const dragReceipts = profileSetupDragReceipts(results);
|
|
13083
|
+
const sampledDragReceipts = sampleProfileSetupSummaryItems(dragReceipts, 8);
|
|
13024
13084
|
const canvasSignatureReceipts = profileSetupCanvasSignatureReceipts(results);
|
|
13025
13085
|
const sampledCanvasSignatureReceipts = sampleProfileSetupSummaryItems(canvasSignatureReceipts, 8);
|
|
13026
13086
|
const clickedItems = results
|
|
@@ -13084,6 +13144,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
13084
13144
|
set_range_value_total: rangeValueReceipts.length,
|
|
13085
13145
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
13086
13146
|
set_range_value: sampledRangeValueReceipts,
|
|
13147
|
+
drag_total: dragReceipts.length,
|
|
13148
|
+
drag_truncated: dragReceipts.length > sampledDragReceipts.length,
|
|
13149
|
+
drag: sampledDragReceipts,
|
|
13087
13150
|
canvas_signature_total: canvasSignatureReceipts.length,
|
|
13088
13151
|
canvas_signature_truncated: canvasSignatureReceipts.length > sampledCanvasSignatureReceipts.length,
|
|
13089
13152
|
canvas_signature: sampledCanvasSignatureReceipts,
|
|
@@ -15062,8 +15125,35 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
15062
15125
|
: { timeout, noWaitAfter: true };
|
|
15063
15126
|
const clickCount = setupNumber(action.click_count, 1);
|
|
15064
15127
|
if (Number.isInteger(clickCount) && clickCount > 1) clickOptions.clickCount = clickCount;
|
|
15128
|
+
const fromX = setupFiniteNumber(action.from_x ?? action.fromX ?? action.x ?? action.click_x ?? action.clickX);
|
|
15129
|
+
const fromY = setupFiniteNumber(action.from_y ?? action.fromY ?? action.y ?? action.click_y ?? action.clickY);
|
|
15130
|
+
const hasClickPosition = fromX !== undefined || fromY !== undefined;
|
|
15131
|
+
let position;
|
|
15132
|
+
let mode;
|
|
15133
|
+
if (hasClickPosition) {
|
|
15134
|
+
if (fromX === undefined || fromY === undefined) return { ...base, ...setupScopeEvidence(scope), reason: "missing_click_coordinates", count, target_index: targetIndex };
|
|
15135
|
+
const target = locator.nth(targetIndex);
|
|
15136
|
+
const box = await target.boundingBox();
|
|
15137
|
+
if (!box) return { ...base, ...setupScopeEvidence(scope), reason: "bounding_box_unavailable", count, target_index: targetIndex };
|
|
15138
|
+
mode = String(action.coordinate_mode || action.coordinateMode || "pixels").trim();
|
|
15139
|
+
const coordinate = (value, size) => mode === "ratio" ? value * size : value;
|
|
15140
|
+
position = { x: coordinate(fromX, box.width), y: coordinate(fromY, box.height) };
|
|
15141
|
+
clickOptions.position = position;
|
|
15142
|
+
}
|
|
15065
15143
|
await locator.nth(targetIndex).click(clickOptions);
|
|
15066
|
-
return {
|
|
15144
|
+
return {
|
|
15145
|
+
...base,
|
|
15146
|
+
...setupScopeEvidence(scope),
|
|
15147
|
+
ok: true,
|
|
15148
|
+
count,
|
|
15149
|
+
target_index: targetIndex,
|
|
15150
|
+
text: matchedText,
|
|
15151
|
+
force: action.force === true || undefined,
|
|
15152
|
+
click_count: clickCount > 1 ? clickCount : undefined,
|
|
15153
|
+
coordinate_mode: mode,
|
|
15154
|
+
x: position ? fromX : undefined,
|
|
15155
|
+
y: position ? fromY : undefined,
|
|
15156
|
+
};
|
|
15067
15157
|
}
|
|
15068
15158
|
if (type === "fill" || type === "set_input_value") {
|
|
15069
15159
|
const scope = await setupActionScope(action, timeout);
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
resolveRiddleProofProfileTimeoutSec,
|
|
63
63
|
slugifyRiddleProofProfileName,
|
|
64
64
|
summarizeRiddleProofProfileResult
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-L6WJP5IY.js";
|
|
66
66
|
import {
|
|
67
67
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
68
68
|
DEFAULT_RIDDLE_API_KEY_FILE,
|
package/dist/profile.cjs
CHANGED
|
@@ -598,6 +598,24 @@ function profileSetupRangeValueReceipts(results) {
|
|
|
598
598
|
reason: result.reason ?? result.error ?? null
|
|
599
599
|
}));
|
|
600
600
|
}
|
|
601
|
+
function profileSetupDragReceipts(results) {
|
|
602
|
+
return results.filter((result) => profileSetupResultAction(result) === "drag").map((result) => ({
|
|
603
|
+
ordinal: result.ordinal ?? null,
|
|
604
|
+
ok: result.ok !== false,
|
|
605
|
+
selector: result.selector ?? null,
|
|
606
|
+
frame_selector: result.frame_selector ?? null,
|
|
607
|
+
pointer_type: result.pointer_type ?? null,
|
|
608
|
+
input_dispatch: result.input_dispatch ?? null,
|
|
609
|
+
coordinate_mode: result.coordinate_mode ?? null,
|
|
610
|
+
from_x: result.from_x ?? null,
|
|
611
|
+
from_y: result.from_y ?? null,
|
|
612
|
+
to_x: result.to_x ?? null,
|
|
613
|
+
to_y: result.to_y ?? null,
|
|
614
|
+
steps: result.steps ?? null,
|
|
615
|
+
duration_ms: result.duration_ms ?? null,
|
|
616
|
+
reason: result.reason ?? result.error ?? null
|
|
617
|
+
}));
|
|
618
|
+
}
|
|
601
619
|
function profileSetupCanvasSignatureReceipts(results) {
|
|
602
620
|
return results.filter((result) => profileSetupResultAction(result) === "canvas_signature").map((result) => ({
|
|
603
621
|
ordinal: result.ordinal ?? null,
|
|
@@ -697,6 +715,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
697
715
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
698
716
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
699
717
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
718
|
+
const dragReceipts = profileSetupDragReceipts(results);
|
|
719
|
+
const sampledDragReceipts = sampleProfileSetupSummaryItems(dragReceipts, 8);
|
|
700
720
|
const canvasSignatureReceipts = profileSetupCanvasSignatureReceipts(results);
|
|
701
721
|
const sampledCanvasSignatureReceipts = sampleProfileSetupSummaryItems(canvasSignatureReceipts, 8);
|
|
702
722
|
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
@@ -750,6 +770,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
750
770
|
set_range_value_total: rangeValueReceipts.length,
|
|
751
771
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
752
772
|
set_range_value: sampledRangeValueReceipts,
|
|
773
|
+
drag_total: dragReceipts.length,
|
|
774
|
+
drag_truncated: dragReceipts.length > sampledDragReceipts.length,
|
|
775
|
+
drag: sampledDragReceipts,
|
|
753
776
|
canvas_signature_total: canvasSignatureReceipts.length,
|
|
754
777
|
canvas_signature_truncated: canvasSignatureReceipts.length > sampledCanvasSignatureReceipts.length,
|
|
755
778
|
canvas_signature: sampledCanvasSignatureReceipts,
|
|
@@ -938,12 +961,27 @@ function normalizeSetupAction(input, index) {
|
|
|
938
961
|
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "canvas_signature" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
939
962
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
940
963
|
}
|
|
941
|
-
const fromX = numberValue(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
942
|
-
const fromY = numberValue(valueFromOwn(input, "from_y", "fromY", "start_y", "startY", "y1"));
|
|
964
|
+
const fromX = type === "click" ? numberValue(valueFromOwn(input, "from_x", "fromX", "x", "click_x", "clickX", "start_x", "startX", "x1")) : numberValue(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
965
|
+
const fromY = type === "click" ? numberValue(valueFromOwn(input, "from_y", "fromY", "y", "click_y", "clickY", "start_y", "startY", "y1")) : numberValue(valueFromOwn(input, "from_y", "fromY", "start_y", "startY", "y1"));
|
|
943
966
|
const toX = numberValue(valueFromOwn(input, "to_x", "toX", "end_x", "endX", "x2"));
|
|
944
967
|
const toY = numberValue(valueFromOwn(input, "to_y", "toY", "end_y", "endY", "y2"));
|
|
945
968
|
const coordinateMode = normalizeSetupActionCoordinateMode(valueFromOwn(input, "coordinate_mode", "coordinateMode", "coords", "units"), index);
|
|
946
969
|
const pointerType = normalizeSetupActionPointerType(valueFromOwn(input, "pointer_type", "pointerType", "input_type", "inputType"), type, index);
|
|
970
|
+
if (type === "click") {
|
|
971
|
+
const hasClickCoordinate = fromX !== void 0 || fromY !== void 0;
|
|
972
|
+
if (hasClickCoordinate && (fromX === void 0 || fromY === void 0)) {
|
|
973
|
+
throw new Error(`target.setup_actions[${index}] click coordinates require both x and y.`);
|
|
974
|
+
}
|
|
975
|
+
if (hasClickCoordinate && fromX !== void 0 && fromY !== void 0) {
|
|
976
|
+
const clickCoordinates = [fromX, fromY];
|
|
977
|
+
if (coordinateMode === "ratio" && clickCoordinates.some((value2) => value2 < 0 || value2 > 1)) {
|
|
978
|
+
throw new Error(`target.setup_actions[${index}] click ratio coordinates must be between 0 and 1.`);
|
|
979
|
+
}
|
|
980
|
+
if ((coordinateMode === void 0 || coordinateMode === "pixels") && clickCoordinates.some((value2) => value2 < 0)) {
|
|
981
|
+
throw new Error(`target.setup_actions[${index}] click pixel coordinates must be non-negative.`);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}
|
|
947
985
|
if (type === "drag") {
|
|
948
986
|
if (fromX === void 0 || fromY === void 0 || toX === void 0 || toY === void 0) {
|
|
949
987
|
throw new Error(`target.setup_actions[${index}] drag requires from_x, from_y, to_x, and to_y.`);
|
|
@@ -4213,6 +4251,26 @@ function profileSetupRangeValueReceipts(results) {
|
|
|
4213
4251
|
reason: result.reason || result.error || null,
|
|
4214
4252
|
}));
|
|
4215
4253
|
}
|
|
4254
|
+
function profileSetupDragReceipts(results) {
|
|
4255
|
+
return (results || [])
|
|
4256
|
+
.filter((result) => result && profileSetupResultAction(result) === "drag")
|
|
4257
|
+
.map((result) => ({
|
|
4258
|
+
ordinal: result.ordinal ?? null,
|
|
4259
|
+
ok: result.ok !== false,
|
|
4260
|
+
selector: result.selector ?? null,
|
|
4261
|
+
frame_selector: result.frame_selector ?? null,
|
|
4262
|
+
pointer_type: result.pointer_type ?? null,
|
|
4263
|
+
input_dispatch: result.input_dispatch ?? null,
|
|
4264
|
+
coordinate_mode: result.coordinate_mode ?? null,
|
|
4265
|
+
from_x: result.from_x ?? null,
|
|
4266
|
+
from_y: result.from_y ?? null,
|
|
4267
|
+
to_x: result.to_x ?? null,
|
|
4268
|
+
to_y: result.to_y ?? null,
|
|
4269
|
+
steps: result.steps ?? null,
|
|
4270
|
+
duration_ms: result.duration_ms ?? null,
|
|
4271
|
+
reason: result.reason || result.error || null,
|
|
4272
|
+
}));
|
|
4273
|
+
}
|
|
4216
4274
|
function profileSetupCanvasSignatureReceipts(results) {
|
|
4217
4275
|
return (results || [])
|
|
4218
4276
|
.filter((result) => result && profileSetupResultAction(result) === "canvas_signature")
|
|
@@ -4335,6 +4393,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
4335
4393
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
4336
4394
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
4337
4395
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
4396
|
+
const dragReceipts = profileSetupDragReceipts(results);
|
|
4397
|
+
const sampledDragReceipts = sampleProfileSetupSummaryItems(dragReceipts, 8);
|
|
4338
4398
|
const canvasSignatureReceipts = profileSetupCanvasSignatureReceipts(results);
|
|
4339
4399
|
const sampledCanvasSignatureReceipts = sampleProfileSetupSummaryItems(canvasSignatureReceipts, 8);
|
|
4340
4400
|
const clickedItems = results
|
|
@@ -4398,6 +4458,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
4398
4458
|
set_range_value_total: rangeValueReceipts.length,
|
|
4399
4459
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
4400
4460
|
set_range_value: sampledRangeValueReceipts,
|
|
4461
|
+
drag_total: dragReceipts.length,
|
|
4462
|
+
drag_truncated: dragReceipts.length > sampledDragReceipts.length,
|
|
4463
|
+
drag: sampledDragReceipts,
|
|
4401
4464
|
canvas_signature_total: canvasSignatureReceipts.length,
|
|
4402
4465
|
canvas_signature_truncated: canvasSignatureReceipts.length > sampledCanvasSignatureReceipts.length,
|
|
4403
4466
|
canvas_signature: sampledCanvasSignatureReceipts,
|
|
@@ -6376,8 +6439,35 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
6376
6439
|
: { timeout, noWaitAfter: true };
|
|
6377
6440
|
const clickCount = setupNumber(action.click_count, 1);
|
|
6378
6441
|
if (Number.isInteger(clickCount) && clickCount > 1) clickOptions.clickCount = clickCount;
|
|
6442
|
+
const fromX = setupFiniteNumber(action.from_x ?? action.fromX ?? action.x ?? action.click_x ?? action.clickX);
|
|
6443
|
+
const fromY = setupFiniteNumber(action.from_y ?? action.fromY ?? action.y ?? action.click_y ?? action.clickY);
|
|
6444
|
+
const hasClickPosition = fromX !== undefined || fromY !== undefined;
|
|
6445
|
+
let position;
|
|
6446
|
+
let mode;
|
|
6447
|
+
if (hasClickPosition) {
|
|
6448
|
+
if (fromX === undefined || fromY === undefined) return { ...base, ...setupScopeEvidence(scope), reason: "missing_click_coordinates", count, target_index: targetIndex };
|
|
6449
|
+
const target = locator.nth(targetIndex);
|
|
6450
|
+
const box = await target.boundingBox();
|
|
6451
|
+
if (!box) return { ...base, ...setupScopeEvidence(scope), reason: "bounding_box_unavailable", count, target_index: targetIndex };
|
|
6452
|
+
mode = String(action.coordinate_mode || action.coordinateMode || "pixels").trim();
|
|
6453
|
+
const coordinate = (value, size) => mode === "ratio" ? value * size : value;
|
|
6454
|
+
position = { x: coordinate(fromX, box.width), y: coordinate(fromY, box.height) };
|
|
6455
|
+
clickOptions.position = position;
|
|
6456
|
+
}
|
|
6379
6457
|
await locator.nth(targetIndex).click(clickOptions);
|
|
6380
|
-
return {
|
|
6458
|
+
return {
|
|
6459
|
+
...base,
|
|
6460
|
+
...setupScopeEvidence(scope),
|
|
6461
|
+
ok: true,
|
|
6462
|
+
count,
|
|
6463
|
+
target_index: targetIndex,
|
|
6464
|
+
text: matchedText,
|
|
6465
|
+
force: action.force === true || undefined,
|
|
6466
|
+
click_count: clickCount > 1 ? clickCount : undefined,
|
|
6467
|
+
coordinate_mode: mode,
|
|
6468
|
+
x: position ? fromX : undefined,
|
|
6469
|
+
y: position ? fromY : undefined,
|
|
6470
|
+
};
|
|
6381
6471
|
}
|
|
6382
6472
|
if (type === "fill" || type === "set_input_value") {
|
|
6383
6473
|
const scope = await setupActionScope(action, timeout);
|
package/dist/profile.js
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
resolveRiddleProofProfileTimeoutSec,
|
|
24
24
|
slugifyRiddleProofProfileName,
|
|
25
25
|
summarizeRiddleProofProfileResult
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-L6WJP5IY.js";
|
|
27
27
|
export {
|
|
28
28
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
29
29
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|