@riddledc/riddle-proof 0.7.158 → 0.7.160
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 +15 -5
- package/dist/{chunk-YB3LNLZB.js → chunk-MV7UM4EV.js} +228 -5
- package/dist/cli.cjs +280 -13
- package/dist/cli.js +53 -9
- package/dist/index.cjs +228 -5
- package/dist/index.js +1 -1
- package/dist/profile.cjs +228 -5
- package/dist/profile.d.cts +3 -1
- package/dist/profile.d.ts +3 -1
- package/dist/profile.js +1 -1
- package/package.json +1 -1
package/dist/profile.cjs
CHANGED
|
@@ -96,6 +96,7 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
|
|
|
96
96
|
"fill",
|
|
97
97
|
"set_input_value",
|
|
98
98
|
"set_range_value",
|
|
99
|
+
"canvas_signature",
|
|
99
100
|
"assert_text_visible",
|
|
100
101
|
"assert_text_absent",
|
|
101
102
|
"assert_selector_count",
|
|
@@ -597,6 +598,26 @@ function profileSetupRangeValueReceipts(results) {
|
|
|
597
598
|
reason: result.reason ?? result.error ?? null
|
|
598
599
|
}));
|
|
599
600
|
}
|
|
601
|
+
function profileSetupCanvasSignatureReceipts(results) {
|
|
602
|
+
return results.filter((result) => profileSetupResultAction(result) === "canvas_signature").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
|
+
label: result.label ?? null,
|
|
608
|
+
hash: result.hash ?? null,
|
|
609
|
+
data_length: result.data_length ?? null,
|
|
610
|
+
width: result.width ?? null,
|
|
611
|
+
height: result.height ?? null,
|
|
612
|
+
css_width: result.css_width ?? null,
|
|
613
|
+
css_height: result.css_height ?? null,
|
|
614
|
+
compare_to: result.compare_to ?? null,
|
|
615
|
+
previous_hash: result.previous_hash ?? null,
|
|
616
|
+
changed: result.changed ?? null,
|
|
617
|
+
return_stored_to: result.return_stored_to ?? null,
|
|
618
|
+
reason: result.reason ?? result.error ?? null
|
|
619
|
+
}));
|
|
620
|
+
}
|
|
600
621
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
601
622
|
if (items.length <= limit) return items;
|
|
602
623
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -641,6 +662,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
641
662
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
642
663
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
643
664
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
665
|
+
const canvasSignatureReceipts = profileSetupCanvasSignatureReceipts(results);
|
|
666
|
+
const sampledCanvasSignatureReceipts = sampleProfileSetupSummaryItems(canvasSignatureReceipts, 8);
|
|
644
667
|
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
645
668
|
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0;
|
|
646
669
|
return {
|
|
@@ -692,6 +715,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
692
715
|
set_range_value_total: rangeValueReceipts.length,
|
|
693
716
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
694
717
|
set_range_value: sampledRangeValueReceipts,
|
|
718
|
+
canvas_signature_total: canvasSignatureReceipts.length,
|
|
719
|
+
canvas_signature_truncated: canvasSignatureReceipts.length > sampledCanvasSignatureReceipts.length,
|
|
720
|
+
canvas_signature: sampledCanvasSignatureReceipts,
|
|
695
721
|
clicked,
|
|
696
722
|
text_samples,
|
|
697
723
|
failed: failed.map((result) => ({
|
|
@@ -744,7 +770,7 @@ function isSupportedCheckType(value) {
|
|
|
744
770
|
}
|
|
745
771
|
function normalizeSetupActionType(value, index) {
|
|
746
772
|
const normalizedInput = String(value || "").trim().replace(/-/g, "_");
|
|
747
|
-
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;
|
|
773
|
+
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 === "canvas_hash" || normalizedInput === "capture_canvas_hash" || normalizedInput === "capture_canvas_signature" || normalizedInput === "canvas_state_signature" ? "canvas_signature" : 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;
|
|
748
774
|
if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
|
|
749
775
|
return normalized;
|
|
750
776
|
}
|
|
@@ -873,7 +899,7 @@ function normalizeSetupAction(input, index) {
|
|
|
873
899
|
if (frameIndex !== void 0 && (!Number.isInteger(frameIndex) || frameIndex < 0)) {
|
|
874
900
|
throw new Error(`target.setup_actions[${index}].frame_index must be a non-negative integer.`);
|
|
875
901
|
}
|
|
876
|
-
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) {
|
|
902
|
+
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) {
|
|
877
903
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
878
904
|
}
|
|
879
905
|
const fromX = numberValue(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
@@ -967,7 +993,11 @@ function normalizeSetupAction(input, index) {
|
|
|
967
993
|
"assign_return_to",
|
|
968
994
|
"assignReturnTo",
|
|
969
995
|
"return_state_path",
|
|
970
|
-
"returnStatePath"
|
|
996
|
+
"returnStatePath",
|
|
997
|
+
"store_signature_to",
|
|
998
|
+
"storeSignatureTo",
|
|
999
|
+
"signature_path",
|
|
1000
|
+
"signaturePath"
|
|
971
1001
|
);
|
|
972
1002
|
const captureReturn = input.capture_return === false || input.captureReturn === false || input.include_return === false || input.includeReturn === false || input.omit_return === true || input.omitReturn === true ? false : void 0;
|
|
973
1003
|
const untilPath = stringFromOwn(input, "until_path", "untilPath", "until_state_path", "untilStatePath", "until_window_path", "untilWindowPath", "until");
|
|
@@ -1019,6 +1049,8 @@ function normalizeSetupAction(input, index) {
|
|
|
1019
1049
|
store_return_to: storeReturnTo,
|
|
1020
1050
|
capture_return: captureReturn,
|
|
1021
1051
|
return_summary_fields: normalizeReturnSummaryFields(input, index),
|
|
1052
|
+
compare_to: stringFromOwn(input, "compare_to", "compareTo", "previous_signature_path", "previousSignaturePath", "previous_path", "previousPath", "changed_from", "changedFrom"),
|
|
1053
|
+
expect_changed: booleanValue(valueFromOwn(input, "expect_changed", "expectChanged", "should_change", "shouldChange", "changed")),
|
|
1022
1054
|
until_path: untilPath,
|
|
1023
1055
|
until_expected_value: hasUntilExpectedValue ? toJsonValue(valueFromOwn(input, "until_expected_value", "untilExpectedValue", "until_expected", "untilExpected", "until_value", "untilValue", "expected_value", "expectedValue", "expected")) : void 0,
|
|
1024
1056
|
max_calls: maxCalls,
|
|
@@ -2141,7 +2173,14 @@ function textSequenceForCheck(viewport, check) {
|
|
|
2141
2173
|
const matchTexts = Array.isArray(sequence.match_texts) ? sequence.match_texts : [];
|
|
2142
2174
|
const visibleTexts = Array.isArray(sequence.visible_texts) ? sequence.visible_texts : [];
|
|
2143
2175
|
const texts = Array.isArray(sequence.texts) ? sequence.texts : [];
|
|
2144
|
-
|
|
2176
|
+
let candidates;
|
|
2177
|
+
if (check.type === "selector_text_visible") {
|
|
2178
|
+
candidates = visibleMatchTexts.length ? visibleMatchTexts : visibleTexts;
|
|
2179
|
+
} else if (check.type === "selector_text_absent") {
|
|
2180
|
+
candidates = matchTexts.length ? matchTexts : texts;
|
|
2181
|
+
} else {
|
|
2182
|
+
candidates = visibleMatchTexts.length ? visibleMatchTexts : matchTexts.length ? matchTexts : visibleTexts.length ? visibleTexts : texts;
|
|
2183
|
+
}
|
|
2145
2184
|
return candidates.map((text) => String(text).replace(/\s+/g, " ").trim()).filter(Boolean);
|
|
2146
2185
|
}
|
|
2147
2186
|
return [];
|
|
@@ -3521,7 +3560,14 @@ function textSequenceForCheck(viewport, check) {
|
|
|
3521
3560
|
const matchTexts = Array.isArray(sequence.match_texts) ? sequence.match_texts : [];
|
|
3522
3561
|
const visibleTexts = Array.isArray(sequence.visible_texts) ? sequence.visible_texts : [];
|
|
3523
3562
|
const texts = Array.isArray(sequence.texts) ? sequence.texts : [];
|
|
3524
|
-
|
|
3563
|
+
let candidates;
|
|
3564
|
+
if (check.type === "selector_text_visible") {
|
|
3565
|
+
candidates = visibleMatchTexts.length ? visibleMatchTexts : visibleTexts;
|
|
3566
|
+
} else if (check.type === "selector_text_absent") {
|
|
3567
|
+
candidates = matchTexts.length ? matchTexts : texts;
|
|
3568
|
+
} else {
|
|
3569
|
+
candidates = visibleMatchTexts.length ? visibleMatchTexts : matchTexts.length ? matchTexts : visibleTexts.length ? visibleTexts : texts;
|
|
3570
|
+
}
|
|
3525
3571
|
return candidates.map((text) => String(text || "").replace(/\s+/g, " ").trim()).filter(Boolean);
|
|
3526
3572
|
}
|
|
3527
3573
|
return [];
|
|
@@ -4131,6 +4177,28 @@ function profileSetupRangeValueReceipts(results) {
|
|
|
4131
4177
|
reason: result.reason || result.error || null,
|
|
4132
4178
|
}));
|
|
4133
4179
|
}
|
|
4180
|
+
function profileSetupCanvasSignatureReceipts(results) {
|
|
4181
|
+
return (results || [])
|
|
4182
|
+
.filter((result) => result && profileSetupResultAction(result) === "canvas_signature")
|
|
4183
|
+
.map((result) => ({
|
|
4184
|
+
ordinal: result.ordinal ?? null,
|
|
4185
|
+
ok: result.ok !== false,
|
|
4186
|
+
selector: result.selector ?? null,
|
|
4187
|
+
frame_selector: result.frame_selector ?? null,
|
|
4188
|
+
label: result.label ?? null,
|
|
4189
|
+
hash: result.hash ?? null,
|
|
4190
|
+
data_length: result.data_length ?? null,
|
|
4191
|
+
width: result.width ?? null,
|
|
4192
|
+
height: result.height ?? null,
|
|
4193
|
+
css_width: result.css_width ?? null,
|
|
4194
|
+
css_height: result.css_height ?? null,
|
|
4195
|
+
compare_to: result.compare_to ?? null,
|
|
4196
|
+
previous_hash: result.previous_hash ?? null,
|
|
4197
|
+
changed: result.changed ?? null,
|
|
4198
|
+
return_stored_to: result.return_stored_to ?? null,
|
|
4199
|
+
reason: result.reason || result.error || null,
|
|
4200
|
+
}));
|
|
4201
|
+
}
|
|
4134
4202
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
4135
4203
|
if ((items || []).length <= limit) return items || [];
|
|
4136
4204
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -4189,6 +4257,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
4189
4257
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
4190
4258
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
4191
4259
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
4260
|
+
const canvasSignatureReceipts = profileSetupCanvasSignatureReceipts(results);
|
|
4261
|
+
const sampledCanvasSignatureReceipts = sampleProfileSetupSummaryItems(canvasSignatureReceipts, 8);
|
|
4192
4262
|
const clickedItems = results
|
|
4193
4263
|
.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false)
|
|
4194
4264
|
.map((result) => {
|
|
@@ -4250,6 +4320,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
4250
4320
|
set_range_value_total: rangeValueReceipts.length,
|
|
4251
4321
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
4252
4322
|
set_range_value: sampledRangeValueReceipts,
|
|
4323
|
+
canvas_signature_total: canvasSignatureReceipts.length,
|
|
4324
|
+
canvas_signature_truncated: canvasSignatureReceipts.length > sampledCanvasSignatureReceipts.length,
|
|
4325
|
+
canvas_signature: sampledCanvasSignatureReceipts,
|
|
4253
4326
|
clicked,
|
|
4254
4327
|
text_samples: textSamples,
|
|
4255
4328
|
failed: failed.map((result) => ({
|
|
@@ -6265,6 +6338,156 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
6265
6338
|
reason: rangeResult && rangeResult.ok === true ? undefined : rangeResult?.reason || "range_value_not_set",
|
|
6266
6339
|
};
|
|
6267
6340
|
}
|
|
6341
|
+
if (type === "canvas_signature") {
|
|
6342
|
+
const scope = await setupActionScope(action, timeout);
|
|
6343
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
6344
|
+
const locator = scope.context.locator(action.selector);
|
|
6345
|
+
const count = await locator.count();
|
|
6346
|
+
if (!count) return { ...base, ...setupScopeEvidence(scope), reason: "selector_not_found", count };
|
|
6347
|
+
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
6348
|
+
if (targetIndex < 0 || targetIndex >= count) return { ...base, ...setupScopeEvidence(scope), reason: "index_out_of_range", count, target_index: targetIndex };
|
|
6349
|
+
const target = locator.nth(targetIndex);
|
|
6350
|
+
await target.waitFor({ state: "visible", timeout });
|
|
6351
|
+
const storeReturnTo = String(action.store_return_to || action.storeReturnTo || action.save_return_to || action.saveReturnTo || action.store_signature_to || action.storeSignatureTo || action.signature_path || action.signaturePath || "").trim();
|
|
6352
|
+
const compareTo = String(action.compare_to || action.compareTo || action.previous_signature_path || action.previousSignaturePath || action.previous_path || action.previousPath || action.changed_from || action.changedFrom || "").trim();
|
|
6353
|
+
const expectChanged = action.expect_changed === true || action.expectChanged === true || action.should_change === true || action.shouldChange === true || action.changed === true
|
|
6354
|
+
? true
|
|
6355
|
+
: action.expect_changed === false || action.expectChanged === false || action.should_change === false || action.shouldChange === false || action.changed === false
|
|
6356
|
+
? false
|
|
6357
|
+
: undefined;
|
|
6358
|
+
const signatureResult = await target.evaluate((element, payload) => {
|
|
6359
|
+
const toJsonValue = (value) => {
|
|
6360
|
+
if (value === null || value === undefined) return null;
|
|
6361
|
+
if (typeof value === "string" || typeof value === "boolean") return value;
|
|
6362
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : null;
|
|
6363
|
+
if (Array.isArray(value)) return value.map(toJsonValue);
|
|
6364
|
+
if (typeof value === "object") {
|
|
6365
|
+
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, toJsonValue(child)]));
|
|
6366
|
+
}
|
|
6367
|
+
return String(value);
|
|
6368
|
+
};
|
|
6369
|
+
const pathParts = (path) => String(path || "").split(".").map((part) => part.trim()).filter(Boolean);
|
|
6370
|
+
const readWindowPath = (path) => {
|
|
6371
|
+
const parts = pathParts(path);
|
|
6372
|
+
if (parts[0] === "window") parts.shift();
|
|
6373
|
+
if (!parts.length) return { ok: false, reason: "missing_path" };
|
|
6374
|
+
let current = window;
|
|
6375
|
+
for (const part of parts) {
|
|
6376
|
+
if (current === null || current === undefined) return { ok: false, reason: "path_not_found", missing_part: part };
|
|
6377
|
+
current = current[part];
|
|
6378
|
+
if (current === undefined) return { ok: false, reason: "path_not_found", missing_part: part };
|
|
6379
|
+
}
|
|
6380
|
+
return { ok: true, value: toJsonValue(current) };
|
|
6381
|
+
};
|
|
6382
|
+
const storeWindowValue = (path, value) => {
|
|
6383
|
+
const parts = pathParts(path);
|
|
6384
|
+
if (parts[0] === "window") parts.shift();
|
|
6385
|
+
if (!parts.length) return { ok: false, reason: "missing_store_path" };
|
|
6386
|
+
let target = window;
|
|
6387
|
+
for (let index = 0; index < parts.length - 1; index += 1) {
|
|
6388
|
+
const part = parts[index];
|
|
6389
|
+
if (target[part] === null || typeof target[part] !== "object") target[part] = {};
|
|
6390
|
+
target = target[part];
|
|
6391
|
+
}
|
|
6392
|
+
target[parts[parts.length - 1]] = value;
|
|
6393
|
+
return { ok: true, path: parts.join(".") };
|
|
6394
|
+
};
|
|
6395
|
+
const hashText = (text) => {
|
|
6396
|
+
let hash = 2166136261;
|
|
6397
|
+
const step = Math.max(1, Math.floor((text.length || 1) / 4000));
|
|
6398
|
+
for (let index = 0; index < text.length; index += step) {
|
|
6399
|
+
hash ^= text.charCodeAt(index);
|
|
6400
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
6401
|
+
}
|
|
6402
|
+
return String(hash);
|
|
6403
|
+
};
|
|
6404
|
+
const tag = String(element && element.tagName ? element.tagName : "").toLowerCase();
|
|
6405
|
+
if (tag !== "canvas") return { ok: false, reason: "not_canvas_element", tag };
|
|
6406
|
+
const rect = element.getBoundingClientRect();
|
|
6407
|
+
let data = "";
|
|
6408
|
+
try {
|
|
6409
|
+
data = element.toDataURL("image/png");
|
|
6410
|
+
} catch (error) {
|
|
6411
|
+
return {
|
|
6412
|
+
ok: false,
|
|
6413
|
+
reason: "canvas_read_failed",
|
|
6414
|
+
error: String(error && error.message ? error.message : error).slice(0, 1000),
|
|
6415
|
+
width: element.width || 0,
|
|
6416
|
+
height: element.height || 0,
|
|
6417
|
+
css_width: Math.round(rect.width || 0),
|
|
6418
|
+
css_height: Math.round(rect.height || 0),
|
|
6419
|
+
};
|
|
6420
|
+
}
|
|
6421
|
+
const result = {
|
|
6422
|
+
ok: Boolean(element.width > 0 && element.height > 0 && data.length > 0),
|
|
6423
|
+
reason: element.width > 0 && element.height > 0 && data.length > 0 ? undefined : "empty_canvas_signature",
|
|
6424
|
+
hash: hashText(data),
|
|
6425
|
+
data_length: data.length,
|
|
6426
|
+
width: element.width || 0,
|
|
6427
|
+
height: element.height || 0,
|
|
6428
|
+
css_width: Math.round(rect.width || 0),
|
|
6429
|
+
css_height: Math.round(rect.height || 0),
|
|
6430
|
+
compare_to: payload.compareTo || undefined,
|
|
6431
|
+
previous_hash: null,
|
|
6432
|
+
changed: null,
|
|
6433
|
+
};
|
|
6434
|
+
if (payload.compareTo) {
|
|
6435
|
+
const previous = readWindowPath(payload.compareTo);
|
|
6436
|
+
if (!previous.ok) {
|
|
6437
|
+
result.ok = false;
|
|
6438
|
+
result.reason = previous.reason || "compare_path_not_found";
|
|
6439
|
+
result.missing_part = previous.missing_part || undefined;
|
|
6440
|
+
} else {
|
|
6441
|
+
const previousValue = previous.value;
|
|
6442
|
+
const previousHash = previousValue && typeof previousValue === "object" && !Array.isArray(previousValue)
|
|
6443
|
+
? previousValue.hash || previousValue.signature || previousValue.canvas_hash || null
|
|
6444
|
+
: typeof previousValue === "string"
|
|
6445
|
+
? previousValue
|
|
6446
|
+
: null;
|
|
6447
|
+
result.previous_hash = previousHash === null || previousHash === undefined ? null : String(previousHash);
|
|
6448
|
+
result.changed = result.previous_hash === null ? null : result.previous_hash !== result.hash;
|
|
6449
|
+
if (payload.expectChanged === true && result.changed !== true) {
|
|
6450
|
+
result.ok = false;
|
|
6451
|
+
result.reason = "canvas_signature_unchanged";
|
|
6452
|
+
} else if (payload.expectChanged === false && result.changed !== false) {
|
|
6453
|
+
result.ok = false;
|
|
6454
|
+
result.reason = "canvas_signature_changed";
|
|
6455
|
+
}
|
|
6456
|
+
}
|
|
6457
|
+
}
|
|
6458
|
+
if (payload.storeReturnTo) {
|
|
6459
|
+
const stored = storeWindowValue(payload.storeReturnTo, result);
|
|
6460
|
+
if (!stored.ok) {
|
|
6461
|
+
return { ...result, ok: false, reason: "signature_store_failed", store_reason: stored.reason };
|
|
6462
|
+
}
|
|
6463
|
+
return { ...result, return_stored_to: stored.path };
|
|
6464
|
+
}
|
|
6465
|
+
return result;
|
|
6466
|
+
}, { compareTo, expectChanged, storeReturnTo });
|
|
6467
|
+
return {
|
|
6468
|
+
...base,
|
|
6469
|
+
...setupScopeEvidence(scope),
|
|
6470
|
+
ok: signatureResult && signatureResult.ok === true,
|
|
6471
|
+
count,
|
|
6472
|
+
target_index: targetIndex,
|
|
6473
|
+
label: action.label || action.name || undefined,
|
|
6474
|
+
hash: signatureResult?.hash,
|
|
6475
|
+
data_length: signatureResult?.data_length,
|
|
6476
|
+
width: signatureResult?.width,
|
|
6477
|
+
height: signatureResult?.height,
|
|
6478
|
+
css_width: signatureResult?.css_width,
|
|
6479
|
+
css_height: signatureResult?.css_height,
|
|
6480
|
+
compare_to: signatureResult?.compare_to || compareTo || undefined,
|
|
6481
|
+
previous_hash: signatureResult?.previous_hash,
|
|
6482
|
+
changed: signatureResult?.changed,
|
|
6483
|
+
return_stored_to: signatureResult?.return_stored_to || storeReturnTo || undefined,
|
|
6484
|
+
missing_part: signatureResult?.missing_part || undefined,
|
|
6485
|
+
store_reason: signatureResult?.store_reason || undefined,
|
|
6486
|
+
tag: signatureResult?.tag,
|
|
6487
|
+
reason: signatureResult && signatureResult.ok === true ? undefined : signatureResult?.reason || "canvas_signature_failed",
|
|
6488
|
+
error: signatureResult?.error || undefined,
|
|
6489
|
+
};
|
|
6490
|
+
}
|
|
6268
6491
|
if (type === "assert_selector_count") {
|
|
6269
6492
|
const scope = await setupActionScope(action, timeout);
|
|
6270
6493
|
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", "observe_within", "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", "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"];
|
|
8
|
+
declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "drag", "press", "fill", "set_input_value", "set_range_value", "canvas_signature", "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];
|
|
@@ -134,6 +134,8 @@ interface RiddleProofProfileSetupAction {
|
|
|
134
134
|
store_return_to?: string;
|
|
135
135
|
capture_return?: boolean;
|
|
136
136
|
return_summary_fields?: RiddleProofProfileReturnSummaryField[];
|
|
137
|
+
compare_to?: string;
|
|
138
|
+
expect_changed?: boolean;
|
|
137
139
|
until_path?: string;
|
|
138
140
|
until_expected_value?: JsonValue;
|
|
139
141
|
max_calls?: 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", "observe_within", "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", "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"];
|
|
8
|
+
declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "drag", "press", "fill", "set_input_value", "set_range_value", "canvas_signature", "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];
|
|
@@ -134,6 +134,8 @@ interface RiddleProofProfileSetupAction {
|
|
|
134
134
|
store_return_to?: string;
|
|
135
135
|
capture_return?: boolean;
|
|
136
136
|
return_summary_fields?: RiddleProofProfileReturnSummaryField[];
|
|
137
|
+
compare_to?: string;
|
|
138
|
+
expect_changed?: boolean;
|
|
137
139
|
until_path?: string;
|
|
138
140
|
until_expected_value?: JsonValue;
|
|
139
141
|
max_calls?: 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-MV7UM4EV.js";
|
|
27
27
|
export {
|
|
28
28
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
29
29
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|