@riddledc/riddle-proof 0.7.137 → 0.7.139
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 +10 -1
- package/dist/{chunk-2WWSWSYA.js → chunk-DB6J53V5.js} +73 -3
- package/dist/cli.cjs +73 -3
- package/dist/cli.js +1 -1
- package/dist/index.cjs +73 -3
- package/dist/index.js +1 -1
- package/dist/profile.cjs +73 -3
- package/dist/profile.d.cts +2 -0
- package/dist/profile.d.ts +2 -0
- package/dist/profile.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -455,7 +455,10 @@ met and records `call_count`, final `returned`, and final `until_value`.
|
|
|
455
455
|
Use `screenshot` with an optional `label` to capture durable Riddle screenshots
|
|
456
456
|
at important setup milestones, such as after a route switch, terminal state, or
|
|
457
457
|
reset. These labels are recorded in setup evidence and included in profile
|
|
458
|
-
artifact summaries alongside final viewport screenshots.
|
|
458
|
+
artifact summaries alongside final viewport screenshots. Setup screenshots are
|
|
459
|
+
full-page by default; set `full_page: false`, `fullPage: false`, or
|
|
460
|
+
`mode: "viewport"` when fixed or sticky page chrome would make full-page
|
|
461
|
+
captures harder to review.
|
|
459
462
|
Add `frame_selector` / `frameSelector` to a setup action when the interaction
|
|
460
463
|
target lives inside an embedded iframe, such as a community game player or
|
|
461
464
|
hosted preview surface. Selector-based actions, storage actions, window calls,
|
|
@@ -479,6 +482,12 @@ and `click_count_value_total`.
|
|
|
479
482
|
profile carries its own hosted Riddle worker budget; an explicit CLI `--timeout`
|
|
480
483
|
still overrides the profile value for one-off runs.
|
|
481
484
|
|
|
485
|
+
Profile final viewport screenshots are full-page by default. Set
|
|
486
|
+
`target.screenshot_full_page: false`, `target.screenshotFullPage: false`, or
|
|
487
|
+
`target.screenshot_mode: "viewport"` when the automatic final screenshots
|
|
488
|
+
should capture only the current viewport, for example when fixed or sticky
|
|
489
|
+
headers make full-page captures misleading.
|
|
490
|
+
|
|
482
491
|
Use `allowed_console_patterns` / `allowed_console_texts` on
|
|
483
492
|
`no_fatal_console_errors` when a negative-path profile intentionally triggers a
|
|
484
493
|
known browser console error, such as a mocked `503` that the app recovers from:
|
|
@@ -665,6 +665,34 @@ function normalizeSetupActionPointerType(value, type, index) {
|
|
|
665
665
|
if (normalized === "pen" || normalized === "stylus") return "pen";
|
|
666
666
|
throw new Error(`target.setup_actions[${index}].pointer_type ${String(value)} is not supported. Supported pointer types: mouse, touch, pen.`);
|
|
667
667
|
}
|
|
668
|
+
function normalizeSetupActionScreenshotFullPage(input, type, index) {
|
|
669
|
+
const directFullPage = booleanValue(valueFromOwn(input, "full_page", "fullPage"));
|
|
670
|
+
const viewportOnly = booleanValue(valueFromOwn(input, "viewport_only", "viewportOnly", "viewport_screenshot", "viewportScreenshot"));
|
|
671
|
+
if (type !== "screenshot") {
|
|
672
|
+
if (directFullPage !== void 0 || viewportOnly !== void 0 || valueFromOwn(input, "screenshot_mode", "screenshotMode", "capture_mode", "captureMode") !== void 0) {
|
|
673
|
+
throw new Error(`target.setup_actions[${index}].full_page is only supported for screenshot actions.`);
|
|
674
|
+
}
|
|
675
|
+
return void 0;
|
|
676
|
+
}
|
|
677
|
+
const modeInput = stringFromOwn(input, "mode", "screenshot_mode", "screenshotMode", "capture_mode", "captureMode");
|
|
678
|
+
let modeFullPage;
|
|
679
|
+
if (modeInput) {
|
|
680
|
+
const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
|
|
681
|
+
if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
|
|
682
|
+
modeFullPage = true;
|
|
683
|
+
} else if (mode === "viewport" || mode === "view") {
|
|
684
|
+
modeFullPage = false;
|
|
685
|
+
} else {
|
|
686
|
+
throw new Error(`target.setup_actions[${index}].mode ${modeInput} is not supported for screenshot actions. Supported modes: full_page, viewport.`);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
|
|
690
|
+
if (!values.length) return void 0;
|
|
691
|
+
if (values.some((value) => value !== values[0])) {
|
|
692
|
+
throw new Error(`target.setup_actions[${index}] has conflicting screenshot full_page / viewport mode options.`);
|
|
693
|
+
}
|
|
694
|
+
return values[0];
|
|
695
|
+
}
|
|
668
696
|
function normalizeSetupAction(input, index) {
|
|
669
697
|
if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
670
698
|
const type = normalizeSetupActionType(stringValue(input.type), index);
|
|
@@ -795,6 +823,7 @@ function normalizeSetupAction(input, index) {
|
|
|
795
823
|
selector,
|
|
796
824
|
frame_selector: frameSelector,
|
|
797
825
|
frame_index: frameIndex,
|
|
826
|
+
full_page: normalizeSetupActionScreenshotFullPage(input, type, index),
|
|
798
827
|
force: type === "click" && (input.force === true || input.force_click === true || input.forceClick === true),
|
|
799
828
|
click_count: normalizeSetupActionClickCount(input, type, index),
|
|
800
829
|
coordinate_mode: coordinateMode,
|
|
@@ -846,6 +875,42 @@ function normalizeSetupActions(value) {
|
|
|
846
875
|
if (!Array.isArray(value)) throw new Error("target.setup_actions must be an array.");
|
|
847
876
|
return value.map(normalizeSetupAction);
|
|
848
877
|
}
|
|
878
|
+
function normalizeTargetScreenshotFullPage(input) {
|
|
879
|
+
const directFullPage = booleanValue(valueFromOwn(
|
|
880
|
+
input,
|
|
881
|
+
"screenshot_full_page",
|
|
882
|
+
"screenshotFullPage",
|
|
883
|
+
"final_screenshot_full_page",
|
|
884
|
+
"finalScreenshotFullPage",
|
|
885
|
+
"full_page_screenshots",
|
|
886
|
+
"fullPageScreenshots"
|
|
887
|
+
));
|
|
888
|
+
const viewportOnly = booleanValue(valueFromOwn(
|
|
889
|
+
input,
|
|
890
|
+
"viewport_screenshots",
|
|
891
|
+
"viewportScreenshots",
|
|
892
|
+
"viewport_only_screenshots",
|
|
893
|
+
"viewportOnlyScreenshots"
|
|
894
|
+
));
|
|
895
|
+
const modeInput = stringFromOwn(input, "screenshot_mode", "screenshotMode", "final_screenshot_mode", "finalScreenshotMode");
|
|
896
|
+
let modeFullPage;
|
|
897
|
+
if (modeInput) {
|
|
898
|
+
const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
|
|
899
|
+
if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
|
|
900
|
+
modeFullPage = true;
|
|
901
|
+
} else if (mode === "viewport" || mode === "view") {
|
|
902
|
+
modeFullPage = false;
|
|
903
|
+
} else {
|
|
904
|
+
throw new Error(`target.screenshot_mode ${modeInput} is not supported. Supported modes: full_page, viewport.`);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
|
|
908
|
+
if (!values.length) return void 0;
|
|
909
|
+
if (values.some((value) => value !== values[0])) {
|
|
910
|
+
throw new Error("target has conflicting screenshot full_page / viewport mode options.");
|
|
911
|
+
}
|
|
912
|
+
return values[0];
|
|
913
|
+
}
|
|
849
914
|
function normalizeNetworkMock(input, index) {
|
|
850
915
|
if (!isRecord(input)) throw new Error(`target.network_mocks[${index}] must be an object.`);
|
|
851
916
|
const url = stringValue(input.url) || stringValue(input.glob) || stringValue(input.pattern);
|
|
@@ -1414,6 +1479,7 @@ function normalizeRiddleProofProfile(input, options = {}) {
|
|
|
1414
1479
|
timeout_sec: timeoutSecValue(targetInput.timeout_sec) ?? timeoutSecValue(targetInput.timeoutSec) ?? timeoutSecValue(targetInput.riddle_timeout_sec) ?? timeoutSecValue(targetInput.riddleTimeoutSec),
|
|
1415
1480
|
wait_for_selector: stringValue(targetInput.wait_for_selector) || stringValue(targetInput.waitForSelector),
|
|
1416
1481
|
wait_ms: numberValue(targetInput.wait_ms) ?? numberValue(targetInput.waitMs),
|
|
1482
|
+
screenshot_full_page: normalizeTargetScreenshotFullPage(targetInput),
|
|
1417
1483
|
setup_actions: normalizeSetupActions(targetInput.setup_actions ?? targetInput.setupActions),
|
|
1418
1484
|
network_mocks: normalizeNetworkMocks(targetInput.network_mocks ?? targetInput.networkMocks)
|
|
1419
1485
|
},
|
|
@@ -5104,8 +5170,10 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
5104
5170
|
const viewportName = viewport && viewport.name ? viewport.name : "viewport";
|
|
5105
5171
|
const label = profileSlug + "-" + viewportName + "-" + labelPart;
|
|
5106
5172
|
if (typeof saveScreenshot !== "function") return { ...base, reason: "save_screenshot_unavailable", label: rawLabel };
|
|
5107
|
-
|
|
5108
|
-
|
|
5173
|
+
const screenshotOptions = {};
|
|
5174
|
+
if (action.full_page !== undefined) screenshotOptions.fullPage = action.full_page !== false;
|
|
5175
|
+
await saveScreenshot(label, screenshotOptions);
|
|
5176
|
+
return { ...base, ok: true, label: rawLabel, screenshot_label: label, full_page: action.full_page === undefined ? null : action.full_page !== false };
|
|
5109
5177
|
}
|
|
5110
5178
|
if (type === "clear_console") {
|
|
5111
5179
|
const cleared_console_event_count = consoleEvents.length;
|
|
@@ -6859,7 +6927,9 @@ async function captureViewport(viewport) {
|
|
|
6859
6927
|
}
|
|
6860
6928
|
const screenshotLabel = profileSlug + "-" + viewport.name;
|
|
6861
6929
|
try {
|
|
6862
|
-
|
|
6930
|
+
const screenshotOptions = {};
|
|
6931
|
+
if (profile.target && profile.target.screenshot_full_page !== undefined) screenshotOptions.fullPage = profile.target.screenshot_full_page !== false;
|
|
6932
|
+
if (typeof saveScreenshot === "function") await saveScreenshot(screenshotLabel, screenshotOptions);
|
|
6863
6933
|
} catch (error) {
|
|
6864
6934
|
pageErrors.push({ message: "saveScreenshot failed: " + String(error && error.message ? error.message : error).slice(0, 500) });
|
|
6865
6935
|
}
|
package/dist/cli.cjs
CHANGED
|
@@ -7602,6 +7602,34 @@ function normalizeSetupActionPointerType(value, type, index) {
|
|
|
7602
7602
|
if (normalized === "pen" || normalized === "stylus") return "pen";
|
|
7603
7603
|
throw new Error(`target.setup_actions[${index}].pointer_type ${String(value)} is not supported. Supported pointer types: mouse, touch, pen.`);
|
|
7604
7604
|
}
|
|
7605
|
+
function normalizeSetupActionScreenshotFullPage(input, type, index) {
|
|
7606
|
+
const directFullPage = booleanValue(valueFromOwn(input, "full_page", "fullPage"));
|
|
7607
|
+
const viewportOnly = booleanValue(valueFromOwn(input, "viewport_only", "viewportOnly", "viewport_screenshot", "viewportScreenshot"));
|
|
7608
|
+
if (type !== "screenshot") {
|
|
7609
|
+
if (directFullPage !== void 0 || viewportOnly !== void 0 || valueFromOwn(input, "screenshot_mode", "screenshotMode", "capture_mode", "captureMode") !== void 0) {
|
|
7610
|
+
throw new Error(`target.setup_actions[${index}].full_page is only supported for screenshot actions.`);
|
|
7611
|
+
}
|
|
7612
|
+
return void 0;
|
|
7613
|
+
}
|
|
7614
|
+
const modeInput = stringFromOwn(input, "mode", "screenshot_mode", "screenshotMode", "capture_mode", "captureMode");
|
|
7615
|
+
let modeFullPage;
|
|
7616
|
+
if (modeInput) {
|
|
7617
|
+
const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
|
|
7618
|
+
if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
|
|
7619
|
+
modeFullPage = true;
|
|
7620
|
+
} else if (mode === "viewport" || mode === "view") {
|
|
7621
|
+
modeFullPage = false;
|
|
7622
|
+
} else {
|
|
7623
|
+
throw new Error(`target.setup_actions[${index}].mode ${modeInput} is not supported for screenshot actions. Supported modes: full_page, viewport.`);
|
|
7624
|
+
}
|
|
7625
|
+
}
|
|
7626
|
+
const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
|
|
7627
|
+
if (!values.length) return void 0;
|
|
7628
|
+
if (values.some((value) => value !== values[0])) {
|
|
7629
|
+
throw new Error(`target.setup_actions[${index}] has conflicting screenshot full_page / viewport mode options.`);
|
|
7630
|
+
}
|
|
7631
|
+
return values[0];
|
|
7632
|
+
}
|
|
7605
7633
|
function normalizeSetupAction(input, index) {
|
|
7606
7634
|
if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
7607
7635
|
const type = normalizeSetupActionType(stringValue2(input.type), index);
|
|
@@ -7732,6 +7760,7 @@ function normalizeSetupAction(input, index) {
|
|
|
7732
7760
|
selector,
|
|
7733
7761
|
frame_selector: frameSelector,
|
|
7734
7762
|
frame_index: frameIndex,
|
|
7763
|
+
full_page: normalizeSetupActionScreenshotFullPage(input, type, index),
|
|
7735
7764
|
force: type === "click" && (input.force === true || input.force_click === true || input.forceClick === true),
|
|
7736
7765
|
click_count: normalizeSetupActionClickCount(input, type, index),
|
|
7737
7766
|
coordinate_mode: coordinateMode,
|
|
@@ -7783,6 +7812,42 @@ function normalizeSetupActions(value) {
|
|
|
7783
7812
|
if (!Array.isArray(value)) throw new Error("target.setup_actions must be an array.");
|
|
7784
7813
|
return value.map(normalizeSetupAction);
|
|
7785
7814
|
}
|
|
7815
|
+
function normalizeTargetScreenshotFullPage(input) {
|
|
7816
|
+
const directFullPage = booleanValue(valueFromOwn(
|
|
7817
|
+
input,
|
|
7818
|
+
"screenshot_full_page",
|
|
7819
|
+
"screenshotFullPage",
|
|
7820
|
+
"final_screenshot_full_page",
|
|
7821
|
+
"finalScreenshotFullPage",
|
|
7822
|
+
"full_page_screenshots",
|
|
7823
|
+
"fullPageScreenshots"
|
|
7824
|
+
));
|
|
7825
|
+
const viewportOnly = booleanValue(valueFromOwn(
|
|
7826
|
+
input,
|
|
7827
|
+
"viewport_screenshots",
|
|
7828
|
+
"viewportScreenshots",
|
|
7829
|
+
"viewport_only_screenshots",
|
|
7830
|
+
"viewportOnlyScreenshots"
|
|
7831
|
+
));
|
|
7832
|
+
const modeInput = stringFromOwn(input, "screenshot_mode", "screenshotMode", "final_screenshot_mode", "finalScreenshotMode");
|
|
7833
|
+
let modeFullPage;
|
|
7834
|
+
if (modeInput) {
|
|
7835
|
+
const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
|
|
7836
|
+
if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
|
|
7837
|
+
modeFullPage = true;
|
|
7838
|
+
} else if (mode === "viewport" || mode === "view") {
|
|
7839
|
+
modeFullPage = false;
|
|
7840
|
+
} else {
|
|
7841
|
+
throw new Error(`target.screenshot_mode ${modeInput} is not supported. Supported modes: full_page, viewport.`);
|
|
7842
|
+
}
|
|
7843
|
+
}
|
|
7844
|
+
const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
|
|
7845
|
+
if (!values.length) return void 0;
|
|
7846
|
+
if (values.some((value) => value !== values[0])) {
|
|
7847
|
+
throw new Error("target has conflicting screenshot full_page / viewport mode options.");
|
|
7848
|
+
}
|
|
7849
|
+
return values[0];
|
|
7850
|
+
}
|
|
7786
7851
|
function normalizeNetworkMock(input, index) {
|
|
7787
7852
|
if (!isRecord(input)) throw new Error(`target.network_mocks[${index}] must be an object.`);
|
|
7788
7853
|
const url = stringValue2(input.url) || stringValue2(input.glob) || stringValue2(input.pattern);
|
|
@@ -8351,6 +8416,7 @@ function normalizeRiddleProofProfile(input, options = {}) {
|
|
|
8351
8416
|
timeout_sec: timeoutSecValue(targetInput.timeout_sec) ?? timeoutSecValue(targetInput.timeoutSec) ?? timeoutSecValue(targetInput.riddle_timeout_sec) ?? timeoutSecValue(targetInput.riddleTimeoutSec),
|
|
8352
8417
|
wait_for_selector: stringValue2(targetInput.wait_for_selector) || stringValue2(targetInput.waitForSelector),
|
|
8353
8418
|
wait_ms: numberValue(targetInput.wait_ms) ?? numberValue(targetInput.waitMs),
|
|
8419
|
+
screenshot_full_page: normalizeTargetScreenshotFullPage(targetInput),
|
|
8354
8420
|
setup_actions: normalizeSetupActions(targetInput.setup_actions ?? targetInput.setupActions),
|
|
8355
8421
|
network_mocks: normalizeNetworkMocks(targetInput.network_mocks ?? targetInput.networkMocks)
|
|
8356
8422
|
},
|
|
@@ -12025,8 +12091,10 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
12025
12091
|
const viewportName = viewport && viewport.name ? viewport.name : "viewport";
|
|
12026
12092
|
const label = profileSlug + "-" + viewportName + "-" + labelPart;
|
|
12027
12093
|
if (typeof saveScreenshot !== "function") return { ...base, reason: "save_screenshot_unavailable", label: rawLabel };
|
|
12028
|
-
|
|
12029
|
-
|
|
12094
|
+
const screenshotOptions = {};
|
|
12095
|
+
if (action.full_page !== undefined) screenshotOptions.fullPage = action.full_page !== false;
|
|
12096
|
+
await saveScreenshot(label, screenshotOptions);
|
|
12097
|
+
return { ...base, ok: true, label: rawLabel, screenshot_label: label, full_page: action.full_page === undefined ? null : action.full_page !== false };
|
|
12030
12098
|
}
|
|
12031
12099
|
if (type === "clear_console") {
|
|
12032
12100
|
const cleared_console_event_count = consoleEvents.length;
|
|
@@ -13780,7 +13848,9 @@ async function captureViewport(viewport) {
|
|
|
13780
13848
|
}
|
|
13781
13849
|
const screenshotLabel = profileSlug + "-" + viewport.name;
|
|
13782
13850
|
try {
|
|
13783
|
-
|
|
13851
|
+
const screenshotOptions = {};
|
|
13852
|
+
if (profile.target && profile.target.screenshot_full_page !== undefined) screenshotOptions.fullPage = profile.target.screenshot_full_page !== false;
|
|
13853
|
+
if (typeof saveScreenshot === "function") await saveScreenshot(screenshotLabel, screenshotOptions);
|
|
13784
13854
|
} catch (error) {
|
|
13785
13855
|
pageErrors.push({ message: "saveScreenshot failed: " + String(error && error.message ? error.message : error).slice(0, 500) });
|
|
13786
13856
|
}
|
package/dist/cli.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -9398,6 +9398,34 @@ function normalizeSetupActionPointerType(value, type, index) {
|
|
|
9398
9398
|
if (normalized === "pen" || normalized === "stylus") return "pen";
|
|
9399
9399
|
throw new Error(`target.setup_actions[${index}].pointer_type ${String(value)} is not supported. Supported pointer types: mouse, touch, pen.`);
|
|
9400
9400
|
}
|
|
9401
|
+
function normalizeSetupActionScreenshotFullPage(input, type, index) {
|
|
9402
|
+
const directFullPage = booleanValue(valueFromOwn(input, "full_page", "fullPage"));
|
|
9403
|
+
const viewportOnly = booleanValue(valueFromOwn(input, "viewport_only", "viewportOnly", "viewport_screenshot", "viewportScreenshot"));
|
|
9404
|
+
if (type !== "screenshot") {
|
|
9405
|
+
if (directFullPage !== void 0 || viewportOnly !== void 0 || valueFromOwn(input, "screenshot_mode", "screenshotMode", "capture_mode", "captureMode") !== void 0) {
|
|
9406
|
+
throw new Error(`target.setup_actions[${index}].full_page is only supported for screenshot actions.`);
|
|
9407
|
+
}
|
|
9408
|
+
return void 0;
|
|
9409
|
+
}
|
|
9410
|
+
const modeInput = stringFromOwn(input, "mode", "screenshot_mode", "screenshotMode", "capture_mode", "captureMode");
|
|
9411
|
+
let modeFullPage;
|
|
9412
|
+
if (modeInput) {
|
|
9413
|
+
const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
|
|
9414
|
+
if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
|
|
9415
|
+
modeFullPage = true;
|
|
9416
|
+
} else if (mode === "viewport" || mode === "view") {
|
|
9417
|
+
modeFullPage = false;
|
|
9418
|
+
} else {
|
|
9419
|
+
throw new Error(`target.setup_actions[${index}].mode ${modeInput} is not supported for screenshot actions. Supported modes: full_page, viewport.`);
|
|
9420
|
+
}
|
|
9421
|
+
}
|
|
9422
|
+
const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
|
|
9423
|
+
if (!values.length) return void 0;
|
|
9424
|
+
if (values.some((value) => value !== values[0])) {
|
|
9425
|
+
throw new Error(`target.setup_actions[${index}] has conflicting screenshot full_page / viewport mode options.`);
|
|
9426
|
+
}
|
|
9427
|
+
return values[0];
|
|
9428
|
+
}
|
|
9401
9429
|
function normalizeSetupAction(input, index) {
|
|
9402
9430
|
if (!isRecord2(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
9403
9431
|
const type = normalizeSetupActionType(stringValue5(input.type), index);
|
|
@@ -9528,6 +9556,7 @@ function normalizeSetupAction(input, index) {
|
|
|
9528
9556
|
selector,
|
|
9529
9557
|
frame_selector: frameSelector,
|
|
9530
9558
|
frame_index: frameIndex,
|
|
9559
|
+
full_page: normalizeSetupActionScreenshotFullPage(input, type, index),
|
|
9531
9560
|
force: type === "click" && (input.force === true || input.force_click === true || input.forceClick === true),
|
|
9532
9561
|
click_count: normalizeSetupActionClickCount(input, type, index),
|
|
9533
9562
|
coordinate_mode: coordinateMode,
|
|
@@ -9579,6 +9608,42 @@ function normalizeSetupActions(value) {
|
|
|
9579
9608
|
if (!Array.isArray(value)) throw new Error("target.setup_actions must be an array.");
|
|
9580
9609
|
return value.map(normalizeSetupAction);
|
|
9581
9610
|
}
|
|
9611
|
+
function normalizeTargetScreenshotFullPage(input) {
|
|
9612
|
+
const directFullPage = booleanValue(valueFromOwn(
|
|
9613
|
+
input,
|
|
9614
|
+
"screenshot_full_page",
|
|
9615
|
+
"screenshotFullPage",
|
|
9616
|
+
"final_screenshot_full_page",
|
|
9617
|
+
"finalScreenshotFullPage",
|
|
9618
|
+
"full_page_screenshots",
|
|
9619
|
+
"fullPageScreenshots"
|
|
9620
|
+
));
|
|
9621
|
+
const viewportOnly = booleanValue(valueFromOwn(
|
|
9622
|
+
input,
|
|
9623
|
+
"viewport_screenshots",
|
|
9624
|
+
"viewportScreenshots",
|
|
9625
|
+
"viewport_only_screenshots",
|
|
9626
|
+
"viewportOnlyScreenshots"
|
|
9627
|
+
));
|
|
9628
|
+
const modeInput = stringFromOwn(input, "screenshot_mode", "screenshotMode", "final_screenshot_mode", "finalScreenshotMode");
|
|
9629
|
+
let modeFullPage;
|
|
9630
|
+
if (modeInput) {
|
|
9631
|
+
const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
|
|
9632
|
+
if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
|
|
9633
|
+
modeFullPage = true;
|
|
9634
|
+
} else if (mode === "viewport" || mode === "view") {
|
|
9635
|
+
modeFullPage = false;
|
|
9636
|
+
} else {
|
|
9637
|
+
throw new Error(`target.screenshot_mode ${modeInput} is not supported. Supported modes: full_page, viewport.`);
|
|
9638
|
+
}
|
|
9639
|
+
}
|
|
9640
|
+
const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
|
|
9641
|
+
if (!values.length) return void 0;
|
|
9642
|
+
if (values.some((value) => value !== values[0])) {
|
|
9643
|
+
throw new Error("target has conflicting screenshot full_page / viewport mode options.");
|
|
9644
|
+
}
|
|
9645
|
+
return values[0];
|
|
9646
|
+
}
|
|
9582
9647
|
function normalizeNetworkMock(input, index) {
|
|
9583
9648
|
if (!isRecord2(input)) throw new Error(`target.network_mocks[${index}] must be an object.`);
|
|
9584
9649
|
const url = stringValue5(input.url) || stringValue5(input.glob) || stringValue5(input.pattern);
|
|
@@ -10147,6 +10212,7 @@ function normalizeRiddleProofProfile(input, options = {}) {
|
|
|
10147
10212
|
timeout_sec: timeoutSecValue(targetInput.timeout_sec) ?? timeoutSecValue(targetInput.timeoutSec) ?? timeoutSecValue(targetInput.riddle_timeout_sec) ?? timeoutSecValue(targetInput.riddleTimeoutSec),
|
|
10148
10213
|
wait_for_selector: stringValue5(targetInput.wait_for_selector) || stringValue5(targetInput.waitForSelector),
|
|
10149
10214
|
wait_ms: numberValue3(targetInput.wait_ms) ?? numberValue3(targetInput.waitMs),
|
|
10215
|
+
screenshot_full_page: normalizeTargetScreenshotFullPage(targetInput),
|
|
10150
10216
|
setup_actions: normalizeSetupActions(targetInput.setup_actions ?? targetInput.setupActions),
|
|
10151
10217
|
network_mocks: normalizeNetworkMocks(targetInput.network_mocks ?? targetInput.networkMocks)
|
|
10152
10218
|
},
|
|
@@ -13837,8 +13903,10 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
13837
13903
|
const viewportName = viewport && viewport.name ? viewport.name : "viewport";
|
|
13838
13904
|
const label = profileSlug + "-" + viewportName + "-" + labelPart;
|
|
13839
13905
|
if (typeof saveScreenshot !== "function") return { ...base, reason: "save_screenshot_unavailable", label: rawLabel };
|
|
13840
|
-
|
|
13841
|
-
|
|
13906
|
+
const screenshotOptions = {};
|
|
13907
|
+
if (action.full_page !== undefined) screenshotOptions.fullPage = action.full_page !== false;
|
|
13908
|
+
await saveScreenshot(label, screenshotOptions);
|
|
13909
|
+
return { ...base, ok: true, label: rawLabel, screenshot_label: label, full_page: action.full_page === undefined ? null : action.full_page !== false };
|
|
13842
13910
|
}
|
|
13843
13911
|
if (type === "clear_console") {
|
|
13844
13912
|
const cleared_console_event_count = consoleEvents.length;
|
|
@@ -15592,7 +15660,9 @@ async function captureViewport(viewport) {
|
|
|
15592
15660
|
}
|
|
15593
15661
|
const screenshotLabel = profileSlug + "-" + viewport.name;
|
|
15594
15662
|
try {
|
|
15595
|
-
|
|
15663
|
+
const screenshotOptions = {};
|
|
15664
|
+
if (profile.target && profile.target.screenshot_full_page !== undefined) screenshotOptions.fullPage = profile.target.screenshot_full_page !== false;
|
|
15665
|
+
if (typeof saveScreenshot === "function") await saveScreenshot(screenshotLabel, screenshotOptions);
|
|
15596
15666
|
} catch (error) {
|
|
15597
15667
|
pageErrors.push({ message: "saveScreenshot failed: " + String(error && error.message ? error.message : error).slice(0, 500) });
|
|
15598
15668
|
}
|
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-DB6J53V5.js";
|
|
66
66
|
import {
|
|
67
67
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
68
68
|
DEFAULT_RIDDLE_API_KEY_FILE,
|
package/dist/profile.cjs
CHANGED
|
@@ -712,6 +712,34 @@ function normalizeSetupActionPointerType(value, type, index) {
|
|
|
712
712
|
if (normalized === "pen" || normalized === "stylus") return "pen";
|
|
713
713
|
throw new Error(`target.setup_actions[${index}].pointer_type ${String(value)} is not supported. Supported pointer types: mouse, touch, pen.`);
|
|
714
714
|
}
|
|
715
|
+
function normalizeSetupActionScreenshotFullPage(input, type, index) {
|
|
716
|
+
const directFullPage = booleanValue(valueFromOwn(input, "full_page", "fullPage"));
|
|
717
|
+
const viewportOnly = booleanValue(valueFromOwn(input, "viewport_only", "viewportOnly", "viewport_screenshot", "viewportScreenshot"));
|
|
718
|
+
if (type !== "screenshot") {
|
|
719
|
+
if (directFullPage !== void 0 || viewportOnly !== void 0 || valueFromOwn(input, "screenshot_mode", "screenshotMode", "capture_mode", "captureMode") !== void 0) {
|
|
720
|
+
throw new Error(`target.setup_actions[${index}].full_page is only supported for screenshot actions.`);
|
|
721
|
+
}
|
|
722
|
+
return void 0;
|
|
723
|
+
}
|
|
724
|
+
const modeInput = stringFromOwn(input, "mode", "screenshot_mode", "screenshotMode", "capture_mode", "captureMode");
|
|
725
|
+
let modeFullPage;
|
|
726
|
+
if (modeInput) {
|
|
727
|
+
const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
|
|
728
|
+
if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
|
|
729
|
+
modeFullPage = true;
|
|
730
|
+
} else if (mode === "viewport" || mode === "view") {
|
|
731
|
+
modeFullPage = false;
|
|
732
|
+
} else {
|
|
733
|
+
throw new Error(`target.setup_actions[${index}].mode ${modeInput} is not supported for screenshot actions. Supported modes: full_page, viewport.`);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
|
|
737
|
+
if (!values.length) return void 0;
|
|
738
|
+
if (values.some((value) => value !== values[0])) {
|
|
739
|
+
throw new Error(`target.setup_actions[${index}] has conflicting screenshot full_page / viewport mode options.`);
|
|
740
|
+
}
|
|
741
|
+
return values[0];
|
|
742
|
+
}
|
|
715
743
|
function normalizeSetupAction(input, index) {
|
|
716
744
|
if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
717
745
|
const type = normalizeSetupActionType(stringValue(input.type), index);
|
|
@@ -842,6 +870,7 @@ function normalizeSetupAction(input, index) {
|
|
|
842
870
|
selector,
|
|
843
871
|
frame_selector: frameSelector,
|
|
844
872
|
frame_index: frameIndex,
|
|
873
|
+
full_page: normalizeSetupActionScreenshotFullPage(input, type, index),
|
|
845
874
|
force: type === "click" && (input.force === true || input.force_click === true || input.forceClick === true),
|
|
846
875
|
click_count: normalizeSetupActionClickCount(input, type, index),
|
|
847
876
|
coordinate_mode: coordinateMode,
|
|
@@ -893,6 +922,42 @@ function normalizeSetupActions(value) {
|
|
|
893
922
|
if (!Array.isArray(value)) throw new Error("target.setup_actions must be an array.");
|
|
894
923
|
return value.map(normalizeSetupAction);
|
|
895
924
|
}
|
|
925
|
+
function normalizeTargetScreenshotFullPage(input) {
|
|
926
|
+
const directFullPage = booleanValue(valueFromOwn(
|
|
927
|
+
input,
|
|
928
|
+
"screenshot_full_page",
|
|
929
|
+
"screenshotFullPage",
|
|
930
|
+
"final_screenshot_full_page",
|
|
931
|
+
"finalScreenshotFullPage",
|
|
932
|
+
"full_page_screenshots",
|
|
933
|
+
"fullPageScreenshots"
|
|
934
|
+
));
|
|
935
|
+
const viewportOnly = booleanValue(valueFromOwn(
|
|
936
|
+
input,
|
|
937
|
+
"viewport_screenshots",
|
|
938
|
+
"viewportScreenshots",
|
|
939
|
+
"viewport_only_screenshots",
|
|
940
|
+
"viewportOnlyScreenshots"
|
|
941
|
+
));
|
|
942
|
+
const modeInput = stringFromOwn(input, "screenshot_mode", "screenshotMode", "final_screenshot_mode", "finalScreenshotMode");
|
|
943
|
+
let modeFullPage;
|
|
944
|
+
if (modeInput) {
|
|
945
|
+
const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
|
|
946
|
+
if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
|
|
947
|
+
modeFullPage = true;
|
|
948
|
+
} else if (mode === "viewport" || mode === "view") {
|
|
949
|
+
modeFullPage = false;
|
|
950
|
+
} else {
|
|
951
|
+
throw new Error(`target.screenshot_mode ${modeInput} is not supported. Supported modes: full_page, viewport.`);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
|
|
955
|
+
if (!values.length) return void 0;
|
|
956
|
+
if (values.some((value) => value !== values[0])) {
|
|
957
|
+
throw new Error("target has conflicting screenshot full_page / viewport mode options.");
|
|
958
|
+
}
|
|
959
|
+
return values[0];
|
|
960
|
+
}
|
|
896
961
|
function normalizeNetworkMock(input, index) {
|
|
897
962
|
if (!isRecord(input)) throw new Error(`target.network_mocks[${index}] must be an object.`);
|
|
898
963
|
const url = stringValue(input.url) || stringValue(input.glob) || stringValue(input.pattern);
|
|
@@ -1461,6 +1526,7 @@ function normalizeRiddleProofProfile(input, options = {}) {
|
|
|
1461
1526
|
timeout_sec: timeoutSecValue(targetInput.timeout_sec) ?? timeoutSecValue(targetInput.timeoutSec) ?? timeoutSecValue(targetInput.riddle_timeout_sec) ?? timeoutSecValue(targetInput.riddleTimeoutSec),
|
|
1462
1527
|
wait_for_selector: stringValue(targetInput.wait_for_selector) || stringValue(targetInput.waitForSelector),
|
|
1463
1528
|
wait_ms: numberValue(targetInput.wait_ms) ?? numberValue(targetInput.waitMs),
|
|
1529
|
+
screenshot_full_page: normalizeTargetScreenshotFullPage(targetInput),
|
|
1464
1530
|
setup_actions: normalizeSetupActions(targetInput.setup_actions ?? targetInput.setupActions),
|
|
1465
1531
|
network_mocks: normalizeNetworkMocks(targetInput.network_mocks ?? targetInput.networkMocks)
|
|
1466
1532
|
},
|
|
@@ -5151,8 +5217,10 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
5151
5217
|
const viewportName = viewport && viewport.name ? viewport.name : "viewport";
|
|
5152
5218
|
const label = profileSlug + "-" + viewportName + "-" + labelPart;
|
|
5153
5219
|
if (typeof saveScreenshot !== "function") return { ...base, reason: "save_screenshot_unavailable", label: rawLabel };
|
|
5154
|
-
|
|
5155
|
-
|
|
5220
|
+
const screenshotOptions = {};
|
|
5221
|
+
if (action.full_page !== undefined) screenshotOptions.fullPage = action.full_page !== false;
|
|
5222
|
+
await saveScreenshot(label, screenshotOptions);
|
|
5223
|
+
return { ...base, ok: true, label: rawLabel, screenshot_label: label, full_page: action.full_page === undefined ? null : action.full_page !== false };
|
|
5156
5224
|
}
|
|
5157
5225
|
if (type === "clear_console") {
|
|
5158
5226
|
const cleared_console_event_count = consoleEvents.length;
|
|
@@ -6906,7 +6974,9 @@ async function captureViewport(viewport) {
|
|
|
6906
6974
|
}
|
|
6907
6975
|
const screenshotLabel = profileSlug + "-" + viewport.name;
|
|
6908
6976
|
try {
|
|
6909
|
-
|
|
6977
|
+
const screenshotOptions = {};
|
|
6978
|
+
if (profile.target && profile.target.screenshot_full_page !== undefined) screenshotOptions.fullPage = profile.target.screenshot_full_page !== false;
|
|
6979
|
+
if (typeof saveScreenshot === "function") await saveScreenshot(screenshotLabel, screenshotOptions);
|
|
6910
6980
|
} catch (error) {
|
|
6911
6981
|
pageErrors.push({ message: "saveScreenshot failed: " + String(error && error.message ? error.message : error).slice(0, 500) });
|
|
6912
6982
|
}
|
package/dist/profile.d.cts
CHANGED
|
@@ -112,6 +112,7 @@ interface RiddleProofProfileSetupAction {
|
|
|
112
112
|
selector?: string;
|
|
113
113
|
frame_selector?: string;
|
|
114
114
|
frame_index?: number;
|
|
115
|
+
full_page?: boolean;
|
|
115
116
|
force?: boolean;
|
|
116
117
|
click_count?: number;
|
|
117
118
|
coordinate_mode?: "pixels" | "ratio";
|
|
@@ -202,6 +203,7 @@ interface RiddleProofProfileTarget {
|
|
|
202
203
|
timeout_sec?: number;
|
|
203
204
|
wait_for_selector?: string;
|
|
204
205
|
wait_ms?: number;
|
|
206
|
+
screenshot_full_page?: boolean;
|
|
205
207
|
setup_actions?: RiddleProofProfileSetupAction[];
|
|
206
208
|
network_mocks?: RiddleProofProfileNetworkMock[];
|
|
207
209
|
}
|
package/dist/profile.d.ts
CHANGED
|
@@ -112,6 +112,7 @@ interface RiddleProofProfileSetupAction {
|
|
|
112
112
|
selector?: string;
|
|
113
113
|
frame_selector?: string;
|
|
114
114
|
frame_index?: number;
|
|
115
|
+
full_page?: boolean;
|
|
115
116
|
force?: boolean;
|
|
116
117
|
click_count?: number;
|
|
117
118
|
coordinate_mode?: "pixels" | "ratio";
|
|
@@ -202,6 +203,7 @@ interface RiddleProofProfileTarget {
|
|
|
202
203
|
timeout_sec?: number;
|
|
203
204
|
wait_for_selector?: string;
|
|
204
205
|
wait_ms?: number;
|
|
206
|
+
screenshot_full_page?: boolean;
|
|
205
207
|
setup_actions?: RiddleProofProfileSetupAction[];
|
|
206
208
|
network_mocks?: RiddleProofProfileNetworkMock[];
|
|
207
209
|
}
|
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-DB6J53V5.js";
|
|
27
27
|
export {
|
|
28
28
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
29
29
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|