@riddledc/riddle-proof 0.7.8 → 0.7.10
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 +14 -1
- package/dist/{chunk-7NMAU4DP.js → chunk-A7RJZD4I.js} +263 -8
- package/dist/cli.cjs +262 -8
- package/dist/cli.js +1 -1
- package/dist/index.cjs +264 -8
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/profile.cjs +264 -8
- package/dist/profile.d.cts +17 -1
- package/dist/profile.d.ts +17 -1
- package/dist/profile.js +3 -1
- package/dist/proof-run-engine.d.cts +3 -3
- package/dist/proof-run-engine.d.ts +3 -3
- package/examples/profiles/page-content-basic.json +4 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2917,6 +2917,7 @@ __export(index_exports, {
|
|
|
2917
2917
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES: () => RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
2918
2918
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION: () => RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
|
2919
2919
|
RIDDLE_PROOF_PROFILE_RESULT_VERSION: () => RIDDLE_PROOF_PROFILE_RESULT_VERSION,
|
|
2920
|
+
RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: () => RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
|
|
2920
2921
|
RIDDLE_PROOF_PROFILE_STATUSES: () => RIDDLE_PROOF_PROFILE_STATUSES,
|
|
2921
2922
|
RIDDLE_PROOF_PROFILE_VERSION: () => RIDDLE_PROOF_PROFILE_VERSION,
|
|
2922
2923
|
RIDDLE_PROOF_RUN_CARD_VERSION: () => RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
@@ -8525,6 +8526,12 @@ var RIDDLE_PROOF_PROFILE_CHECK_TYPES = [
|
|
|
8525
8526
|
"no_mobile_horizontal_overflow",
|
|
8526
8527
|
"no_fatal_console_errors"
|
|
8527
8528
|
];
|
|
8529
|
+
var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
|
|
8530
|
+
"click",
|
|
8531
|
+
"wait",
|
|
8532
|
+
"wait_for_selector",
|
|
8533
|
+
"wait_for_text"
|
|
8534
|
+
];
|
|
8528
8535
|
var DEFAULT_VIEWPORTS = [
|
|
8529
8536
|
{ name: "desktop", width: 1280, height: 800 }
|
|
8530
8537
|
];
|
|
@@ -8577,6 +8584,41 @@ function normalizeViewports(value) {
|
|
|
8577
8584
|
function isSupportedCheckType(value) {
|
|
8578
8585
|
return RIDDLE_PROOF_PROFILE_CHECK_TYPES.includes(value);
|
|
8579
8586
|
}
|
|
8587
|
+
function normalizeSetupActionType(value, index) {
|
|
8588
|
+
const normalized = String(value || "").trim().replace(/-/g, "_");
|
|
8589
|
+
if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
|
|
8590
|
+
return normalized;
|
|
8591
|
+
}
|
|
8592
|
+
throw new Error(`target.setup_actions[${index}].type ${value || "(missing)"} is not supported. Supported actions: ${RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.join(", ")}`);
|
|
8593
|
+
}
|
|
8594
|
+
function normalizeSetupAction(input, index) {
|
|
8595
|
+
if (!isRecord2(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
8596
|
+
const type = normalizeSetupActionType(stringValue5(input.type), index);
|
|
8597
|
+
const selector = stringValue5(input.selector);
|
|
8598
|
+
if ((type === "click" || type === "wait_for_selector" || type === "wait_for_text") && !selector) {
|
|
8599
|
+
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
8600
|
+
}
|
|
8601
|
+
if (type === "wait_for_text" && !stringValue5(input.text) && !stringValue5(input.pattern)) {
|
|
8602
|
+
throw new Error(`target.setup_actions[${index}] wait_for_text requires text or pattern.`);
|
|
8603
|
+
}
|
|
8604
|
+
return {
|
|
8605
|
+
type,
|
|
8606
|
+
selector,
|
|
8607
|
+
text: stringValue5(input.text),
|
|
8608
|
+
pattern: stringValue5(input.pattern),
|
|
8609
|
+
flags: stringValue5(input.flags),
|
|
8610
|
+
index: numberValue3(input.index),
|
|
8611
|
+
ms: numberValue3(input.ms) ?? numberValue3(input.wait_ms) ?? numberValue3(input.waitMs),
|
|
8612
|
+
timeout_ms: numberValue3(input.timeout_ms) ?? numberValue3(input.timeoutMs),
|
|
8613
|
+
after_ms: numberValue3(input.after_ms) ?? numberValue3(input.afterMs),
|
|
8614
|
+
continue_on_failure: input.continue_on_failure === true || input.continueOnFailure === true
|
|
8615
|
+
};
|
|
8616
|
+
}
|
|
8617
|
+
function normalizeSetupActions(value) {
|
|
8618
|
+
if (value === void 0) return void 0;
|
|
8619
|
+
if (!Array.isArray(value)) throw new Error("target.setup_actions must be an array.");
|
|
8620
|
+
return value.map(normalizeSetupAction);
|
|
8621
|
+
}
|
|
8580
8622
|
function normalizeCheck(input, index) {
|
|
8581
8623
|
if (!isRecord2(input)) throw new Error(`checks[${index}] must be an object.`);
|
|
8582
8624
|
const type = stringValue5(input.type);
|
|
@@ -8644,7 +8686,8 @@ function normalizeRiddleProofProfile(input, options = {}) {
|
|
|
8644
8686
|
viewports: options.viewports?.length ? options.viewports : normalizeViewports(targetInput.viewports),
|
|
8645
8687
|
auth: stringValue5(targetInput.auth) || "none",
|
|
8646
8688
|
wait_for_selector: stringValue5(targetInput.wait_for_selector) || stringValue5(targetInput.waitForSelector),
|
|
8647
|
-
wait_ms: numberValue3(targetInput.wait_ms) ?? numberValue3(targetInput.waitMs)
|
|
8689
|
+
wait_ms: numberValue3(targetInput.wait_ms) ?? numberValue3(targetInput.waitMs),
|
|
8690
|
+
setup_actions: normalizeSetupActions(targetInput.setup_actions ?? targetInput.setupActions)
|
|
8648
8691
|
},
|
|
8649
8692
|
checks,
|
|
8650
8693
|
artifacts: Array.isArray(input.artifacts) ? input.artifacts.map((item) => String(item)).filter(Boolean) : ["screenshot", "console", "dom_summary", "proof_json"],
|
|
@@ -8662,7 +8705,13 @@ function resolveRiddleProofProfileTargetUrl(profile) {
|
|
|
8662
8705
|
throw new Error("profile target URL could not be resolved.");
|
|
8663
8706
|
}
|
|
8664
8707
|
function routeForViewport(viewport) {
|
|
8665
|
-
|
|
8708
|
+
if (viewport?.route) {
|
|
8709
|
+
return {
|
|
8710
|
+
...viewport.route,
|
|
8711
|
+
matched: viewport.route.matched || routePathMatches(viewport.route.observed, viewport.route.expected_path)
|
|
8712
|
+
};
|
|
8713
|
+
}
|
|
8714
|
+
return {
|
|
8666
8715
|
requested: "",
|
|
8667
8716
|
observed: "",
|
|
8668
8717
|
matched: false,
|
|
@@ -8688,8 +8737,17 @@ function matchText(sample, check) {
|
|
|
8688
8737
|
}
|
|
8689
8738
|
return sample.includes(check.text || "");
|
|
8690
8739
|
}
|
|
8740
|
+
function normalizeRoutePath(path6) {
|
|
8741
|
+
const value = path6 || "/";
|
|
8742
|
+
if (value === "/") return "/";
|
|
8743
|
+
return value.replace(/\/+$/, "") || "/";
|
|
8744
|
+
}
|
|
8745
|
+
function routePathMatches(observed, expected) {
|
|
8746
|
+
return normalizeRoutePath(observed) === normalizeRoutePath(expected);
|
|
8747
|
+
}
|
|
8691
8748
|
function successfulRoute(route) {
|
|
8692
|
-
|
|
8749
|
+
const matched = route.matched || routePathMatches(route.observed, route.expected_path);
|
|
8750
|
+
return matched && !route.error && (route.http_status === null || route.http_status === void 0 || route.http_status < 400);
|
|
8693
8751
|
}
|
|
8694
8752
|
function assessCheckFromEvidence(check, evidence) {
|
|
8695
8753
|
const viewports = evidence.viewports || [];
|
|
@@ -8707,7 +8765,7 @@ function assessCheckFromEvidence(check, evidence) {
|
|
|
8707
8765
|
const failed = viewports.filter((viewport) => !successfulRoute({
|
|
8708
8766
|
...viewport.route,
|
|
8709
8767
|
expected_path: expectedPath,
|
|
8710
|
-
matched: viewport.route.observed
|
|
8768
|
+
matched: routePathMatches(viewport.route.observed, expectedPath) || viewport.route.matched
|
|
8711
8769
|
}));
|
|
8712
8770
|
return {
|
|
8713
8771
|
type: check.type,
|
|
@@ -8817,6 +8875,48 @@ function assessCheckFromEvidence(check, evidence) {
|
|
|
8817
8875
|
message: "Unsupported check type."
|
|
8818
8876
|
};
|
|
8819
8877
|
}
|
|
8878
|
+
function assessSetupActionsFromEvidence(profile, evidence) {
|
|
8879
|
+
if (!profile.target.setup_actions?.length) return void 0;
|
|
8880
|
+
const actionCount = profile.target.setup_actions.length;
|
|
8881
|
+
const failed = [];
|
|
8882
|
+
const viewports = evidence.viewports || [];
|
|
8883
|
+
for (const viewport of viewports) {
|
|
8884
|
+
const results = viewport.setup_action_results || [];
|
|
8885
|
+
for (const result of results) {
|
|
8886
|
+
if (result.ok === false) {
|
|
8887
|
+
failed.push({
|
|
8888
|
+
viewport: viewport.name,
|
|
8889
|
+
action: result.action ?? result.type ?? null,
|
|
8890
|
+
selector: result.selector ?? null,
|
|
8891
|
+
reason: result.reason ?? result.error ?? null
|
|
8892
|
+
});
|
|
8893
|
+
}
|
|
8894
|
+
}
|
|
8895
|
+
if (results.length < actionCount && results.every((result) => result.ok !== false)) {
|
|
8896
|
+
failed.push({
|
|
8897
|
+
viewport: viewport.name,
|
|
8898
|
+
action: "setup_actions",
|
|
8899
|
+
selector: null,
|
|
8900
|
+
reason: `missing setup action results: ${results.length}/${actionCount}`
|
|
8901
|
+
});
|
|
8902
|
+
}
|
|
8903
|
+
}
|
|
8904
|
+
return {
|
|
8905
|
+
type: "setup_actions_succeeded",
|
|
8906
|
+
label: "setup actions succeeded",
|
|
8907
|
+
status: failed.length ? "failed" : "passed",
|
|
8908
|
+
evidence: {
|
|
8909
|
+
action_count: actionCount,
|
|
8910
|
+
viewports: viewports.map((viewport) => ({
|
|
8911
|
+
name: viewport.name,
|
|
8912
|
+
ok: (viewport.setup_action_results || []).length >= actionCount && (viewport.setup_action_results || []).every((result) => result.ok !== false),
|
|
8913
|
+
result_count: (viewport.setup_action_results || []).length
|
|
8914
|
+
})),
|
|
8915
|
+
failed
|
|
8916
|
+
},
|
|
8917
|
+
message: failed.length ? `Setup actions failed in ${failed.length} viewport action(s).` : void 0
|
|
8918
|
+
};
|
|
8919
|
+
}
|
|
8820
8920
|
function profileStatusFromEvidence(evidence, checks) {
|
|
8821
8921
|
if (!evidence) return "proof_insufficient";
|
|
8822
8922
|
const viewports = evidence.viewports || [];
|
|
@@ -8828,7 +8928,10 @@ function profileStatusFromEvidence(evidence, checks) {
|
|
|
8828
8928
|
}
|
|
8829
8929
|
function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
|
|
8830
8930
|
const capturedAt = evidence?.captured_at || (/* @__PURE__ */ new Date()).toISOString();
|
|
8831
|
-
const checks = evidence ?
|
|
8931
|
+
const checks = evidence ? [
|
|
8932
|
+
assessSetupActionsFromEvidence(profile, evidence),
|
|
8933
|
+
...profile.checks.map((check) => assessCheckFromEvidence(check, evidence))
|
|
8934
|
+
].filter((check) => Boolean(check)) : [];
|
|
8832
8935
|
const status = profileStatusFromEvidence(evidence, checks);
|
|
8833
8936
|
const firstViewport = evidence?.viewports?.[0];
|
|
8834
8937
|
const screenshots = (evidence?.viewports || []).map((viewport) => viewport.screenshot_label).filter((label) => Boolean(label));
|
|
@@ -8930,8 +9033,16 @@ function createRiddleProofProfileInsufficientResult(input) {
|
|
|
8930
9033
|
}
|
|
8931
9034
|
function runtimeScriptAssessmentSource() {
|
|
8932
9035
|
return String.raw`
|
|
9036
|
+
function normalizeRoutePath(path) {
|
|
9037
|
+
const value = path || "/";
|
|
9038
|
+
if (value === "/") return "/";
|
|
9039
|
+
return value.replace(/\/+$/, "") || "/";
|
|
9040
|
+
}
|
|
9041
|
+
function routePathMatches(observed, expected) {
|
|
9042
|
+
return normalizeRoutePath(observed) === normalizeRoutePath(expected);
|
|
9043
|
+
}
|
|
8933
9044
|
function routeOk(route) {
|
|
8934
|
-
return Boolean(route && route.matched && !route.error && (route.http_status == null || route.http_status < 400));
|
|
9045
|
+
return Boolean(route && (route.matched || routePathMatches(route.observed, route.expected_path)) && !route.error && (route.http_status == null || route.http_status < 400));
|
|
8935
9046
|
}
|
|
8936
9047
|
function textMatches(sample, check) {
|
|
8937
9048
|
if (check.pattern) {
|
|
@@ -8942,12 +9053,53 @@ function textMatches(sample, check) {
|
|
|
8942
9053
|
function assessProfile(profile, evidence) {
|
|
8943
9054
|
const checks = [];
|
|
8944
9055
|
const viewports = evidence.viewports || [];
|
|
9056
|
+
if (profile.target && Array.isArray(profile.target.setup_actions) && profile.target.setup_actions.length) {
|
|
9057
|
+
const actionCount = profile.target.setup_actions.length;
|
|
9058
|
+
const failed = [];
|
|
9059
|
+
for (const viewport of viewports) {
|
|
9060
|
+
const results = viewport.setup_action_results || [];
|
|
9061
|
+
for (const result of results) {
|
|
9062
|
+
if (result && result.ok === false) {
|
|
9063
|
+
failed.push({
|
|
9064
|
+
viewport: viewport.name,
|
|
9065
|
+
action: result.action || result.type || null,
|
|
9066
|
+
selector: result.selector || null,
|
|
9067
|
+
reason: result.reason || result.error || null,
|
|
9068
|
+
});
|
|
9069
|
+
}
|
|
9070
|
+
}
|
|
9071
|
+
if (results.length < actionCount && results.every((result) => !result || result.ok !== false)) {
|
|
9072
|
+
failed.push({
|
|
9073
|
+
viewport: viewport.name,
|
|
9074
|
+
action: "setup_actions",
|
|
9075
|
+
selector: null,
|
|
9076
|
+
reason: "missing setup action results: " + results.length + "/" + actionCount,
|
|
9077
|
+
});
|
|
9078
|
+
}
|
|
9079
|
+
}
|
|
9080
|
+
checks.push({
|
|
9081
|
+
type: "setup_actions_succeeded",
|
|
9082
|
+
label: "setup actions succeeded",
|
|
9083
|
+
status: failed.length ? "failed" : "passed",
|
|
9084
|
+
evidence: {
|
|
9085
|
+
action_count: actionCount,
|
|
9086
|
+
viewports: viewports.map((viewport) => ({
|
|
9087
|
+
name: viewport.name,
|
|
9088
|
+
ok: (viewport.setup_action_results || []).length >= actionCount
|
|
9089
|
+
&& (viewport.setup_action_results || []).every((result) => !result || result.ok !== false),
|
|
9090
|
+
result_count: (viewport.setup_action_results || []).length,
|
|
9091
|
+
})),
|
|
9092
|
+
failed,
|
|
9093
|
+
},
|
|
9094
|
+
message: failed.length ? "Setup actions failed in " + failed.length + " viewport action(s)." : undefined,
|
|
9095
|
+
});
|
|
9096
|
+
}
|
|
8945
9097
|
for (const check of profile.checks || []) {
|
|
8946
9098
|
if (check.type === "route_loaded") {
|
|
8947
9099
|
const expectedPath = check.expected_path || new URL(evidence.target_url).pathname || "/";
|
|
8948
9100
|
const failed = viewports.filter((viewport) => {
|
|
8949
9101
|
const route = { ...(viewport.route || {}), expected_path: expectedPath };
|
|
8950
|
-
route.matched = route.observed
|
|
9102
|
+
route.matched = routePathMatches(route.observed, expectedPath) || route.matched;
|
|
8951
9103
|
return !routeOk(route);
|
|
8952
9104
|
});
|
|
8953
9105
|
checks.push({
|
|
@@ -9104,6 +9256,105 @@ function textMatches(sample, check) {
|
|
|
9104
9256
|
}
|
|
9105
9257
|
return String(sample || "").includes(check.text || "");
|
|
9106
9258
|
}
|
|
9259
|
+
function setupActionType(action) {
|
|
9260
|
+
return String(action && action.type ? action.type : "").replace(/-/g, "_");
|
|
9261
|
+
}
|
|
9262
|
+
function setupNumber(value, fallback) {
|
|
9263
|
+
const number = Number(value);
|
|
9264
|
+
return Number.isFinite(number) && number >= 0 ? number : fallback;
|
|
9265
|
+
}
|
|
9266
|
+
function setupTextMatches(sample, action) {
|
|
9267
|
+
if (action.pattern) {
|
|
9268
|
+
try { return new RegExp(action.pattern, action.flags || "").test(sample || ""); } catch { return false; }
|
|
9269
|
+
}
|
|
9270
|
+
return String(sample || "").includes(action.text || "");
|
|
9271
|
+
}
|
|
9272
|
+
async function setupLocatorText(locator, index) {
|
|
9273
|
+
return await locator.nth(index).textContent({ timeout: 1000 }).catch(() => "");
|
|
9274
|
+
}
|
|
9275
|
+
async function setupLocatorVisible(locator, index) {
|
|
9276
|
+
return await locator.nth(index).isVisible({ timeout: 1000 }).catch(() => false);
|
|
9277
|
+
}
|
|
9278
|
+
async function executeSetupAction(action, ordinal) {
|
|
9279
|
+
const type = setupActionType(action);
|
|
9280
|
+
const base = { ok: false, action: type || "unknown", ordinal, selector: action.selector || null };
|
|
9281
|
+
const timeout = setupNumber(action.timeout_ms, 5000);
|
|
9282
|
+
try {
|
|
9283
|
+
if (type === "wait") {
|
|
9284
|
+
const ms = setupNumber(action.ms, 500);
|
|
9285
|
+
await page.waitForTimeout(ms);
|
|
9286
|
+
return { ...base, ok: true, ms };
|
|
9287
|
+
}
|
|
9288
|
+
if (type === "wait_for_selector") {
|
|
9289
|
+
await page.waitForSelector(action.selector, { state: "visible", timeout });
|
|
9290
|
+
return { ...base, ok: true, timeout_ms: timeout };
|
|
9291
|
+
}
|
|
9292
|
+
if (type === "click") {
|
|
9293
|
+
const locator = page.locator(action.selector);
|
|
9294
|
+
const count = await locator.count();
|
|
9295
|
+
if (!count) return { ...base, reason: "selector_not_found", count };
|
|
9296
|
+
let targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
9297
|
+
let matchedText = null;
|
|
9298
|
+
let hiddenMatchIndex = -1;
|
|
9299
|
+
let hiddenMatchedText = null;
|
|
9300
|
+
if (action.text || action.pattern) {
|
|
9301
|
+
targetIndex = -1;
|
|
9302
|
+
for (let index = 0; index < count; index += 1) {
|
|
9303
|
+
const text = await setupLocatorText(locator, index);
|
|
9304
|
+
if (setupTextMatches(text, action)) {
|
|
9305
|
+
const visible = await setupLocatorVisible(locator, index);
|
|
9306
|
+
if (visible) {
|
|
9307
|
+
targetIndex = index;
|
|
9308
|
+
matchedText = text;
|
|
9309
|
+
break;
|
|
9310
|
+
}
|
|
9311
|
+
if (hiddenMatchIndex < 0) {
|
|
9312
|
+
hiddenMatchIndex = index;
|
|
9313
|
+
hiddenMatchedText = text;
|
|
9314
|
+
}
|
|
9315
|
+
}
|
|
9316
|
+
}
|
|
9317
|
+
if (targetIndex < 0 && hiddenMatchIndex >= 0) return { ...base, reason: "matching_element_not_visible", count, target_index: hiddenMatchIndex, text: hiddenMatchedText };
|
|
9318
|
+
if (targetIndex < 0) return { ...base, reason: "text_not_found", count };
|
|
9319
|
+
}
|
|
9320
|
+
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex };
|
|
9321
|
+
await locator.nth(targetIndex).click({ timeout });
|
|
9322
|
+
return { ...base, ok: true, count, target_index: targetIndex, text: matchedText };
|
|
9323
|
+
}
|
|
9324
|
+
if (type === "wait_for_text") {
|
|
9325
|
+
const locator = page.locator(action.selector);
|
|
9326
|
+
const startedAt = Date.now();
|
|
9327
|
+
let lastText = "";
|
|
9328
|
+
while (Date.now() - startedAt <= timeout) {
|
|
9329
|
+
const count = await locator.count().catch(() => 0);
|
|
9330
|
+
for (let index = 0; index < count; index += 1) {
|
|
9331
|
+
const text = await setupLocatorText(locator, index);
|
|
9332
|
+
lastText = text || lastText;
|
|
9333
|
+
if (setupTextMatches(text, action)) {
|
|
9334
|
+
return { ...base, ok: true, text, target_index: index, timeout_ms: timeout };
|
|
9335
|
+
}
|
|
9336
|
+
}
|
|
9337
|
+
await page.waitForTimeout(100);
|
|
9338
|
+
}
|
|
9339
|
+
return { ...base, reason: "text_not_found", text: lastText, timeout_ms: timeout };
|
|
9340
|
+
}
|
|
9341
|
+
return { ...base, reason: "unsupported_action" };
|
|
9342
|
+
} catch (error) {
|
|
9343
|
+
return { ...base, error: String(error && error.message ? error.message : error).slice(0, 1000) };
|
|
9344
|
+
}
|
|
9345
|
+
}
|
|
9346
|
+
async function executeSetupActions(actions) {
|
|
9347
|
+
const results = [];
|
|
9348
|
+
for (let index = 0; index < (actions || []).length; index += 1) {
|
|
9349
|
+
const action = actions[index] || {};
|
|
9350
|
+
const result = await executeSetupAction(action, index);
|
|
9351
|
+
results.push(result);
|
|
9352
|
+
const afterMs = setupNumber(action.after_ms, 0);
|
|
9353
|
+
if (afterMs) await page.waitForTimeout(afterMs);
|
|
9354
|
+
if (result.ok === false && action.continue_on_failure !== true) break;
|
|
9355
|
+
}
|
|
9356
|
+
return results;
|
|
9357
|
+
}
|
|
9107
9358
|
function expectedPathFor(check) {
|
|
9108
9359
|
return check.expected_path || new URL(targetUrl).pathname || "/";
|
|
9109
9360
|
}
|
|
@@ -9138,6 +9389,9 @@ async function captureViewport(viewport) {
|
|
|
9138
9389
|
if (!navigationError && profile.target.wait_ms) {
|
|
9139
9390
|
await page.waitForTimeout(profile.target.wait_ms);
|
|
9140
9391
|
}
|
|
9392
|
+
const setupActionResults = (!navigationError && !waitError)
|
|
9393
|
+
? await executeSetupActions(profile.target.setup_actions || [])
|
|
9394
|
+
: [];
|
|
9141
9395
|
const dom = await page.evaluate(() => {
|
|
9142
9396
|
const body = document.body;
|
|
9143
9397
|
const documentElement = document.documentElement;
|
|
@@ -9187,7 +9441,7 @@ async function captureViewport(viewport) {
|
|
|
9187
9441
|
requested: targetUrl,
|
|
9188
9442
|
observed: dom.pathname,
|
|
9189
9443
|
expected_path: expectedPath,
|
|
9190
|
-
matched: dom.pathname
|
|
9444
|
+
matched: routePathMatches(dom.pathname, expectedPath),
|
|
9191
9445
|
http_status: httpStatus,
|
|
9192
9446
|
error: navigationError || waitError || undefined,
|
|
9193
9447
|
},
|
|
@@ -9199,6 +9453,7 @@ async function captureViewport(viewport) {
|
|
|
9199
9453
|
overflow_px: Math.max(0, (dom.scroll_width || 0) - (dom.client_width || viewport.width)),
|
|
9200
9454
|
selectors,
|
|
9201
9455
|
text_matches,
|
|
9456
|
+
setup_action_results: setupActionResults,
|
|
9202
9457
|
screenshot_label: screenshotLabel,
|
|
9203
9458
|
navigation_error: navigationError,
|
|
9204
9459
|
wait_error: waitError,
|
|
@@ -9544,6 +9799,7 @@ function createRiddleApiClient(config = {}) {
|
|
|
9544
9799
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
9545
9800
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
|
9546
9801
|
RIDDLE_PROOF_PROFILE_RESULT_VERSION,
|
|
9802
|
+
RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
|
|
9547
9803
|
RIDDLE_PROOF_PROFILE_STATUSES,
|
|
9548
9804
|
RIDDLE_PROOF_PROFILE_VERSION,
|
|
9549
9805
|
RIDDLE_PROOF_RUN_CARD_VERSION,
|
package/dist/index.d.cts
CHANGED
|
@@ -10,5 +10,5 @@ export { CreateCaptureDiagnosticInput, DEFAULT_DIAGNOSTIC_ARRAY_LIMIT, DEFAULT_D
|
|
|
10
10
|
export { BuildVisualProofSessionInput, RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION, RIDDLE_PROOF_VISUAL_SESSION_VERSION, VisualProofSessionMismatch, buildVisualProofSession, compareVisualProofSessionFingerprint, parseVisualProofSession, visualSessionFingerprint, visualSessionFingerprintBasis } from './proof-session.cjs';
|
|
11
11
|
export { AssessPlayabilityOptions, RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION, RIDDLE_PROOF_PLAYABILITY_VERSION, RiddleProofPlayabilityAssessment, RiddleProofPlayabilityEvidence, assessPlayabilityEvidence, extractPlayabilityEvidence, isRiddleProofPlayabilityMode } from './playability.cjs';
|
|
12
12
|
export { AssessBasicGameplayOptions, AttachBasicGameplayArtifactOptions, BASIC_GAMEPLAY_ACTION_TYPES, BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES, BasicGameplayActionResult, BasicGameplayActionType, BasicGameplayArtifactResolution, BasicGameplayAssessmentSummary, BasicGameplayCanvasState, BasicGameplayCatchRecord, BasicGameplayChangeSummary, BasicGameplayFailureCode, BasicGameplayFixReference, BasicGameplayMetric, BasicGameplayMobileEvidence, BasicGameplayProgressCheckType, BasicGameplayProgressionCheck, BasicGameplayProofArtifact, BasicGameplayRouteReference, BasicGameplaySnapshot, BasicGameplaySuiteFailure, BasicGameplayWarningCode, CreateBasicGameplayCatchSummaryInput, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, RiddleProofBasicGameplayAssessment, RiddleProofBasicGameplayCatchSummary, RiddleProofBasicGameplayEvidence, RiddleProofBasicGameplayRouteAssessment, RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayProgressionCheck, assessBasicGameplayProgressionChecks, assessBasicGameplayRoute, attachBasicGameplayArtifactScreenshotHashes, augmentBasicGameplayAssessmentWithProgressionChecks, compactBasicGameplayText, createBasicGameplayCatchRecords, createBasicGameplayCatchSummary, extractBasicGameplayEvidence, resolveBasicGameplayProgressionCheckWithArtifactScreenshots, sanitizeBasicGameplayJsonString } from './basic-gameplay.cjs';
|
|
13
|
-
export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofProfile, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileResult, RiddleProofProfileRouteEvidence, RiddleProofProfileRunner, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, extractRiddleProofProfileResult, normalizeRiddleProofProfile, profileStatusExitCode, resolveRiddleProofProfileTargetUrl, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.cjs';
|
|
13
|
+
export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofProfile, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileResult, RiddleProofProfileRouteEvidence, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, extractRiddleProofProfileResult, normalizeRiddleProofProfile, profileStatusExitCode, resolveRiddleProofProfileTargetUrl, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.cjs';
|
|
14
14
|
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleClientConfig, RiddleFetch, RiddlePollJobResult, RiddlePreviewDeployResult, RiddleRunScriptInput, RiddleServerPreviewInput, RiddleServerPreviewResult, createRiddleApiClient, deployRiddleStaticPreview, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, riddleRequestJson, runRiddleScript, runRiddleServerPreview } from './riddle-client.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -10,5 +10,5 @@ export { CreateCaptureDiagnosticInput, DEFAULT_DIAGNOSTIC_ARRAY_LIMIT, DEFAULT_D
|
|
|
10
10
|
export { BuildVisualProofSessionInput, RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION, RIDDLE_PROOF_VISUAL_SESSION_VERSION, VisualProofSessionMismatch, buildVisualProofSession, compareVisualProofSessionFingerprint, parseVisualProofSession, visualSessionFingerprint, visualSessionFingerprintBasis } from './proof-session.js';
|
|
11
11
|
export { AssessPlayabilityOptions, RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION, RIDDLE_PROOF_PLAYABILITY_VERSION, RiddleProofPlayabilityAssessment, RiddleProofPlayabilityEvidence, assessPlayabilityEvidence, extractPlayabilityEvidence, isRiddleProofPlayabilityMode } from './playability.js';
|
|
12
12
|
export { AssessBasicGameplayOptions, AttachBasicGameplayArtifactOptions, BASIC_GAMEPLAY_ACTION_TYPES, BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES, BasicGameplayActionResult, BasicGameplayActionType, BasicGameplayArtifactResolution, BasicGameplayAssessmentSummary, BasicGameplayCanvasState, BasicGameplayCatchRecord, BasicGameplayChangeSummary, BasicGameplayFailureCode, BasicGameplayFixReference, BasicGameplayMetric, BasicGameplayMobileEvidence, BasicGameplayProgressCheckType, BasicGameplayProgressionCheck, BasicGameplayProofArtifact, BasicGameplayRouteReference, BasicGameplaySnapshot, BasicGameplaySuiteFailure, BasicGameplayWarningCode, CreateBasicGameplayCatchSummaryInput, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, RiddleProofBasicGameplayAssessment, RiddleProofBasicGameplayCatchSummary, RiddleProofBasicGameplayEvidence, RiddleProofBasicGameplayRouteAssessment, RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayProgressionCheck, assessBasicGameplayProgressionChecks, assessBasicGameplayRoute, attachBasicGameplayArtifactScreenshotHashes, augmentBasicGameplayAssessmentWithProgressionChecks, compactBasicGameplayText, createBasicGameplayCatchRecords, createBasicGameplayCatchSummary, extractBasicGameplayEvidence, resolveBasicGameplayProgressionCheckWithArtifactScreenshots, sanitizeBasicGameplayJsonString } from './basic-gameplay.js';
|
|
13
|
-
export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofProfile, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileResult, RiddleProofProfileRouteEvidence, RiddleProofProfileRunner, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, extractRiddleProofProfileResult, normalizeRiddleProofProfile, profileStatusExitCode, resolveRiddleProofProfileTargetUrl, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.js';
|
|
13
|
+
export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofProfile, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileResult, RiddleProofProfileRouteEvidence, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, extractRiddleProofProfileResult, normalizeRiddleProofProfile, profileStatusExitCode, resolveRiddleProofProfileTargetUrl, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.js';
|
|
14
14
|
export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleClientConfig, RiddleFetch, RiddlePollJobResult, RiddlePreviewDeployResult, RiddleRunScriptInput, RiddleServerPreviewInput, RiddleServerPreviewResult, createRiddleApiClient, deployRiddleStaticPreview, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, riddleRequestJson, runRiddleScript, runRiddleServerPreview } from './riddle-client.js';
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
42
42
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
|
43
43
|
RIDDLE_PROOF_PROFILE_RESULT_VERSION,
|
|
44
|
+
RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
|
|
44
45
|
RIDDLE_PROOF_PROFILE_STATUSES,
|
|
45
46
|
RIDDLE_PROOF_PROFILE_VERSION,
|
|
46
47
|
assessRiddleProofProfileEvidence,
|
|
@@ -55,7 +56,7 @@ import {
|
|
|
55
56
|
resolveRiddleProofProfileTargetUrl,
|
|
56
57
|
slugifyRiddleProofProfileName,
|
|
57
58
|
summarizeRiddleProofProfileResult
|
|
58
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-A7RJZD4I.js";
|
|
59
60
|
import {
|
|
60
61
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
61
62
|
DEFAULT_RIDDLE_API_KEY_FILE,
|
|
@@ -153,6 +154,7 @@ export {
|
|
|
153
154
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
154
155
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
|
155
156
|
RIDDLE_PROOF_PROFILE_RESULT_VERSION,
|
|
157
|
+
RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
|
|
156
158
|
RIDDLE_PROOF_PROFILE_STATUSES,
|
|
157
159
|
RIDDLE_PROOF_PROFILE_VERSION,
|
|
158
160
|
RIDDLE_PROOF_RUN_CARD_VERSION,
|