@riddledc/riddle-proof 0.7.147 → 0.7.149
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 +9 -2
- package/dist/{chunk-ZC6AK3D3.js → chunk-QXQCG3WB.js} +100 -3
- package/dist/cli.cjs +125 -4
- package/dist/cli.js +26 -2
- package/dist/index.cjs +100 -3
- package/dist/index.js +1 -1
- package/dist/profile.cjs +100 -3
- package/dist/profile.d.cts +1 -1
- package/dist/profile.d.ts +1 -1
- package/dist/profile.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -397,8 +397,8 @@ when body matching overrides sequence order.
|
|
|
397
397
|
`target.setup_actions` is optional. Use it when the meaningful proof surface
|
|
398
398
|
appears only after a picker, tab, login stub, storage seed, form fill,
|
|
399
399
|
transport control, or other bounded interaction. Supported setup actions are
|
|
400
|
-
`click`, `drag`, `press`, `fill`, `set_input_value`, `
|
|
401
|
-
`assert_text_absent`, `assert_selector_count`, `assert_window_value`,
|
|
400
|
+
`click`, `drag`, `press`, `fill`, `set_input_value`, `set_range_value`,
|
|
401
|
+
`assert_text_visible`, `assert_text_absent`, `assert_selector_count`, `assert_window_value`,
|
|
402
402
|
`assert_window_number`, `local_storage`, `session_storage`, `clear_storage`,
|
|
403
403
|
`clear_console`, `screenshot`, `wait`, `wait_for_selector`, `wait_for_text`,
|
|
404
404
|
`window_eval`, `window_call`, and `window_call_until`;
|
|
@@ -415,6 +415,13 @@ Use `click_count` / `clickCount` / `clicks` from 1 to 10 on a single `click`
|
|
|
415
415
|
action for atomic double-click or double-submit contracts where modeling the
|
|
416
416
|
interaction as repeated setup actions would incorrectly require the target to
|
|
417
417
|
remain in the DOM after the first click.
|
|
418
|
+
Use `set_range_value` for HTML range inputs and React-controlled sliders. It
|
|
419
|
+
accepts aliases such as `set-slider-value`, requires `selector` plus `value`,
|
|
420
|
+
uses the native input value setter, dispatches bubbling `input` and `change`
|
|
421
|
+
events, and records the requested value plus the browser's actual normalized
|
|
422
|
+
value, numeric value, `min`, `max`, and `step`. The action is intentionally
|
|
423
|
+
strict: if the target is not an `input[type="range"]`, setup fails with
|
|
424
|
+
`not_range_input` instead of silently treating the control like a text field.
|
|
418
425
|
Use `drag` for pointer-driven controls such as canvas launch areas, sliders, or
|
|
419
426
|
drag-to-aim games. Provide `selector`, `from_x`, `from_y`, `to_x`, and `to_y`;
|
|
420
427
|
coordinates are element-relative pixels by default. Set `coordinate_mode:
|
|
@@ -47,6 +47,7 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
|
|
|
47
47
|
"press",
|
|
48
48
|
"fill",
|
|
49
49
|
"set_input_value",
|
|
50
|
+
"set_range_value",
|
|
50
51
|
"assert_text_visible",
|
|
51
52
|
"assert_text_absent",
|
|
52
53
|
"assert_selector_count",
|
|
@@ -496,6 +497,22 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
496
497
|
return receipt;
|
|
497
498
|
});
|
|
498
499
|
}
|
|
500
|
+
function profileSetupRangeValueReceipts(results) {
|
|
501
|
+
return results.filter((result) => profileSetupResultAction(result) === "set_range_value").map((result) => ({
|
|
502
|
+
ordinal: result.ordinal ?? null,
|
|
503
|
+
ok: result.ok !== false,
|
|
504
|
+
selector: result.selector ?? null,
|
|
505
|
+
frame_selector: result.frame_selector ?? null,
|
|
506
|
+
requested_value: result.requested_value ?? null,
|
|
507
|
+
actual_value: result.actual_value ?? null,
|
|
508
|
+
before_value: result.before_value ?? null,
|
|
509
|
+
value_as_number: result.value_as_number ?? null,
|
|
510
|
+
min: result.min ?? null,
|
|
511
|
+
max: result.max ?? null,
|
|
512
|
+
step: result.step ?? null,
|
|
513
|
+
reason: result.reason ?? result.error ?? null
|
|
514
|
+
}));
|
|
515
|
+
}
|
|
499
516
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
500
517
|
if (items.length <= limit) return items;
|
|
501
518
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -538,6 +555,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
538
555
|
const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
539
556
|
const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
|
|
540
557
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
558
|
+
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
559
|
+
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
541
560
|
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
542
561
|
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0;
|
|
543
562
|
return {
|
|
@@ -586,6 +605,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
586
605
|
window_eval_captured_total: windowEvalCapturedTotal,
|
|
587
606
|
window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
|
|
588
607
|
window_eval: sampledWindowEvalReceipts,
|
|
608
|
+
set_range_value_total: rangeValueReceipts.length,
|
|
609
|
+
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
610
|
+
set_range_value: sampledRangeValueReceipts,
|
|
589
611
|
clicked,
|
|
590
612
|
text_samples,
|
|
591
613
|
failed: failed.map((result) => ({
|
|
@@ -638,7 +660,7 @@ function isSupportedCheckType(value) {
|
|
|
638
660
|
}
|
|
639
661
|
function normalizeSetupActionType(value, index) {
|
|
640
662
|
const normalizedInput = String(value || "").trim().replace(/-/g, "_");
|
|
641
|
-
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
663
|
+
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "set_slider_value" || normalizedInput === "slider_value" || normalizedInput === "set_slider" || normalizedInput === "set_range" || normalizedInput === "range_value" || normalizedInput === "range_input" || normalizedInput === "set_range_input" ? "set_range_value" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
642
664
|
if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
|
|
643
665
|
return normalized;
|
|
644
666
|
}
|
|
@@ -736,7 +758,7 @@ function normalizeSetupAction(input, index) {
|
|
|
736
758
|
if (frameIndex !== void 0 && (!Number.isInteger(frameIndex) || frameIndex < 0)) {
|
|
737
759
|
throw new Error(`target.setup_actions[${index}].frame_index must be a non-negative integer.`);
|
|
738
760
|
}
|
|
739
|
-
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
761
|
+
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
740
762
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
741
763
|
}
|
|
742
764
|
const fromX = numberValue(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
@@ -768,7 +790,7 @@ function normalizeSetupAction(input, index) {
|
|
|
768
790
|
}
|
|
769
791
|
const value = stringFromOwn(input, "value", "input_value", "inputValue");
|
|
770
792
|
const hasJsonValue = hasOwn(input, "value_json") || hasOwn(input, "valueJson") || hasOwn(input, "json");
|
|
771
|
-
if ((type === "fill" || type === "set_input_value") && value === void 0 && !hasJsonValue) {
|
|
793
|
+
if ((type === "fill" || type === "set_input_value" || type === "set_range_value") && value === void 0 && !hasJsonValue) {
|
|
772
794
|
throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
|
|
773
795
|
}
|
|
774
796
|
const key = stringValue(input.key);
|
|
@@ -3895,6 +3917,24 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
3895
3917
|
return receipt;
|
|
3896
3918
|
});
|
|
3897
3919
|
}
|
|
3920
|
+
function profileSetupRangeValueReceipts(results) {
|
|
3921
|
+
return (results || [])
|
|
3922
|
+
.filter((result) => result && profileSetupResultAction(result) === "set_range_value")
|
|
3923
|
+
.map((result) => ({
|
|
3924
|
+
ordinal: result.ordinal ?? null,
|
|
3925
|
+
ok: result.ok !== false,
|
|
3926
|
+
selector: result.selector ?? null,
|
|
3927
|
+
frame_selector: result.frame_selector ?? null,
|
|
3928
|
+
requested_value: result.requested_value ?? null,
|
|
3929
|
+
actual_value: result.actual_value ?? null,
|
|
3930
|
+
before_value: result.before_value ?? null,
|
|
3931
|
+
value_as_number: result.value_as_number ?? null,
|
|
3932
|
+
min: result.min ?? null,
|
|
3933
|
+
max: result.max ?? null,
|
|
3934
|
+
step: result.step ?? null,
|
|
3935
|
+
reason: result.reason || result.error || null,
|
|
3936
|
+
}));
|
|
3937
|
+
}
|
|
3898
3938
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
3899
3939
|
if ((items || []).length <= limit) return items || [];
|
|
3900
3940
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -3951,6 +3991,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
3951
3991
|
const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
3952
3992
|
const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
|
|
3953
3993
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
3994
|
+
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
3995
|
+
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
3954
3996
|
const clickedItems = results
|
|
3955
3997
|
.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false)
|
|
3956
3998
|
.map((result) => {
|
|
@@ -4009,6 +4051,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
4009
4051
|
window_eval_captured_total: windowEvalCapturedTotal,
|
|
4010
4052
|
window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
|
|
4011
4053
|
window_eval: sampledWindowEvalReceipts,
|
|
4054
|
+
set_range_value_total: rangeValueReceipts.length,
|
|
4055
|
+
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
4056
|
+
set_range_value: sampledRangeValueReceipts,
|
|
4012
4057
|
clicked,
|
|
4013
4058
|
text_samples: textSamples,
|
|
4014
4059
|
failed: failed.map((result) => ({
|
|
@@ -5925,6 +5970,58 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
5925
5970
|
await locator.nth(targetIndex).fill(value, { timeout });
|
|
5926
5971
|
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, value_length: value.length };
|
|
5927
5972
|
}
|
|
5973
|
+
if (type === "set_range_value") {
|
|
5974
|
+
const scope = await setupActionScope(action, timeout);
|
|
5975
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
5976
|
+
const locator = scope.context.locator(action.selector);
|
|
5977
|
+
const count = await locator.count();
|
|
5978
|
+
if (!count) return { ...base, reason: "selector_not_found", count };
|
|
5979
|
+
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
5980
|
+
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex };
|
|
5981
|
+
const target = locator.nth(targetIndex);
|
|
5982
|
+
await target.waitFor({ state: "visible", timeout });
|
|
5983
|
+
const requestedValue = setupActionValue(action);
|
|
5984
|
+
const rangeResult = await target.evaluate((element, value) => {
|
|
5985
|
+
const tag = String(element && element.tagName ? element.tagName : "").toLowerCase();
|
|
5986
|
+
const inputType = tag === "input" ? String(element.type || "").toLowerCase() : "";
|
|
5987
|
+
if (tag !== "input" || inputType !== "range") {
|
|
5988
|
+
return { ok: false, reason: "not_range_input", tag, input_type: inputType };
|
|
5989
|
+
}
|
|
5990
|
+
const beforeValue = String(element.value);
|
|
5991
|
+
const valueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
5992
|
+
if (typeof valueSetter === "function") valueSetter.call(element, String(value));
|
|
5993
|
+
else element.value = String(value);
|
|
5994
|
+
element.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
|
|
5995
|
+
element.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
5996
|
+
const valueAsNumber = Number(element.valueAsNumber);
|
|
5997
|
+
return {
|
|
5998
|
+
ok: true,
|
|
5999
|
+
before_value: beforeValue,
|
|
6000
|
+
actual_value: String(element.value),
|
|
6001
|
+
value_as_number: Number.isFinite(valueAsNumber) ? valueAsNumber : null,
|
|
6002
|
+
min: element.min || null,
|
|
6003
|
+
max: element.max || null,
|
|
6004
|
+
step: element.step || null,
|
|
6005
|
+
};
|
|
6006
|
+
}, requestedValue);
|
|
6007
|
+
return {
|
|
6008
|
+
...base,
|
|
6009
|
+
...setupScopeEvidence(scope),
|
|
6010
|
+
ok: rangeResult && rangeResult.ok === true,
|
|
6011
|
+
count,
|
|
6012
|
+
target_index: targetIndex,
|
|
6013
|
+
requested_value: requestedValue,
|
|
6014
|
+
actual_value: rangeResult?.actual_value,
|
|
6015
|
+
before_value: rangeResult?.before_value,
|
|
6016
|
+
value_as_number: rangeResult?.value_as_number,
|
|
6017
|
+
min: rangeResult?.min,
|
|
6018
|
+
max: rangeResult?.max,
|
|
6019
|
+
step: rangeResult?.step,
|
|
6020
|
+
tag: rangeResult?.tag,
|
|
6021
|
+
input_type: rangeResult?.input_type,
|
|
6022
|
+
reason: rangeResult && rangeResult.ok === true ? undefined : rangeResult?.reason || "range_value_not_set",
|
|
6023
|
+
};
|
|
6024
|
+
}
|
|
5928
6025
|
if (type === "assert_selector_count") {
|
|
5929
6026
|
const scope = await setupActionScope(action, timeout);
|
|
5930
6027
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
package/dist/cli.cjs
CHANGED
|
@@ -6996,6 +6996,7 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
|
|
|
6996
6996
|
"press",
|
|
6997
6997
|
"fill",
|
|
6998
6998
|
"set_input_value",
|
|
6999
|
+
"set_range_value",
|
|
6999
7000
|
"assert_text_visible",
|
|
7000
7001
|
"assert_text_absent",
|
|
7001
7002
|
"assert_selector_count",
|
|
@@ -7445,6 +7446,22 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
7445
7446
|
return receipt;
|
|
7446
7447
|
});
|
|
7447
7448
|
}
|
|
7449
|
+
function profileSetupRangeValueReceipts(results) {
|
|
7450
|
+
return results.filter((result) => profileSetupResultAction(result) === "set_range_value").map((result) => ({
|
|
7451
|
+
ordinal: result.ordinal ?? null,
|
|
7452
|
+
ok: result.ok !== false,
|
|
7453
|
+
selector: result.selector ?? null,
|
|
7454
|
+
frame_selector: result.frame_selector ?? null,
|
|
7455
|
+
requested_value: result.requested_value ?? null,
|
|
7456
|
+
actual_value: result.actual_value ?? null,
|
|
7457
|
+
before_value: result.before_value ?? null,
|
|
7458
|
+
value_as_number: result.value_as_number ?? null,
|
|
7459
|
+
min: result.min ?? null,
|
|
7460
|
+
max: result.max ?? null,
|
|
7461
|
+
step: result.step ?? null,
|
|
7462
|
+
reason: result.reason ?? result.error ?? null
|
|
7463
|
+
}));
|
|
7464
|
+
}
|
|
7448
7465
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
7449
7466
|
if (items.length <= limit) return items;
|
|
7450
7467
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -7487,6 +7504,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
7487
7504
|
const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
7488
7505
|
const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
|
|
7489
7506
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
7507
|
+
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
7508
|
+
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
7490
7509
|
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
7491
7510
|
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0;
|
|
7492
7511
|
return {
|
|
@@ -7535,6 +7554,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
7535
7554
|
window_eval_captured_total: windowEvalCapturedTotal,
|
|
7536
7555
|
window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
|
|
7537
7556
|
window_eval: sampledWindowEvalReceipts,
|
|
7557
|
+
set_range_value_total: rangeValueReceipts.length,
|
|
7558
|
+
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
7559
|
+
set_range_value: sampledRangeValueReceipts,
|
|
7538
7560
|
clicked,
|
|
7539
7561
|
text_samples,
|
|
7540
7562
|
failed: failed.map((result) => ({
|
|
@@ -7587,7 +7609,7 @@ function isSupportedCheckType(value) {
|
|
|
7587
7609
|
}
|
|
7588
7610
|
function normalizeSetupActionType(value, index) {
|
|
7589
7611
|
const normalizedInput = String(value || "").trim().replace(/-/g, "_");
|
|
7590
|
-
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
7612
|
+
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "set_slider_value" || normalizedInput === "slider_value" || normalizedInput === "set_slider" || normalizedInput === "set_range" || normalizedInput === "range_value" || normalizedInput === "range_input" || normalizedInput === "set_range_input" ? "set_range_value" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
7591
7613
|
if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
|
|
7592
7614
|
return normalized;
|
|
7593
7615
|
}
|
|
@@ -7685,7 +7707,7 @@ function normalizeSetupAction(input, index) {
|
|
|
7685
7707
|
if (frameIndex !== void 0 && (!Number.isInteger(frameIndex) || frameIndex < 0)) {
|
|
7686
7708
|
throw new Error(`target.setup_actions[${index}].frame_index must be a non-negative integer.`);
|
|
7687
7709
|
}
|
|
7688
|
-
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
7710
|
+
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
7689
7711
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
7690
7712
|
}
|
|
7691
7713
|
const fromX = numberValue(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
@@ -7717,7 +7739,7 @@ function normalizeSetupAction(input, index) {
|
|
|
7717
7739
|
}
|
|
7718
7740
|
const value = stringFromOwn(input, "value", "input_value", "inputValue");
|
|
7719
7741
|
const hasJsonValue = hasOwn(input, "value_json") || hasOwn(input, "valueJson") || hasOwn(input, "json");
|
|
7720
|
-
if ((type === "fill" || type === "set_input_value") && value === void 0 && !hasJsonValue) {
|
|
7742
|
+
if ((type === "fill" || type === "set_input_value" || type === "set_range_value") && value === void 0 && !hasJsonValue) {
|
|
7721
7743
|
throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
|
|
7722
7744
|
}
|
|
7723
7745
|
const key = stringValue2(input.key);
|
|
@@ -10828,6 +10850,24 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
10828
10850
|
return receipt;
|
|
10829
10851
|
});
|
|
10830
10852
|
}
|
|
10853
|
+
function profileSetupRangeValueReceipts(results) {
|
|
10854
|
+
return (results || [])
|
|
10855
|
+
.filter((result) => result && profileSetupResultAction(result) === "set_range_value")
|
|
10856
|
+
.map((result) => ({
|
|
10857
|
+
ordinal: result.ordinal ?? null,
|
|
10858
|
+
ok: result.ok !== false,
|
|
10859
|
+
selector: result.selector ?? null,
|
|
10860
|
+
frame_selector: result.frame_selector ?? null,
|
|
10861
|
+
requested_value: result.requested_value ?? null,
|
|
10862
|
+
actual_value: result.actual_value ?? null,
|
|
10863
|
+
before_value: result.before_value ?? null,
|
|
10864
|
+
value_as_number: result.value_as_number ?? null,
|
|
10865
|
+
min: result.min ?? null,
|
|
10866
|
+
max: result.max ?? null,
|
|
10867
|
+
step: result.step ?? null,
|
|
10868
|
+
reason: result.reason || result.error || null,
|
|
10869
|
+
}));
|
|
10870
|
+
}
|
|
10831
10871
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
10832
10872
|
if ((items || []).length <= limit) return items || [];
|
|
10833
10873
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -10884,6 +10924,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
10884
10924
|
const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
10885
10925
|
const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
|
|
10886
10926
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
10927
|
+
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
10928
|
+
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
10887
10929
|
const clickedItems = results
|
|
10888
10930
|
.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false)
|
|
10889
10931
|
.map((result) => {
|
|
@@ -10942,6 +10984,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
10942
10984
|
window_eval_captured_total: windowEvalCapturedTotal,
|
|
10943
10985
|
window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
|
|
10944
10986
|
window_eval: sampledWindowEvalReceipts,
|
|
10987
|
+
set_range_value_total: rangeValueReceipts.length,
|
|
10988
|
+
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
10989
|
+
set_range_value: sampledRangeValueReceipts,
|
|
10945
10990
|
clicked,
|
|
10946
10991
|
text_samples: textSamples,
|
|
10947
10992
|
failed: failed.map((result) => ({
|
|
@@ -12858,6 +12903,58 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
12858
12903
|
await locator.nth(targetIndex).fill(value, { timeout });
|
|
12859
12904
|
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, value_length: value.length };
|
|
12860
12905
|
}
|
|
12906
|
+
if (type === "set_range_value") {
|
|
12907
|
+
const scope = await setupActionScope(action, timeout);
|
|
12908
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
12909
|
+
const locator = scope.context.locator(action.selector);
|
|
12910
|
+
const count = await locator.count();
|
|
12911
|
+
if (!count) return { ...base, reason: "selector_not_found", count };
|
|
12912
|
+
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
12913
|
+
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex };
|
|
12914
|
+
const target = locator.nth(targetIndex);
|
|
12915
|
+
await target.waitFor({ state: "visible", timeout });
|
|
12916
|
+
const requestedValue = setupActionValue(action);
|
|
12917
|
+
const rangeResult = await target.evaluate((element, value) => {
|
|
12918
|
+
const tag = String(element && element.tagName ? element.tagName : "").toLowerCase();
|
|
12919
|
+
const inputType = tag === "input" ? String(element.type || "").toLowerCase() : "";
|
|
12920
|
+
if (tag !== "input" || inputType !== "range") {
|
|
12921
|
+
return { ok: false, reason: "not_range_input", tag, input_type: inputType };
|
|
12922
|
+
}
|
|
12923
|
+
const beforeValue = String(element.value);
|
|
12924
|
+
const valueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
12925
|
+
if (typeof valueSetter === "function") valueSetter.call(element, String(value));
|
|
12926
|
+
else element.value = String(value);
|
|
12927
|
+
element.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
|
|
12928
|
+
element.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
12929
|
+
const valueAsNumber = Number(element.valueAsNumber);
|
|
12930
|
+
return {
|
|
12931
|
+
ok: true,
|
|
12932
|
+
before_value: beforeValue,
|
|
12933
|
+
actual_value: String(element.value),
|
|
12934
|
+
value_as_number: Number.isFinite(valueAsNumber) ? valueAsNumber : null,
|
|
12935
|
+
min: element.min || null,
|
|
12936
|
+
max: element.max || null,
|
|
12937
|
+
step: element.step || null,
|
|
12938
|
+
};
|
|
12939
|
+
}, requestedValue);
|
|
12940
|
+
return {
|
|
12941
|
+
...base,
|
|
12942
|
+
...setupScopeEvidence(scope),
|
|
12943
|
+
ok: rangeResult && rangeResult.ok === true,
|
|
12944
|
+
count,
|
|
12945
|
+
target_index: targetIndex,
|
|
12946
|
+
requested_value: requestedValue,
|
|
12947
|
+
actual_value: rangeResult?.actual_value,
|
|
12948
|
+
before_value: rangeResult?.before_value,
|
|
12949
|
+
value_as_number: rangeResult?.value_as_number,
|
|
12950
|
+
min: rangeResult?.min,
|
|
12951
|
+
max: rangeResult?.max,
|
|
12952
|
+
step: rangeResult?.step,
|
|
12953
|
+
tag: rangeResult?.tag,
|
|
12954
|
+
input_type: rangeResult?.input_type,
|
|
12955
|
+
reason: rangeResult && rangeResult.ok === true ? undefined : rangeResult?.reason || "range_value_not_set",
|
|
12956
|
+
};
|
|
12957
|
+
}
|
|
12861
12958
|
if (type === "assert_selector_count") {
|
|
12862
12959
|
const scope = await setupActionScope(action, timeout);
|
|
12863
12960
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
@@ -15040,6 +15137,7 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
15040
15137
|
const windowEvalCapturedTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_eval_captured_total) || 0), 0);
|
|
15041
15138
|
const windowCallUntilTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_total) || 0), 0);
|
|
15042
15139
|
const windowCallUntilCallTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_call_total) || 0), 0);
|
|
15140
|
+
const rangeValueTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.set_range_value_total) || 0), 0);
|
|
15043
15141
|
const failedTotal = viewports.reduce((sum, viewport) => sum + (Array.isArray(viewport.failed) ? viewport.failed.length : 0), 0);
|
|
15044
15142
|
const lines = [
|
|
15045
15143
|
`- setup actions: ${declaredActions === void 0 ? "unknown" : declaredActions} declared, ${totalResults} recorded result(s) across ${viewports.length} viewport(s)`,
|
|
@@ -15059,6 +15157,9 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
15059
15157
|
if (windowCallUntilTotal) {
|
|
15060
15158
|
lines.push(`- window_call_until: ${windowCallUntilTotal} action(s), call_count total ${windowCallUntilCallTotal}`);
|
|
15061
15159
|
}
|
|
15160
|
+
if (rangeValueTotal) {
|
|
15161
|
+
lines.push(`- set_range_value: ${rangeValueTotal} action(s)`);
|
|
15162
|
+
}
|
|
15062
15163
|
for (const viewport of viewports.slice(0, 8)) {
|
|
15063
15164
|
const name = cliString(viewport.name) || "viewport";
|
|
15064
15165
|
const ok = viewport.ok === false ? "failed" : "ok";
|
|
@@ -15074,9 +15175,29 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
15074
15175
|
const windowEvalCaptured = cliFiniteNumber(viewport.window_eval_captured_total) || 0;
|
|
15075
15176
|
const windowCallUntilActions = cliFiniteNumber(viewport.window_call_until_total) || 0;
|
|
15076
15177
|
const windowCallUntilCalls = cliFiniteNumber(viewport.window_call_until_call_total) || 0;
|
|
15178
|
+
const rangeValueActions = cliFiniteNumber(viewport.set_range_value_total) || 0;
|
|
15077
15179
|
const observedPath = cliString(viewport.observed_path);
|
|
15078
|
-
lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickCountActions ? `, ${clickCountActions} click_count 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}` : ""}`);
|
|
15180
|
+
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)` : ""}${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}` : ""}`);
|
|
15181
|
+
}
|
|
15182
|
+
const rangeValueDetails = viewports.flatMap((viewport) => {
|
|
15183
|
+
const name = cliString(viewport.name) || "viewport";
|
|
15184
|
+
const receipts = Array.isArray(viewport.set_range_value) ? viewport.set_range_value.map(cliRecord).filter((item) => Boolean(item)) : [];
|
|
15185
|
+
return receipts.map((receipt) => ({ name, receipt }));
|
|
15186
|
+
});
|
|
15187
|
+
for (const { name, receipt } of rangeValueDetails.slice(0, 12)) {
|
|
15188
|
+
const selector = cliString(receipt.selector) || "input[type=range]";
|
|
15189
|
+
const requested = cliValueLabel(receipt.requested_value);
|
|
15190
|
+
const actual = cliValueLabel(receipt.actual_value);
|
|
15191
|
+
const before = cliValueLabel(receipt.before_value);
|
|
15192
|
+
const valueAsNumber = cliFiniteNumber(receipt.value_as_number);
|
|
15193
|
+
const min = cliValueLabel(receipt.min);
|
|
15194
|
+
const max = cliValueLabel(receipt.max);
|
|
15195
|
+
const step = cliValueLabel(receipt.step);
|
|
15196
|
+
const ok = receipt.ok === false ? "failed" : "ok";
|
|
15197
|
+
const reason = cliString(receipt.reason);
|
|
15198
|
+
lines.push(`- ${name} set_range_value: ${ok}, ${markdownInlineCode(selector)}${requested === void 0 ? "" : ` requested ${markdownInlineCode(requested, 80)}`}${actual === void 0 ? "" : ` -> ${markdownInlineCode(actual, 80)}`}${before === void 0 ? "" : `, before ${markdownInlineCode(before, 80)}`}${valueAsNumber === void 0 ? "" : `, number ${valueAsNumber}`}${min === void 0 && max === void 0 ? "" : `, range ${min === void 0 ? "?" : markdownInlineCode(min, 40)}..${max === void 0 ? "?" : markdownInlineCode(max, 40)}`}${step === void 0 ? "" : ` step ${markdownInlineCode(step, 40)}`}${reason ? `, reason ${markdownInlineCode(reason, 100)}` : ""}`);
|
|
15079
15199
|
}
|
|
15200
|
+
if (rangeValueDetails.length > 12) lines.push(`- ${rangeValueDetails.length - 12} additional set_range_value receipt(s) omitted.`);
|
|
15080
15201
|
const windowCallDetails = viewports.flatMap((viewport) => {
|
|
15081
15202
|
const name = cliString(viewport.name) || "viewport";
|
|
15082
15203
|
const receipts = Array.isArray(viewport.window_call) ? viewport.window_call.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-QXQCG3WB.js";
|
|
17
17
|
import {
|
|
18
18
|
createRiddleApiClient,
|
|
19
19
|
parseRiddleViewport
|
|
@@ -695,6 +695,7 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
695
695
|
const windowEvalCapturedTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_eval_captured_total) || 0), 0);
|
|
696
696
|
const windowCallUntilTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_total) || 0), 0);
|
|
697
697
|
const windowCallUntilCallTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_call_total) || 0), 0);
|
|
698
|
+
const rangeValueTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.set_range_value_total) || 0), 0);
|
|
698
699
|
const failedTotal = viewports.reduce((sum, viewport) => sum + (Array.isArray(viewport.failed) ? viewport.failed.length : 0), 0);
|
|
699
700
|
const lines = [
|
|
700
701
|
`- setup actions: ${declaredActions === void 0 ? "unknown" : declaredActions} declared, ${totalResults} recorded result(s) across ${viewports.length} viewport(s)`,
|
|
@@ -714,6 +715,9 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
714
715
|
if (windowCallUntilTotal) {
|
|
715
716
|
lines.push(`- window_call_until: ${windowCallUntilTotal} action(s), call_count total ${windowCallUntilCallTotal}`);
|
|
716
717
|
}
|
|
718
|
+
if (rangeValueTotal) {
|
|
719
|
+
lines.push(`- set_range_value: ${rangeValueTotal} action(s)`);
|
|
720
|
+
}
|
|
717
721
|
for (const viewport of viewports.slice(0, 8)) {
|
|
718
722
|
const name = cliString(viewport.name) || "viewport";
|
|
719
723
|
const ok = viewport.ok === false ? "failed" : "ok";
|
|
@@ -729,9 +733,29 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
729
733
|
const windowEvalCaptured = cliFiniteNumber(viewport.window_eval_captured_total) || 0;
|
|
730
734
|
const windowCallUntilActions = cliFiniteNumber(viewport.window_call_until_total) || 0;
|
|
731
735
|
const windowCallUntilCalls = cliFiniteNumber(viewport.window_call_until_call_total) || 0;
|
|
736
|
+
const rangeValueActions = cliFiniteNumber(viewport.set_range_value_total) || 0;
|
|
732
737
|
const observedPath = cliString(viewport.observed_path);
|
|
733
|
-
lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickCountActions ? `, ${clickCountActions} click_count 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}` : ""}`);
|
|
738
|
+
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)` : ""}${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}` : ""}`);
|
|
739
|
+
}
|
|
740
|
+
const rangeValueDetails = viewports.flatMap((viewport) => {
|
|
741
|
+
const name = cliString(viewport.name) || "viewport";
|
|
742
|
+
const receipts = Array.isArray(viewport.set_range_value) ? viewport.set_range_value.map(cliRecord).filter((item) => Boolean(item)) : [];
|
|
743
|
+
return receipts.map((receipt) => ({ name, receipt }));
|
|
744
|
+
});
|
|
745
|
+
for (const { name, receipt } of rangeValueDetails.slice(0, 12)) {
|
|
746
|
+
const selector = cliString(receipt.selector) || "input[type=range]";
|
|
747
|
+
const requested = cliValueLabel(receipt.requested_value);
|
|
748
|
+
const actual = cliValueLabel(receipt.actual_value);
|
|
749
|
+
const before = cliValueLabel(receipt.before_value);
|
|
750
|
+
const valueAsNumber = cliFiniteNumber(receipt.value_as_number);
|
|
751
|
+
const min = cliValueLabel(receipt.min);
|
|
752
|
+
const max = cliValueLabel(receipt.max);
|
|
753
|
+
const step = cliValueLabel(receipt.step);
|
|
754
|
+
const ok = receipt.ok === false ? "failed" : "ok";
|
|
755
|
+
const reason = cliString(receipt.reason);
|
|
756
|
+
lines.push(`- ${name} set_range_value: ${ok}, ${markdownInlineCode(selector)}${requested === void 0 ? "" : ` requested ${markdownInlineCode(requested, 80)}`}${actual === void 0 ? "" : ` -> ${markdownInlineCode(actual, 80)}`}${before === void 0 ? "" : `, before ${markdownInlineCode(before, 80)}`}${valueAsNumber === void 0 ? "" : `, number ${valueAsNumber}`}${min === void 0 && max === void 0 ? "" : `, range ${min === void 0 ? "?" : markdownInlineCode(min, 40)}..${max === void 0 ? "?" : markdownInlineCode(max, 40)}`}${step === void 0 ? "" : ` step ${markdownInlineCode(step, 40)}`}${reason ? `, reason ${markdownInlineCode(reason, 100)}` : ""}`);
|
|
734
757
|
}
|
|
758
|
+
if (rangeValueDetails.length > 12) lines.push(`- ${rangeValueDetails.length - 12} additional set_range_value receipt(s) omitted.`);
|
|
735
759
|
const windowCallDetails = viewports.flatMap((viewport) => {
|
|
736
760
|
const name = cliString(viewport.name) || "viewport";
|
|
737
761
|
const receipts = Array.isArray(viewport.window_call) ? viewport.window_call.map(cliRecord).filter((item) => Boolean(item)) : [];
|
package/dist/index.cjs
CHANGED
|
@@ -8780,6 +8780,7 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
|
|
|
8780
8780
|
"press",
|
|
8781
8781
|
"fill",
|
|
8782
8782
|
"set_input_value",
|
|
8783
|
+
"set_range_value",
|
|
8783
8784
|
"assert_text_visible",
|
|
8784
8785
|
"assert_text_absent",
|
|
8785
8786
|
"assert_selector_count",
|
|
@@ -9229,6 +9230,22 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
9229
9230
|
return receipt;
|
|
9230
9231
|
});
|
|
9231
9232
|
}
|
|
9233
|
+
function profileSetupRangeValueReceipts(results) {
|
|
9234
|
+
return results.filter((result) => profileSetupResultAction(result) === "set_range_value").map((result) => ({
|
|
9235
|
+
ordinal: result.ordinal ?? null,
|
|
9236
|
+
ok: result.ok !== false,
|
|
9237
|
+
selector: result.selector ?? null,
|
|
9238
|
+
frame_selector: result.frame_selector ?? null,
|
|
9239
|
+
requested_value: result.requested_value ?? null,
|
|
9240
|
+
actual_value: result.actual_value ?? null,
|
|
9241
|
+
before_value: result.before_value ?? null,
|
|
9242
|
+
value_as_number: result.value_as_number ?? null,
|
|
9243
|
+
min: result.min ?? null,
|
|
9244
|
+
max: result.max ?? null,
|
|
9245
|
+
step: result.step ?? null,
|
|
9246
|
+
reason: result.reason ?? result.error ?? null
|
|
9247
|
+
}));
|
|
9248
|
+
}
|
|
9232
9249
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
9233
9250
|
if (items.length <= limit) return items;
|
|
9234
9251
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -9271,6 +9288,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
9271
9288
|
const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
9272
9289
|
const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
|
|
9273
9290
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
9291
|
+
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
9292
|
+
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
9274
9293
|
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
9275
9294
|
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0;
|
|
9276
9295
|
return {
|
|
@@ -9319,6 +9338,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
9319
9338
|
window_eval_captured_total: windowEvalCapturedTotal,
|
|
9320
9339
|
window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
|
|
9321
9340
|
window_eval: sampledWindowEvalReceipts,
|
|
9341
|
+
set_range_value_total: rangeValueReceipts.length,
|
|
9342
|
+
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
9343
|
+
set_range_value: sampledRangeValueReceipts,
|
|
9322
9344
|
clicked,
|
|
9323
9345
|
text_samples,
|
|
9324
9346
|
failed: failed.map((result) => ({
|
|
@@ -9371,7 +9393,7 @@ function isSupportedCheckType(value) {
|
|
|
9371
9393
|
}
|
|
9372
9394
|
function normalizeSetupActionType(value, index) {
|
|
9373
9395
|
const normalizedInput = String(value || "").trim().replace(/-/g, "_");
|
|
9374
|
-
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
9396
|
+
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "set_slider_value" || normalizedInput === "slider_value" || normalizedInput === "set_slider" || normalizedInput === "set_range" || normalizedInput === "range_value" || normalizedInput === "range_input" || normalizedInput === "set_range_input" ? "set_range_value" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
9375
9397
|
if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
|
|
9376
9398
|
return normalized;
|
|
9377
9399
|
}
|
|
@@ -9469,7 +9491,7 @@ function normalizeSetupAction(input, index) {
|
|
|
9469
9491
|
if (frameIndex !== void 0 && (!Number.isInteger(frameIndex) || frameIndex < 0)) {
|
|
9470
9492
|
throw new Error(`target.setup_actions[${index}].frame_index must be a non-negative integer.`);
|
|
9471
9493
|
}
|
|
9472
|
-
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
9494
|
+
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
9473
9495
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
9474
9496
|
}
|
|
9475
9497
|
const fromX = numberValue3(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
@@ -9501,7 +9523,7 @@ function normalizeSetupAction(input, index) {
|
|
|
9501
9523
|
}
|
|
9502
9524
|
const value = stringFromOwn(input, "value", "input_value", "inputValue");
|
|
9503
9525
|
const hasJsonValue = hasOwn(input, "value_json") || hasOwn(input, "valueJson") || hasOwn(input, "json");
|
|
9504
|
-
if ((type === "fill" || type === "set_input_value") && value === void 0 && !hasJsonValue) {
|
|
9526
|
+
if ((type === "fill" || type === "set_input_value" || type === "set_range_value") && value === void 0 && !hasJsonValue) {
|
|
9505
9527
|
throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
|
|
9506
9528
|
}
|
|
9507
9529
|
const key = stringValue5(input.key);
|
|
@@ -12628,6 +12650,24 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
12628
12650
|
return receipt;
|
|
12629
12651
|
});
|
|
12630
12652
|
}
|
|
12653
|
+
function profileSetupRangeValueReceipts(results) {
|
|
12654
|
+
return (results || [])
|
|
12655
|
+
.filter((result) => result && profileSetupResultAction(result) === "set_range_value")
|
|
12656
|
+
.map((result) => ({
|
|
12657
|
+
ordinal: result.ordinal ?? null,
|
|
12658
|
+
ok: result.ok !== false,
|
|
12659
|
+
selector: result.selector ?? null,
|
|
12660
|
+
frame_selector: result.frame_selector ?? null,
|
|
12661
|
+
requested_value: result.requested_value ?? null,
|
|
12662
|
+
actual_value: result.actual_value ?? null,
|
|
12663
|
+
before_value: result.before_value ?? null,
|
|
12664
|
+
value_as_number: result.value_as_number ?? null,
|
|
12665
|
+
min: result.min ?? null,
|
|
12666
|
+
max: result.max ?? null,
|
|
12667
|
+
step: result.step ?? null,
|
|
12668
|
+
reason: result.reason || result.error || null,
|
|
12669
|
+
}));
|
|
12670
|
+
}
|
|
12631
12671
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
12632
12672
|
if ((items || []).length <= limit) return items || [];
|
|
12633
12673
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -12684,6 +12724,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
12684
12724
|
const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
12685
12725
|
const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
|
|
12686
12726
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
12727
|
+
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
12728
|
+
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
12687
12729
|
const clickedItems = results
|
|
12688
12730
|
.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false)
|
|
12689
12731
|
.map((result) => {
|
|
@@ -12742,6 +12784,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
12742
12784
|
window_eval_captured_total: windowEvalCapturedTotal,
|
|
12743
12785
|
window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
|
|
12744
12786
|
window_eval: sampledWindowEvalReceipts,
|
|
12787
|
+
set_range_value_total: rangeValueReceipts.length,
|
|
12788
|
+
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
12789
|
+
set_range_value: sampledRangeValueReceipts,
|
|
12745
12790
|
clicked,
|
|
12746
12791
|
text_samples: textSamples,
|
|
12747
12792
|
failed: failed.map((result) => ({
|
|
@@ -14658,6 +14703,58 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
14658
14703
|
await locator.nth(targetIndex).fill(value, { timeout });
|
|
14659
14704
|
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, value_length: value.length };
|
|
14660
14705
|
}
|
|
14706
|
+
if (type === "set_range_value") {
|
|
14707
|
+
const scope = await setupActionScope(action, timeout);
|
|
14708
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
14709
|
+
const locator = scope.context.locator(action.selector);
|
|
14710
|
+
const count = await locator.count();
|
|
14711
|
+
if (!count) return { ...base, reason: "selector_not_found", count };
|
|
14712
|
+
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
14713
|
+
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex };
|
|
14714
|
+
const target = locator.nth(targetIndex);
|
|
14715
|
+
await target.waitFor({ state: "visible", timeout });
|
|
14716
|
+
const requestedValue = setupActionValue(action);
|
|
14717
|
+
const rangeResult = await target.evaluate((element, value) => {
|
|
14718
|
+
const tag = String(element && element.tagName ? element.tagName : "").toLowerCase();
|
|
14719
|
+
const inputType = tag === "input" ? String(element.type || "").toLowerCase() : "";
|
|
14720
|
+
if (tag !== "input" || inputType !== "range") {
|
|
14721
|
+
return { ok: false, reason: "not_range_input", tag, input_type: inputType };
|
|
14722
|
+
}
|
|
14723
|
+
const beforeValue = String(element.value);
|
|
14724
|
+
const valueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
14725
|
+
if (typeof valueSetter === "function") valueSetter.call(element, String(value));
|
|
14726
|
+
else element.value = String(value);
|
|
14727
|
+
element.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
|
|
14728
|
+
element.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
14729
|
+
const valueAsNumber = Number(element.valueAsNumber);
|
|
14730
|
+
return {
|
|
14731
|
+
ok: true,
|
|
14732
|
+
before_value: beforeValue,
|
|
14733
|
+
actual_value: String(element.value),
|
|
14734
|
+
value_as_number: Number.isFinite(valueAsNumber) ? valueAsNumber : null,
|
|
14735
|
+
min: element.min || null,
|
|
14736
|
+
max: element.max || null,
|
|
14737
|
+
step: element.step || null,
|
|
14738
|
+
};
|
|
14739
|
+
}, requestedValue);
|
|
14740
|
+
return {
|
|
14741
|
+
...base,
|
|
14742
|
+
...setupScopeEvidence(scope),
|
|
14743
|
+
ok: rangeResult && rangeResult.ok === true,
|
|
14744
|
+
count,
|
|
14745
|
+
target_index: targetIndex,
|
|
14746
|
+
requested_value: requestedValue,
|
|
14747
|
+
actual_value: rangeResult?.actual_value,
|
|
14748
|
+
before_value: rangeResult?.before_value,
|
|
14749
|
+
value_as_number: rangeResult?.value_as_number,
|
|
14750
|
+
min: rangeResult?.min,
|
|
14751
|
+
max: rangeResult?.max,
|
|
14752
|
+
step: rangeResult?.step,
|
|
14753
|
+
tag: rangeResult?.tag,
|
|
14754
|
+
input_type: rangeResult?.input_type,
|
|
14755
|
+
reason: rangeResult && rangeResult.ok === true ? undefined : rangeResult?.reason || "range_value_not_set",
|
|
14756
|
+
};
|
|
14757
|
+
}
|
|
14661
14758
|
if (type === "assert_selector_count") {
|
|
14662
14759
|
const scope = await setupActionScope(action, timeout);
|
|
14663
14760
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
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-QXQCG3WB.js";
|
|
66
66
|
import {
|
|
67
67
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
68
68
|
DEFAULT_RIDDLE_API_KEY_FILE,
|
package/dist/profile.cjs
CHANGED
|
@@ -94,6 +94,7 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
|
|
|
94
94
|
"press",
|
|
95
95
|
"fill",
|
|
96
96
|
"set_input_value",
|
|
97
|
+
"set_range_value",
|
|
97
98
|
"assert_text_visible",
|
|
98
99
|
"assert_text_absent",
|
|
99
100
|
"assert_selector_count",
|
|
@@ -543,6 +544,22 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
543
544
|
return receipt;
|
|
544
545
|
});
|
|
545
546
|
}
|
|
547
|
+
function profileSetupRangeValueReceipts(results) {
|
|
548
|
+
return results.filter((result) => profileSetupResultAction(result) === "set_range_value").map((result) => ({
|
|
549
|
+
ordinal: result.ordinal ?? null,
|
|
550
|
+
ok: result.ok !== false,
|
|
551
|
+
selector: result.selector ?? null,
|
|
552
|
+
frame_selector: result.frame_selector ?? null,
|
|
553
|
+
requested_value: result.requested_value ?? null,
|
|
554
|
+
actual_value: result.actual_value ?? null,
|
|
555
|
+
before_value: result.before_value ?? null,
|
|
556
|
+
value_as_number: result.value_as_number ?? null,
|
|
557
|
+
min: result.min ?? null,
|
|
558
|
+
max: result.max ?? null,
|
|
559
|
+
step: result.step ?? null,
|
|
560
|
+
reason: result.reason ?? result.error ?? null
|
|
561
|
+
}));
|
|
562
|
+
}
|
|
546
563
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
547
564
|
if (items.length <= limit) return items;
|
|
548
565
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -585,6 +602,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
585
602
|
const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
586
603
|
const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
|
|
587
604
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
605
|
+
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
606
|
+
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
588
607
|
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
589
608
|
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0;
|
|
590
609
|
return {
|
|
@@ -633,6 +652,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
633
652
|
window_eval_captured_total: windowEvalCapturedTotal,
|
|
634
653
|
window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
|
|
635
654
|
window_eval: sampledWindowEvalReceipts,
|
|
655
|
+
set_range_value_total: rangeValueReceipts.length,
|
|
656
|
+
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
657
|
+
set_range_value: sampledRangeValueReceipts,
|
|
636
658
|
clicked,
|
|
637
659
|
text_samples,
|
|
638
660
|
failed: failed.map((result) => ({
|
|
@@ -685,7 +707,7 @@ function isSupportedCheckType(value) {
|
|
|
685
707
|
}
|
|
686
708
|
function normalizeSetupActionType(value, index) {
|
|
687
709
|
const normalizedInput = String(value || "").trim().replace(/-/g, "_");
|
|
688
|
-
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
710
|
+
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "set_slider_value" || normalizedInput === "slider_value" || normalizedInput === "set_slider" || normalizedInput === "set_range" || normalizedInput === "range_value" || normalizedInput === "range_input" || normalizedInput === "set_range_input" ? "set_range_value" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
689
711
|
if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
|
|
690
712
|
return normalized;
|
|
691
713
|
}
|
|
@@ -783,7 +805,7 @@ function normalizeSetupAction(input, index) {
|
|
|
783
805
|
if (frameIndex !== void 0 && (!Number.isInteger(frameIndex) || frameIndex < 0)) {
|
|
784
806
|
throw new Error(`target.setup_actions[${index}].frame_index must be a non-negative integer.`);
|
|
785
807
|
}
|
|
786
|
-
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
808
|
+
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
787
809
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
788
810
|
}
|
|
789
811
|
const fromX = numberValue(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
@@ -815,7 +837,7 @@ function normalizeSetupAction(input, index) {
|
|
|
815
837
|
}
|
|
816
838
|
const value = stringFromOwn(input, "value", "input_value", "inputValue");
|
|
817
839
|
const hasJsonValue = hasOwn(input, "value_json") || hasOwn(input, "valueJson") || hasOwn(input, "json");
|
|
818
|
-
if ((type === "fill" || type === "set_input_value") && value === void 0 && !hasJsonValue) {
|
|
840
|
+
if ((type === "fill" || type === "set_input_value" || type === "set_range_value") && value === void 0 && !hasJsonValue) {
|
|
819
841
|
throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
|
|
820
842
|
}
|
|
821
843
|
const key = stringValue(input.key);
|
|
@@ -3942,6 +3964,24 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
3942
3964
|
return receipt;
|
|
3943
3965
|
});
|
|
3944
3966
|
}
|
|
3967
|
+
function profileSetupRangeValueReceipts(results) {
|
|
3968
|
+
return (results || [])
|
|
3969
|
+
.filter((result) => result && profileSetupResultAction(result) === "set_range_value")
|
|
3970
|
+
.map((result) => ({
|
|
3971
|
+
ordinal: result.ordinal ?? null,
|
|
3972
|
+
ok: result.ok !== false,
|
|
3973
|
+
selector: result.selector ?? null,
|
|
3974
|
+
frame_selector: result.frame_selector ?? null,
|
|
3975
|
+
requested_value: result.requested_value ?? null,
|
|
3976
|
+
actual_value: result.actual_value ?? null,
|
|
3977
|
+
before_value: result.before_value ?? null,
|
|
3978
|
+
value_as_number: result.value_as_number ?? null,
|
|
3979
|
+
min: result.min ?? null,
|
|
3980
|
+
max: result.max ?? null,
|
|
3981
|
+
step: result.step ?? null,
|
|
3982
|
+
reason: result.reason || result.error || null,
|
|
3983
|
+
}));
|
|
3984
|
+
}
|
|
3945
3985
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
3946
3986
|
if ((items || []).length <= limit) return items || [];
|
|
3947
3987
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -3998,6 +4038,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
3998
4038
|
const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
3999
4039
|
const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
|
|
4000
4040
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
4041
|
+
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
4042
|
+
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
4001
4043
|
const clickedItems = results
|
|
4002
4044
|
.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false)
|
|
4003
4045
|
.map((result) => {
|
|
@@ -4056,6 +4098,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
4056
4098
|
window_eval_captured_total: windowEvalCapturedTotal,
|
|
4057
4099
|
window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
|
|
4058
4100
|
window_eval: sampledWindowEvalReceipts,
|
|
4101
|
+
set_range_value_total: rangeValueReceipts.length,
|
|
4102
|
+
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
4103
|
+
set_range_value: sampledRangeValueReceipts,
|
|
4059
4104
|
clicked,
|
|
4060
4105
|
text_samples: textSamples,
|
|
4061
4106
|
failed: failed.map((result) => ({
|
|
@@ -5972,6 +6017,58 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
5972
6017
|
await locator.nth(targetIndex).fill(value, { timeout });
|
|
5973
6018
|
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, value_length: value.length };
|
|
5974
6019
|
}
|
|
6020
|
+
if (type === "set_range_value") {
|
|
6021
|
+
const scope = await setupActionScope(action, timeout);
|
|
6022
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
6023
|
+
const locator = scope.context.locator(action.selector);
|
|
6024
|
+
const count = await locator.count();
|
|
6025
|
+
if (!count) return { ...base, reason: "selector_not_found", count };
|
|
6026
|
+
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
6027
|
+
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex };
|
|
6028
|
+
const target = locator.nth(targetIndex);
|
|
6029
|
+
await target.waitFor({ state: "visible", timeout });
|
|
6030
|
+
const requestedValue = setupActionValue(action);
|
|
6031
|
+
const rangeResult = await target.evaluate((element, value) => {
|
|
6032
|
+
const tag = String(element && element.tagName ? element.tagName : "").toLowerCase();
|
|
6033
|
+
const inputType = tag === "input" ? String(element.type || "").toLowerCase() : "";
|
|
6034
|
+
if (tag !== "input" || inputType !== "range") {
|
|
6035
|
+
return { ok: false, reason: "not_range_input", tag, input_type: inputType };
|
|
6036
|
+
}
|
|
6037
|
+
const beforeValue = String(element.value);
|
|
6038
|
+
const valueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
6039
|
+
if (typeof valueSetter === "function") valueSetter.call(element, String(value));
|
|
6040
|
+
else element.value = String(value);
|
|
6041
|
+
element.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
|
|
6042
|
+
element.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
6043
|
+
const valueAsNumber = Number(element.valueAsNumber);
|
|
6044
|
+
return {
|
|
6045
|
+
ok: true,
|
|
6046
|
+
before_value: beforeValue,
|
|
6047
|
+
actual_value: String(element.value),
|
|
6048
|
+
value_as_number: Number.isFinite(valueAsNumber) ? valueAsNumber : null,
|
|
6049
|
+
min: element.min || null,
|
|
6050
|
+
max: element.max || null,
|
|
6051
|
+
step: element.step || null,
|
|
6052
|
+
};
|
|
6053
|
+
}, requestedValue);
|
|
6054
|
+
return {
|
|
6055
|
+
...base,
|
|
6056
|
+
...setupScopeEvidence(scope),
|
|
6057
|
+
ok: rangeResult && rangeResult.ok === true,
|
|
6058
|
+
count,
|
|
6059
|
+
target_index: targetIndex,
|
|
6060
|
+
requested_value: requestedValue,
|
|
6061
|
+
actual_value: rangeResult?.actual_value,
|
|
6062
|
+
before_value: rangeResult?.before_value,
|
|
6063
|
+
value_as_number: rangeResult?.value_as_number,
|
|
6064
|
+
min: rangeResult?.min,
|
|
6065
|
+
max: rangeResult?.max,
|
|
6066
|
+
step: rangeResult?.step,
|
|
6067
|
+
tag: rangeResult?.tag,
|
|
6068
|
+
input_type: rangeResult?.input_type,
|
|
6069
|
+
reason: rangeResult && rangeResult.ok === true ? undefined : rangeResult?.reason || "range_value_not_set",
|
|
6070
|
+
};
|
|
6071
|
+
}
|
|
5975
6072
|
if (type === "assert_selector_count") {
|
|
5976
6073
|
const scope = await setupActionScope(action, timeout);
|
|
5977
6074
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
package/dist/profile.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ declare const RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION: "riddle-proof.profile-evide
|
|
|
5
5
|
declare const RIDDLE_PROOF_PROFILE_RESULT_VERSION: "riddle-proof.profile-result.v1";
|
|
6
6
|
declare const RIDDLE_PROOF_PROFILE_STATUSES: readonly ["passed", "product_regression", "proof_insufficient", "environment_blocked", "configuration_error", "needs_human_review"];
|
|
7
7
|
declare const RIDDLE_PROOF_PROFILE_CHECK_TYPES: readonly ["route_loaded", "url_search_param_equals", "url_search_param_absent", "selector_visible", "selector_absent", "selector_count_at_least", "selector_count_equals", "selector_count_equal", "selector_count_eq", "dialog_count_equals", "dialog_accept_count_equals", "dialog_dismiss_count_equals", "selector_text_visible", "selector_text_absent", "selector_text_order", "frame_text_visible", "frame_url_equals", "frame_url_matches", "frame_no_horizontal_overflow", "text_visible", "text_absent", "http_status", "link_status", "artifact_link_status", "route_inventory", "no_horizontal_overflow", "no_mobile_horizontal_overflow", "no_fatal_console_errors", "no_console_warnings"];
|
|
8
|
-
declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "drag", "press", "fill", "set_input_value", "assert_text_visible", "assert_text_absent", "assert_selector_count", "assert_window_value", "assert_window_number", "local_storage", "session_storage", "clear_storage", "clear_console", "dialog_response", "screenshot", "wait", "wait_for_selector", "wait_for_text", "window_eval", "window_call", "window_call_until"];
|
|
8
|
+
declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "drag", "press", "fill", "set_input_value", "set_range_value", "assert_text_visible", "assert_text_absent", "assert_selector_count", "assert_window_value", "assert_window_number", "local_storage", "session_storage", "clear_storage", "clear_console", "dialog_response", "screenshot", "wait", "wait_for_selector", "wait_for_text", "window_eval", "window_call", "window_call_until"];
|
|
9
9
|
type RiddleProofProfileStatus = typeof RIDDLE_PROOF_PROFILE_STATUSES[number];
|
|
10
10
|
type RiddleProofProfileCheckType = typeof RIDDLE_PROOF_PROFILE_CHECK_TYPES[number];
|
|
11
11
|
type RiddleProofProfileSetupActionType = typeof RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES[number];
|
package/dist/profile.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare const RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION: "riddle-proof.profile-evide
|
|
|
5
5
|
declare const RIDDLE_PROOF_PROFILE_RESULT_VERSION: "riddle-proof.profile-result.v1";
|
|
6
6
|
declare const RIDDLE_PROOF_PROFILE_STATUSES: readonly ["passed", "product_regression", "proof_insufficient", "environment_blocked", "configuration_error", "needs_human_review"];
|
|
7
7
|
declare const RIDDLE_PROOF_PROFILE_CHECK_TYPES: readonly ["route_loaded", "url_search_param_equals", "url_search_param_absent", "selector_visible", "selector_absent", "selector_count_at_least", "selector_count_equals", "selector_count_equal", "selector_count_eq", "dialog_count_equals", "dialog_accept_count_equals", "dialog_dismiss_count_equals", "selector_text_visible", "selector_text_absent", "selector_text_order", "frame_text_visible", "frame_url_equals", "frame_url_matches", "frame_no_horizontal_overflow", "text_visible", "text_absent", "http_status", "link_status", "artifact_link_status", "route_inventory", "no_horizontal_overflow", "no_mobile_horizontal_overflow", "no_fatal_console_errors", "no_console_warnings"];
|
|
8
|
-
declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "drag", "press", "fill", "set_input_value", "assert_text_visible", "assert_text_absent", "assert_selector_count", "assert_window_value", "assert_window_number", "local_storage", "session_storage", "clear_storage", "clear_console", "dialog_response", "screenshot", "wait", "wait_for_selector", "wait_for_text", "window_eval", "window_call", "window_call_until"];
|
|
8
|
+
declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "drag", "press", "fill", "set_input_value", "set_range_value", "assert_text_visible", "assert_text_absent", "assert_selector_count", "assert_window_value", "assert_window_number", "local_storage", "session_storage", "clear_storage", "clear_console", "dialog_response", "screenshot", "wait", "wait_for_selector", "wait_for_text", "window_eval", "window_call", "window_call_until"];
|
|
9
9
|
type RiddleProofProfileStatus = typeof RIDDLE_PROOF_PROFILE_STATUSES[number];
|
|
10
10
|
type RiddleProofProfileCheckType = typeof RIDDLE_PROOF_PROFILE_CHECK_TYPES[number];
|
|
11
11
|
type RiddleProofProfileSetupActionType = typeof RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES[number];
|
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-QXQCG3WB.js";
|
|
27
27
|
export {
|
|
28
28
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
29
29
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|