@riddledc/riddle-proof 0.7.58 → 0.7.59
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 +7 -0
- package/dist/{chunk-7ZBK2GQX.js → chunk-Q5VW6MAP.js} +155 -36
- package/dist/cli.cjs +155 -36
- package/dist/cli.js +1 -1
- package/dist/index.cjs +155 -36
- package/dist/index.js +1 -1
- package/dist/profile.cjs +155 -36
- package/dist/profile.d.cts +2 -0
- package/dist/profile.d.ts +2 -0
- package/dist/profile.js +1 -1
- package/dist/proof-run-engine.d.cts +3 -3
- package/dist/proof-run-engine.d.ts +3 -3
- package/package.json +1 -1
package/dist/profile.cjs
CHANGED
|
@@ -279,6 +279,11 @@ function normalizeSetupAction(input, index) {
|
|
|
279
279
|
if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
280
280
|
const type = normalizeSetupActionType(stringValue(input.type), index);
|
|
281
281
|
const selector = stringValue(input.selector);
|
|
282
|
+
const frameSelector = stringFromOwn(input, "frame_selector", "frameSelector", "iframe_selector", "iframeSelector");
|
|
283
|
+
const frameIndex = numberValue(valueFromOwn(input, "frame_index", "frameIndex", "iframe_index", "iframeIndex"));
|
|
284
|
+
if (frameIndex !== void 0 && (!Number.isInteger(frameIndex) || frameIndex < 0)) {
|
|
285
|
+
throw new Error(`target.setup_actions[${index}].frame_index must be a non-negative integer.`);
|
|
286
|
+
}
|
|
282
287
|
if ((type === "click" || type === "fill" || type === "set_input_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
283
288
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
284
289
|
}
|
|
@@ -331,6 +336,8 @@ function normalizeSetupAction(input, index) {
|
|
|
331
336
|
return {
|
|
332
337
|
type,
|
|
333
338
|
selector,
|
|
339
|
+
frame_selector: frameSelector,
|
|
340
|
+
frame_index: frameIndex,
|
|
334
341
|
force: type === "click" && (input.force === true || input.force_click === true || input.forceClick === true),
|
|
335
342
|
key,
|
|
336
343
|
value,
|
|
@@ -1217,6 +1224,8 @@ function assessSetupActionsFromEvidence(profile, evidence) {
|
|
|
1217
1224
|
viewport: viewport.name,
|
|
1218
1225
|
action: result.action ?? result.type ?? null,
|
|
1219
1226
|
selector: result.selector ?? null,
|
|
1227
|
+
frame_selector: result.frame_selector ?? null,
|
|
1228
|
+
frame_index: result.frame_index ?? null,
|
|
1220
1229
|
reason: result.reason ?? result.error ?? null
|
|
1221
1230
|
});
|
|
1222
1231
|
}
|
|
@@ -1729,10 +1738,12 @@ function assessProfile(profile, evidence) {
|
|
|
1729
1738
|
if (result && result.ok === false) {
|
|
1730
1739
|
failed.push({
|
|
1731
1740
|
viewport: viewport.name,
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1741
|
+
action: result.action || result.type || null,
|
|
1742
|
+
selector: result.selector || null,
|
|
1743
|
+
frame_selector: result.frame_selector || null,
|
|
1744
|
+
frame_index: result.frame_index ?? null,
|
|
1745
|
+
reason: result.reason || result.error || null,
|
|
1746
|
+
});
|
|
1736
1747
|
}
|
|
1737
1748
|
}
|
|
1738
1749
|
if (results.length < actionCount && results.every((result) => !result || result.ok !== false)) {
|
|
@@ -2195,8 +2206,8 @@ function setupJsonValue(value) {
|
|
|
2195
2206
|
function setupValuesEqual(left, right) {
|
|
2196
2207
|
return JSON.stringify(setupJsonValue(left)) === JSON.stringify(setupJsonValue(right));
|
|
2197
2208
|
}
|
|
2198
|
-
async function setupReadWindowValue(path) {
|
|
2199
|
-
return await
|
|
2209
|
+
async function setupReadWindowValue(context, path) {
|
|
2210
|
+
return await context.evaluate(({ path }) => {
|
|
2200
2211
|
const toJsonValue = (value) => {
|
|
2201
2212
|
if (value === null || value === undefined) return null;
|
|
2202
2213
|
if (typeof value === "string" || typeof value === "boolean") return value;
|
|
@@ -2218,6 +2229,80 @@ async function setupReadWindowValue(path) {
|
|
|
2218
2229
|
return { ok: true, value: toJsonValue(current) };
|
|
2219
2230
|
}, { path });
|
|
2220
2231
|
}
|
|
2232
|
+
function setupFrameSelector(action) {
|
|
2233
|
+
return String(action?.frame_selector || action?.frameSelector || action?.iframe_selector || action?.iframeSelector || "").trim();
|
|
2234
|
+
}
|
|
2235
|
+
function setupFrameIndex(action) {
|
|
2236
|
+
const raw = action?.frame_index ?? action?.frameIndex ?? action?.iframe_index ?? action?.iframeIndex ?? 0;
|
|
2237
|
+
const number = Number(raw);
|
|
2238
|
+
return Number.isInteger(number) && number >= 0 ? number : 0;
|
|
2239
|
+
}
|
|
2240
|
+
function setupScopeEvidence(scope) {
|
|
2241
|
+
if (!scope || !scope.frame_selector) return {};
|
|
2242
|
+
return {
|
|
2243
|
+
frame_selector: scope.frame_selector,
|
|
2244
|
+
frame_index: scope.frame_index,
|
|
2245
|
+
frame_count: scope.frame_count,
|
|
2246
|
+
};
|
|
2247
|
+
}
|
|
2248
|
+
function setupScopeFailure(base, scope) {
|
|
2249
|
+
return {
|
|
2250
|
+
...base,
|
|
2251
|
+
...setupScopeEvidence(scope),
|
|
2252
|
+
reason: scope?.reason || "frame_scope_unavailable",
|
|
2253
|
+
error: scope?.error || undefined,
|
|
2254
|
+
};
|
|
2255
|
+
}
|
|
2256
|
+
async function setupActionScope(action, timeout) {
|
|
2257
|
+
const frameSelector = setupFrameSelector(action);
|
|
2258
|
+
if (!frameSelector) return { ok: true, context: page };
|
|
2259
|
+
const frameIndex = setupFrameIndex(action);
|
|
2260
|
+
let frameCount = 0;
|
|
2261
|
+
let locator = null;
|
|
2262
|
+
try {
|
|
2263
|
+
await page.waitForSelector(frameSelector, { state: "attached", timeout });
|
|
2264
|
+
locator = page.locator(frameSelector);
|
|
2265
|
+
frameCount = await locator.count();
|
|
2266
|
+
} catch (error) {
|
|
2267
|
+
return {
|
|
2268
|
+
ok: false,
|
|
2269
|
+
reason: "frame_selector_not_found",
|
|
2270
|
+
frame_selector: frameSelector,
|
|
2271
|
+
frame_index: frameIndex,
|
|
2272
|
+
frame_count: frameCount,
|
|
2273
|
+
error: String(error && error.message ? error.message : error).slice(0, 1000),
|
|
2274
|
+
};
|
|
2275
|
+
}
|
|
2276
|
+
if (!frameCount) {
|
|
2277
|
+
return { ok: false, reason: "frame_selector_not_found", frame_selector: frameSelector, frame_index: frameIndex, frame_count: frameCount };
|
|
2278
|
+
}
|
|
2279
|
+
if (frameIndex >= frameCount) {
|
|
2280
|
+
return { ok: false, reason: "frame_index_out_of_range", frame_selector: frameSelector, frame_index: frameIndex, frame_count: frameCount };
|
|
2281
|
+
}
|
|
2282
|
+
const handle = await locator.nth(frameIndex).elementHandle({ timeout }).catch((error) => ({ __riddle_error: error }));
|
|
2283
|
+
if (!handle || handle.__riddle_error) {
|
|
2284
|
+
return {
|
|
2285
|
+
ok: false,
|
|
2286
|
+
reason: "frame_element_unavailable",
|
|
2287
|
+
frame_selector: frameSelector,
|
|
2288
|
+
frame_index: frameIndex,
|
|
2289
|
+
frame_count: frameCount,
|
|
2290
|
+
error: handle?.__riddle_error ? String(handle.__riddle_error && handle.__riddle_error.message ? handle.__riddle_error.message : handle.__riddle_error).slice(0, 1000) : undefined,
|
|
2291
|
+
};
|
|
2292
|
+
}
|
|
2293
|
+
const frame = typeof handle.contentFrame === "function" ? await handle.contentFrame().catch((error) => ({ __riddle_error: error })) : null;
|
|
2294
|
+
if (!frame || frame.__riddle_error) {
|
|
2295
|
+
return {
|
|
2296
|
+
ok: false,
|
|
2297
|
+
reason: "content_frame_unavailable",
|
|
2298
|
+
frame_selector: frameSelector,
|
|
2299
|
+
frame_index: frameIndex,
|
|
2300
|
+
frame_count: frameCount,
|
|
2301
|
+
error: frame?.__riddle_error ? String(frame.__riddle_error && frame.__riddle_error.message ? frame.__riddle_error.message : frame.__riddle_error).slice(0, 1000) : undefined,
|
|
2302
|
+
};
|
|
2303
|
+
}
|
|
2304
|
+
return { ok: true, context: frame, frame_selector: frameSelector, frame_index: frameIndex, frame_count: frameCount };
|
|
2305
|
+
}
|
|
2221
2306
|
async function setupLocatorText(locator, index) {
|
|
2222
2307
|
return await locator.nth(index).textContent({ timeout: 1000 }).catch(() => "");
|
|
2223
2308
|
}
|
|
@@ -2379,7 +2464,8 @@ async function registerNetworkMocks(mocks) {
|
|
|
2379
2464
|
}
|
|
2380
2465
|
async function executeSetupAction(action, ordinal) {
|
|
2381
2466
|
const type = setupActionType(action);
|
|
2382
|
-
const
|
|
2467
|
+
const frameSelector = setupFrameSelector(action);
|
|
2468
|
+
const base = { ok: false, action: type || "unknown", ordinal, selector: action.selector || null, frame_selector: frameSelector || null };
|
|
2383
2469
|
const timeout = setupNumber(action.timeout_ms, 5000);
|
|
2384
2470
|
try {
|
|
2385
2471
|
if (type === "wait") {
|
|
@@ -2388,51 +2474,65 @@ async function executeSetupAction(action, ordinal) {
|
|
|
2388
2474
|
return { ...base, ok: true, ms };
|
|
2389
2475
|
}
|
|
2390
2476
|
if (type === "wait_for_selector") {
|
|
2391
|
-
await
|
|
2392
|
-
return
|
|
2477
|
+
const scope = await setupActionScope(action, timeout);
|
|
2478
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
2479
|
+
await scope.context.waitForSelector(action.selector, { state: "visible", timeout });
|
|
2480
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, timeout_ms: timeout };
|
|
2393
2481
|
}
|
|
2394
2482
|
if (type === "press") {
|
|
2395
2483
|
const key = String(action.key || "").trim();
|
|
2396
2484
|
if (!key) return { ...base, reason: "missing_key" };
|
|
2485
|
+
const scope = await setupActionScope(action, timeout);
|
|
2486
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
2397
2487
|
if (!action.selector) {
|
|
2398
|
-
|
|
2399
|
-
|
|
2488
|
+
if (scope.frame_selector) {
|
|
2489
|
+
await scope.context.locator("body").press(key, { timeout });
|
|
2490
|
+
} else {
|
|
2491
|
+
await page.keyboard.press(key);
|
|
2492
|
+
}
|
|
2493
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, key };
|
|
2400
2494
|
}
|
|
2401
|
-
const locator =
|
|
2495
|
+
const locator = scope.context.locator(action.selector);
|
|
2402
2496
|
const count = await locator.count();
|
|
2403
2497
|
if (!count) return { ...base, reason: "selector_not_found", count, key };
|
|
2404
2498
|
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
2405
2499
|
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex, key };
|
|
2406
2500
|
await locator.nth(targetIndex).press(key, { timeout });
|
|
2407
|
-
return { ...base, ok: true, count, target_index: targetIndex, key };
|
|
2501
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, key };
|
|
2408
2502
|
}
|
|
2409
2503
|
if (type === "local_storage" || type === "session_storage") {
|
|
2410
2504
|
const value = setupActionValue(action);
|
|
2411
|
-
await
|
|
2505
|
+
const scope = await setupActionScope(action, timeout);
|
|
2506
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
2507
|
+
await scope.context.evaluate(({ type, key, value }) => {
|
|
2412
2508
|
const storage = type === "session_storage" ? window.sessionStorage : window.localStorage;
|
|
2413
2509
|
storage.setItem(key, value);
|
|
2414
2510
|
}, { type, key: action.key, value });
|
|
2415
2511
|
if (action.reload === true) {
|
|
2416
2512
|
await page.reload({ waitUntil: "domcontentloaded", timeout: 45000 });
|
|
2417
2513
|
}
|
|
2418
|
-
return { ...base, ok: true, key: action.key, value_length: value.length, reload: action.reload === true };
|
|
2514
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, key: action.key, value_length: value.length, reload: action.reload === true };
|
|
2419
2515
|
}
|
|
2420
2516
|
if (type === "clear_storage") {
|
|
2421
2517
|
const storage = action.storage || "both";
|
|
2422
|
-
await
|
|
2518
|
+
const scope = await setupActionScope(action, timeout);
|
|
2519
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
2520
|
+
await scope.context.evaluate(({ storage }) => {
|
|
2423
2521
|
if (storage === "local" || storage === "both") window.localStorage.clear();
|
|
2424
2522
|
if (storage === "session" || storage === "both") window.sessionStorage.clear();
|
|
2425
2523
|
}, { storage });
|
|
2426
2524
|
if (action.reload === true) {
|
|
2427
2525
|
await page.reload({ waitUntil: "domcontentloaded", timeout: 45000 });
|
|
2428
2526
|
}
|
|
2429
|
-
return { ...base, ok: true, storage, reload: action.reload === true };
|
|
2527
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, storage, reload: action.reload === true };
|
|
2430
2528
|
}
|
|
2431
2529
|
if (type === "window_call") {
|
|
2432
2530
|
const path = String(action.path || action.function_path || action.functionPath || "");
|
|
2433
2531
|
const args = Array.isArray(action.args) ? action.args : [];
|
|
2434
2532
|
if (!path) return { ...base, path, reason: "missing_path" };
|
|
2435
|
-
const
|
|
2533
|
+
const scope = await setupActionScope(action, timeout);
|
|
2534
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
2535
|
+
const result = await scope.context.evaluate(async ({ path, args }) => {
|
|
2436
2536
|
const toJsonValue = (value) => {
|
|
2437
2537
|
if (value === null || value === undefined) return null;
|
|
2438
2538
|
if (typeof value === "string" || typeof value === "boolean") return value;
|
|
@@ -2472,6 +2572,7 @@ async function executeSetupAction(action, ordinal) {
|
|
|
2472
2572
|
const expectationMet = !hasExpectation || setupValuesEqual(result.returned, expected);
|
|
2473
2573
|
return {
|
|
2474
2574
|
...base,
|
|
2575
|
+
...setupScopeEvidence(scope),
|
|
2475
2576
|
ok: Boolean(result.ok && expectationMet),
|
|
2476
2577
|
path,
|
|
2477
2578
|
arg_count: args.length,
|
|
@@ -2502,13 +2603,16 @@ async function executeSetupAction(action, ordinal) {
|
|
|
2502
2603
|
: action.expect;
|
|
2503
2604
|
if (!path) return { ...base, path, reason: "missing_path" };
|
|
2504
2605
|
if (!hasExpected) return { ...base, path, reason: "missing_expected_value" };
|
|
2606
|
+
const scope = await setupActionScope(action, timeout);
|
|
2607
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
2505
2608
|
const startedAt = Date.now();
|
|
2506
2609
|
let result = null;
|
|
2507
2610
|
while (Date.now() - startedAt <= timeout) {
|
|
2508
|
-
result = await setupReadWindowValue(path);
|
|
2611
|
+
result = await setupReadWindowValue(scope.context, path);
|
|
2509
2612
|
if (result.ok && setupValuesEqual(result.value, expected)) {
|
|
2510
2613
|
return {
|
|
2511
2614
|
...base,
|
|
2615
|
+
...setupScopeEvidence(scope),
|
|
2512
2616
|
ok: true,
|
|
2513
2617
|
path,
|
|
2514
2618
|
value: setupJsonValue(result.value),
|
|
@@ -2520,6 +2624,7 @@ async function executeSetupAction(action, ordinal) {
|
|
|
2520
2624
|
}
|
|
2521
2625
|
return {
|
|
2522
2626
|
...base,
|
|
2627
|
+
...setupScopeEvidence(scope),
|
|
2523
2628
|
path,
|
|
2524
2629
|
reason: result?.ok ? "unexpected_value" : result?.reason || "path_not_found",
|
|
2525
2630
|
missing_part: result?.missing_part || undefined,
|
|
@@ -2536,11 +2641,13 @@ async function executeSetupAction(action, ordinal) {
|
|
|
2536
2641
|
const hasExpected = expected !== undefined;
|
|
2537
2642
|
if (!path) return { ...base, path, reason: "missing_path" };
|
|
2538
2643
|
if (!hasExpected && minValue === undefined && maxValue === undefined) return { ...base, path, reason: "missing_number_expectation" };
|
|
2644
|
+
const scope = await setupActionScope(action, timeout);
|
|
2645
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
2539
2646
|
const startedAt = Date.now();
|
|
2540
2647
|
let result = null;
|
|
2541
2648
|
let lastReason = "path_not_found";
|
|
2542
2649
|
while (Date.now() - startedAt <= timeout) {
|
|
2543
|
-
result = await setupReadWindowValue(path);
|
|
2650
|
+
result = await setupReadWindowValue(scope.context, path);
|
|
2544
2651
|
if (result.ok) {
|
|
2545
2652
|
const actual = setupFiniteNumber(result.value);
|
|
2546
2653
|
if (actual === undefined) {
|
|
@@ -2554,6 +2661,7 @@ async function executeSetupAction(action, ordinal) {
|
|
|
2554
2661
|
} else {
|
|
2555
2662
|
return {
|
|
2556
2663
|
...base,
|
|
2664
|
+
...setupScopeEvidence(scope),
|
|
2557
2665
|
ok: true,
|
|
2558
2666
|
path,
|
|
2559
2667
|
value: actual,
|
|
@@ -2570,6 +2678,7 @@ async function executeSetupAction(action, ordinal) {
|
|
|
2570
2678
|
}
|
|
2571
2679
|
return {
|
|
2572
2680
|
...base,
|
|
2681
|
+
...setupScopeEvidence(scope),
|
|
2573
2682
|
path,
|
|
2574
2683
|
reason: lastReason,
|
|
2575
2684
|
missing_part: result?.missing_part || undefined,
|
|
@@ -2581,7 +2690,9 @@ async function executeSetupAction(action, ordinal) {
|
|
|
2581
2690
|
};
|
|
2582
2691
|
}
|
|
2583
2692
|
if (type === "click") {
|
|
2584
|
-
const
|
|
2693
|
+
const scope = await setupActionScope(action, timeout);
|
|
2694
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
2695
|
+
const locator = scope.context.locator(action.selector);
|
|
2585
2696
|
const count = await locator.count();
|
|
2586
2697
|
if (!count) return { ...base, reason: "selector_not_found", count };
|
|
2587
2698
|
let targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
@@ -2613,33 +2724,39 @@ async function executeSetupAction(action, ordinal) {
|
|
|
2613
2724
|
? { timeout, noWaitAfter: true, force: true }
|
|
2614
2725
|
: { timeout, noWaitAfter: true };
|
|
2615
2726
|
await locator.nth(targetIndex).click(clickOptions);
|
|
2616
|
-
return { ...base, ok: true, count, target_index: targetIndex, text: matchedText, force: action.force === true || undefined };
|
|
2727
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, text: matchedText, force: action.force === true || undefined };
|
|
2617
2728
|
}
|
|
2618
2729
|
if (type === "fill" || type === "set_input_value") {
|
|
2619
|
-
const
|
|
2730
|
+
const scope = await setupActionScope(action, timeout);
|
|
2731
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
2732
|
+
const locator = scope.context.locator(action.selector);
|
|
2620
2733
|
const count = await locator.count();
|
|
2621
2734
|
if (!count) return { ...base, reason: "selector_not_found", count };
|
|
2622
2735
|
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
2623
2736
|
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex };
|
|
2624
2737
|
const value = setupActionValue(action);
|
|
2625
2738
|
await locator.nth(targetIndex).fill(value, { timeout });
|
|
2626
|
-
return { ...base, ok: true, count, target_index: targetIndex, value_length: value.length };
|
|
2739
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, value_length: value.length };
|
|
2627
2740
|
}
|
|
2628
2741
|
if (type === "assert_selector_count") {
|
|
2629
|
-
const
|
|
2742
|
+
const scope = await setupActionScope(action, timeout);
|
|
2743
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
2744
|
+
const locator = scope.context.locator(action.selector);
|
|
2630
2745
|
const expectedCount = setupNumber(action.expected_count, -1);
|
|
2631
2746
|
if (!Number.isInteger(expectedCount) || expectedCount < 0) return { ...base, reason: "invalid_expected_count", expected_count: action.expected_count };
|
|
2632
2747
|
const startedAt = Date.now();
|
|
2633
2748
|
let count = 0;
|
|
2634
2749
|
while (Date.now() - startedAt <= timeout) {
|
|
2635
2750
|
count = await locator.count().catch(() => 0);
|
|
2636
|
-
if (count === expectedCount) return { ...base, ok: true, count, expected_count: expectedCount, timeout_ms: timeout };
|
|
2751
|
+
if (count === expectedCount) return { ...base, ...setupScopeEvidence(scope), ok: true, count, expected_count: expectedCount, timeout_ms: timeout };
|
|
2637
2752
|
await page.waitForTimeout(100);
|
|
2638
2753
|
}
|
|
2639
|
-
return { ...base, reason: "selector_count_mismatch", count, expected_count: expectedCount, timeout_ms: timeout };
|
|
2754
|
+
return { ...base, ...setupScopeEvidence(scope), reason: "selector_count_mismatch", count, expected_count: expectedCount, timeout_ms: timeout };
|
|
2640
2755
|
}
|
|
2641
2756
|
if (type === "wait_for_text") {
|
|
2642
|
-
const
|
|
2757
|
+
const scope = await setupActionScope(action, timeout);
|
|
2758
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
2759
|
+
const locator = scope.context.locator(action.selector);
|
|
2643
2760
|
const startedAt = Date.now();
|
|
2644
2761
|
let lastText = "";
|
|
2645
2762
|
while (Date.now() - startedAt <= timeout) {
|
|
@@ -2648,15 +2765,17 @@ async function executeSetupAction(action, ordinal) {
|
|
|
2648
2765
|
const text = await setupLocatorText(locator, index);
|
|
2649
2766
|
lastText = text || lastText;
|
|
2650
2767
|
if (setupTextMatches(text, action)) {
|
|
2651
|
-
return { ...base, ok: true, text: compactSetupResultText(text), target_index: index, timeout_ms: timeout };
|
|
2768
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, text: compactSetupResultText(text), target_index: index, timeout_ms: timeout };
|
|
2652
2769
|
}
|
|
2653
2770
|
}
|
|
2654
2771
|
await page.waitForTimeout(100);
|
|
2655
2772
|
}
|
|
2656
|
-
return { ...base, reason: "text_not_found", text: compactSetupResultText(lastText), timeout_ms: timeout };
|
|
2773
|
+
return { ...base, ...setupScopeEvidence(scope), reason: "text_not_found", text: compactSetupResultText(lastText), timeout_ms: timeout };
|
|
2657
2774
|
}
|
|
2658
2775
|
if (type === "assert_text_visible" || type === "assert_text_absent") {
|
|
2659
|
-
const
|
|
2776
|
+
const scope = await setupActionScope(action, timeout);
|
|
2777
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
2778
|
+
const locator = scope.context.locator(action.selector);
|
|
2660
2779
|
const startedAt = Date.now();
|
|
2661
2780
|
let lastText = "";
|
|
2662
2781
|
let matchedText = "";
|
|
@@ -2675,7 +2794,7 @@ async function executeSetupAction(action, ordinal) {
|
|
|
2675
2794
|
if (type === "assert_text_visible") {
|
|
2676
2795
|
const visible = await setupLocatorVisible(locator, index);
|
|
2677
2796
|
if (visible) {
|
|
2678
|
-
return { ...base, ok: true, count, text: compactSetupResultText(text), target_index: index, timeout_ms: timeout };
|
|
2797
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, count, text: compactSetupResultText(text), target_index: index, timeout_ms: timeout };
|
|
2679
2798
|
}
|
|
2680
2799
|
hiddenMatch = true;
|
|
2681
2800
|
break;
|
|
@@ -2684,17 +2803,17 @@ async function executeSetupAction(action, ordinal) {
|
|
|
2684
2803
|
}
|
|
2685
2804
|
}
|
|
2686
2805
|
if (type === "assert_text_absent" && !matched) {
|
|
2687
|
-
return { ...base, ok: true, count, timeout_ms: timeout };
|
|
2806
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, count, timeout_ms: timeout };
|
|
2688
2807
|
}
|
|
2689
2808
|
await page.waitForTimeout(100);
|
|
2690
2809
|
}
|
|
2691
2810
|
if (type === "assert_text_visible") {
|
|
2692
2811
|
if (hiddenMatch) {
|
|
2693
|
-
return { ...base, reason: "matching_element_not_visible", text: compactSetupResultText(matchedText), timeout_ms: timeout };
|
|
2812
|
+
return { ...base, ...setupScopeEvidence(scope), reason: "matching_element_not_visible", text: compactSetupResultText(matchedText), timeout_ms: timeout };
|
|
2694
2813
|
}
|
|
2695
|
-
return { ...base, reason: "text_not_found", text: compactSetupResultText(lastText), timeout_ms: timeout };
|
|
2814
|
+
return { ...base, ...setupScopeEvidence(scope), reason: "text_not_found", text: compactSetupResultText(lastText), timeout_ms: timeout };
|
|
2696
2815
|
}
|
|
2697
|
-
return { ...base, reason: "text_still_present", text: compactSetupResultText(matchedText || lastText), timeout_ms: timeout };
|
|
2816
|
+
return { ...base, ...setupScopeEvidence(scope), reason: "text_still_present", text: compactSetupResultText(matchedText || lastText), timeout_ms: timeout };
|
|
2698
2817
|
}
|
|
2699
2818
|
return { ...base, reason: "unsupported_action" };
|
|
2700
2819
|
} catch (error) {
|
package/dist/profile.d.cts
CHANGED
package/dist/profile.d.ts
CHANGED
package/dist/profile.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
resolveRiddleProofProfileTimeoutSec,
|
|
20
20
|
slugifyRiddleProofProfileName,
|
|
21
21
|
summarizeRiddleProofProfileResult
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-Q5VW6MAP.js";
|
|
23
23
|
export {
|
|
24
24
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
25
25
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
|
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
292
292
|
blocking?: boolean;
|
|
293
293
|
details?: Record<string, unknown>;
|
|
294
294
|
ok: boolean;
|
|
295
|
-
action: "
|
|
295
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
296
296
|
state_path: string;
|
|
297
297
|
stage: any;
|
|
298
298
|
summary: string;
|
|
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
382
382
|
continueWithStage?: WorkflowStage | null;
|
|
383
383
|
blocking?: boolean;
|
|
384
384
|
details?: Record<string, unknown>;
|
|
385
|
-
action: "
|
|
385
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
386
386
|
state_path: string;
|
|
387
387
|
stage: any;
|
|
388
388
|
checkpoint: string;
|
|
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
659
659
|
error?: undefined;
|
|
660
660
|
} | {
|
|
661
661
|
ok: boolean;
|
|
662
|
-
action: "
|
|
662
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
663
663
|
state_path: string;
|
|
664
664
|
stage: any;
|
|
665
665
|
summary: string;
|
|
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
292
292
|
blocking?: boolean;
|
|
293
293
|
details?: Record<string, unknown>;
|
|
294
294
|
ok: boolean;
|
|
295
|
-
action: "
|
|
295
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
296
296
|
state_path: string;
|
|
297
297
|
stage: any;
|
|
298
298
|
summary: string;
|
|
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
382
382
|
continueWithStage?: WorkflowStage | null;
|
|
383
383
|
blocking?: boolean;
|
|
384
384
|
details?: Record<string, unknown>;
|
|
385
|
-
action: "
|
|
385
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
386
386
|
state_path: string;
|
|
387
387
|
stage: any;
|
|
388
388
|
checkpoint: string;
|
|
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
659
659
|
error?: undefined;
|
|
660
660
|
} | {
|
|
661
661
|
ok: boolean;
|
|
662
|
-
action: "
|
|
662
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
663
663
|
state_path: string;
|
|
664
664
|
stage: any;
|
|
665
665
|
summary: string;
|