@testver/testver 1.3.0 → 1.3.2
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/dist/index.js +297 -26
- package/package.json +1 -1
- package/src/ui/static/assets/index-Bt4_s1e0.css +7 -0
- package/src/ui/static/assets/{index-i3ftmi0U.js → index-C9pBWd6z.js} +543 -543
- package/src/ui/static/assets/{index-oqs-F2Xl.js → index-Dy7b6SNH.js} +1 -1
- package/src/ui/static/index.html +2 -2
- package/src/ui/static/assets/index-DMd4ynKJ.css +0 -7
package/dist/index.js
CHANGED
|
@@ -25431,6 +25431,12 @@ function reEsc(s) {
|
|
|
25431
25431
|
function escFor(v, quote) {
|
|
25432
25432
|
return v.replace(/\\/g, "\\\\").split(quote).join("\\" + quote);
|
|
25433
25433
|
}
|
|
25434
|
+
function jsLiteral(v) {
|
|
25435
|
+
if (!v.includes("'")) return `'${escFor(v, "'")}'`;
|
|
25436
|
+
if (!v.includes('"')) return `"${escFor(v, '"')}"`;
|
|
25437
|
+
if (!v.includes("`") && !v.includes("${")) return `\`${escFor(v, "`")}\``;
|
|
25438
|
+
return `'${escFor(v, "'")}'`;
|
|
25439
|
+
}
|
|
25434
25440
|
function quotedForms(prefixes, value, label4, suffix = "", holds2) {
|
|
25435
25441
|
const out = [];
|
|
25436
25442
|
for (const q6 of QUOTES2) {
|
|
@@ -25768,8 +25774,12 @@ function renderSite(site, newValue) {
|
|
|
25768
25774
|
for (const e of edits) out = out.slice(0, e.start) + e.text + out.slice(e.end);
|
|
25769
25775
|
return out;
|
|
25770
25776
|
}
|
|
25777
|
+
const s = site.find;
|
|
25778
|
+
if (site.encode !== "xml" && site.quoted && site.quote === "'" && newValue.includes("'") && !newValue.includes('"') && s[site.valueStart - 1] === "'" && s[site.valueEnd] === "'") {
|
|
25779
|
+
return `${s.slice(0, site.valueStart - 1)}"${escFor(newValue, '"')}"${s.slice(site.valueEnd + 1)}`;
|
|
25780
|
+
}
|
|
25771
25781
|
const v = site.encode === "xml" ? xmlEsc(newValue) : site.quoted ? escFor(newValue, site.quote) : newValue;
|
|
25772
|
-
return
|
|
25782
|
+
return s.slice(0, site.valueStart) + v + s.slice(site.valueEnd);
|
|
25773
25783
|
}
|
|
25774
25784
|
function androidIdName(raw) {
|
|
25775
25785
|
return /^[\w.]+:id\/(.+)$/.exec(raw)?.[1];
|
|
@@ -25787,7 +25797,7 @@ function replacementFor(site, b, p2) {
|
|
|
25787
25797
|
const close = site.find.indexOf(")", site.valueEnd);
|
|
25788
25798
|
const callStart = site.find.lastIndexOf("getByTestId");
|
|
25789
25799
|
if (callStart >= 0 && close >= 0) {
|
|
25790
|
-
return site.find.slice(0, callStart) + `locator(
|
|
25800
|
+
return site.find.slice(0, callStart) + `locator(${jsLiteral(p2.value)})` + site.find.slice(close + 1);
|
|
25791
25801
|
}
|
|
25792
25802
|
}
|
|
25793
25803
|
if (b.strategy === "css" && b.kind === "testid" && p2.valueIsName && b.hint) {
|
|
@@ -25863,6 +25873,9 @@ function renameMatch(oldValue, candidates, codeLine) {
|
|
|
25863
25873
|
const same4 = pool.filter((v) => hashStem(v) === stem3);
|
|
25864
25874
|
if (same4.length === 1) return { value: same4[0], score: 0.9, via: "rename" };
|
|
25865
25875
|
}
|
|
25876
|
+
const ws = wrapperSibling(oldValue, pool);
|
|
25877
|
+
if (ws === "ambiguous") return null;
|
|
25878
|
+
if (ws) return { value: ws, score: 0.85, via: "rename" };
|
|
25866
25879
|
const a = oldValue.toLowerCase();
|
|
25867
25880
|
const scored = pool.map((v) => ({ v, score: idSimilarity(a, v.toLowerCase()) })).filter((s) => s.score >= 0.55).sort((x, y) => y.score - x.score);
|
|
25868
25881
|
if (scored.length > 0) {
|
|
@@ -25889,6 +25902,23 @@ function renameMatch(oldValue, candidates, codeLine) {
|
|
|
25889
25902
|
}
|
|
25890
25903
|
return null;
|
|
25891
25904
|
}
|
|
25905
|
+
function wrapperSibling(oldValue, pool) {
|
|
25906
|
+
const cut = Math.max(oldValue.lastIndexOf("-"), oldValue.lastIndexOf("_"));
|
|
25907
|
+
if (cut <= 0 || cut === oldValue.length - 1) return null;
|
|
25908
|
+
const stem3 = oldValue.slice(0, cut), sep9 = oldValue[cut], word = oldValue.slice(cut + 1);
|
|
25909
|
+
if (stem3.length < 3 || /[-_]/.test(word) || !pool.includes(stem3)) return null;
|
|
25910
|
+
const set = new Set(pool);
|
|
25911
|
+
const winners = [];
|
|
25912
|
+
for (const v of pool) {
|
|
25913
|
+
if (!v.startsWith(stem3 + sep9)) continue;
|
|
25914
|
+
const w2 = v.slice(stem3.length + 1);
|
|
25915
|
+
if (!w2 || w2 === word || /[-_]/.test(w2)) continue;
|
|
25916
|
+
const repeated = pool.some((x) => x !== stem3 && !x.endsWith(sep9 + w2) && set.has(`${x}${sep9}${w2}`));
|
|
25917
|
+
if (repeated) winners.push(v);
|
|
25918
|
+
}
|
|
25919
|
+
if (winners.length === 0) return null;
|
|
25920
|
+
return winners.length === 1 ? winners[0] : "ambiguous";
|
|
25921
|
+
}
|
|
25892
25922
|
function jaccard(a, b) {
|
|
25893
25923
|
let inter = 0;
|
|
25894
25924
|
for (const t of a) if (b.has(t)) inter++;
|
|
@@ -26162,6 +26192,7 @@ function tierTemplateFamily(broken, elements) {
|
|
|
26162
26192
|
if (j < 0) continue;
|
|
26163
26193
|
const a2 = c2.slice(0, j), b2 = c2.slice(j + dyn.length);
|
|
26164
26194
|
if (a2 === a && b2 === b) continue;
|
|
26195
|
+
if (a2 === "" && b2 === "") continue;
|
|
26165
26196
|
const key2 = `${a2}\0${b2}`;
|
|
26166
26197
|
if (families.has(key2)) continue;
|
|
26167
26198
|
const re = new RegExp(`^${esc2(a2)}(.+)${esc2(b2)}$`);
|
|
@@ -26206,7 +26237,7 @@ function deterministicFromElements(broken, elements, codeLine) {
|
|
|
26206
26237
|
return null;
|
|
26207
26238
|
}
|
|
26208
26239
|
}
|
|
26209
|
-
function tierRecordedFallback(broken, entries, elements) {
|
|
26240
|
+
function tierRecordedFallback(broken, entries, elements, take) {
|
|
26210
26241
|
const matchesBroken = (l) => {
|
|
26211
26242
|
const v = String(l.value || "");
|
|
26212
26243
|
if (!v) return false;
|
|
@@ -26219,21 +26250,30 @@ function tierRecordedFallback(broken, entries, elements) {
|
|
|
26219
26250
|
const locs = (entry2.locators ?? []).filter((l) => l.value);
|
|
26220
26251
|
if (!locs.some(matchesBroken)) continue;
|
|
26221
26252
|
const alternatives = locs.filter((l) => !matchesBroken(l)).sort((a, b) => (b.confidence ?? 0) - (a.confidence ?? 0));
|
|
26253
|
+
const reanchor = broken.method === "getByTestId";
|
|
26222
26254
|
for (const alt of alternatives) {
|
|
26223
|
-
const value = mapToStrategy(broken, String(alt.strategy || ""), String(alt.value));
|
|
26255
|
+
const value = reanchor ? mapToLocator(String(alt.strategy || ""), String(alt.value)) : mapToStrategy(broken, String(alt.strategy || ""), String(alt.value));
|
|
26224
26256
|
if (!value) continue;
|
|
26225
26257
|
if (elements.length > 0 && !evidenceSupports(value, broken, elements)) continue;
|
|
26226
|
-
|
|
26258
|
+
const prop = {
|
|
26227
26259
|
value,
|
|
26228
26260
|
valueIsName: broken.strategy === "id" || broken.strategy === "name" || broken.strategy === "accessibility-id",
|
|
26261
|
+
...reanchor ? { reanchor: true } : {},
|
|
26229
26262
|
source: "recorded-fallback",
|
|
26230
26263
|
confidence: Math.min(0.9, alt.confidence ?? 0.7),
|
|
26231
26264
|
rationale: `The recorder saved "${alt.value}" as the next-best locator for this step${entry2.description ? ` (${entry2.description})` : ""}${elements.length ? ", and it matches an element on the page" : ""}.`
|
|
26232
26265
|
};
|
|
26266
|
+
if (!take || take(prop)) return prop;
|
|
26233
26267
|
}
|
|
26234
26268
|
}
|
|
26235
26269
|
return null;
|
|
26236
26270
|
}
|
|
26271
|
+
function mapToLocator(altStrategy, altValue) {
|
|
26272
|
+
const s = altStrategy.toLowerCase();
|
|
26273
|
+
if (s === "css") return altValue;
|
|
26274
|
+
if (s === "xpath" && /^(?:\(|\.?\/)/.test(altValue)) return altValue;
|
|
26275
|
+
return null;
|
|
26276
|
+
}
|
|
26237
26277
|
function mapToStrategy(broken, altStrategy, altValue) {
|
|
26238
26278
|
const s = altStrategy.toLowerCase();
|
|
26239
26279
|
switch (broken.strategy) {
|
|
@@ -26727,6 +26767,19 @@ var init_failure_analyzer = __esm({
|
|
|
26727
26767
|
\u2022 Scroll it into view, or use { force: true } only when the cover is expected`
|
|
26728
26768
|
};
|
|
26729
26769
|
}
|
|
26770
|
+
if (/locator resolved to/i.test(lower) && /intercepts pointer events|element is not enabled|element is not editable/i.test(lower)) {
|
|
26771
|
+
const covered = /intercepts pointer events/i.test(lower);
|
|
26772
|
+
return {
|
|
26773
|
+
category: "test-issue",
|
|
26774
|
+
signal: "element-interaction",
|
|
26775
|
+
rootCause: covered ? "The element was found, but another element on top of it (an overlay, modal, cookie banner or sticky header) took every click." : "The element was found, but it stayed disabled (or read-only) for the whole wait, so the action never happened.",
|
|
26776
|
+
suggestedFix: covered ? `\u2022 Close or wait out the overlay / modal / banner covering it
|
|
26777
|
+
\u2022 Wait for the page to finish what opened it (an animation, a loading state)
|
|
26778
|
+
\u2022 Use { force: true } only when the cover is expected and harmless` : `\u2022 Do what enables it first (fill the required fields, accept the terms\u2026)
|
|
26779
|
+
\u2022 Wait for the page's loading state to end before the action
|
|
26780
|
+
\u2022 Check the locator picks the enabled element, not a disabled twin`
|
|
26781
|
+
};
|
|
26782
|
+
}
|
|
26730
26783
|
if (/element not interactable|elementnotinteractable|element is not reachable by keyboard/i.test(lower)) {
|
|
26731
26784
|
return {
|
|
26732
26785
|
category: "test-issue",
|
|
@@ -28153,6 +28206,7 @@ function intentConflict(p2, broken, elements, intent) {
|
|
|
28153
28206
|
if (intent.kinds && targets.every((t) => !fitsKinds(t, intent.kinds))) {
|
|
28154
28207
|
return `the code uses it as a ${kindName(intent.kinds)} (${intent.kindEvidence}), but ${describeEl(targets[0])} is not one`;
|
|
28155
28208
|
}
|
|
28209
|
+
if (p2.source === "recorded-fallback") return null;
|
|
28156
28210
|
const claims = targets.map((t) => claimedBy(t, intent));
|
|
28157
28211
|
if (claims.every(Boolean)) return `${describeEl(targets[0])} is already used by ${claims[0]}`;
|
|
28158
28212
|
return null;
|
|
@@ -28599,6 +28653,16 @@ function locateSites(projectPath2, tiers, preferredFiles, display, opts = {}) {
|
|
|
28599
28653
|
return text3 === null ? [] : findSitesInText(text3, matchers, rel.replace(/\\/g, "/"));
|
|
28600
28654
|
};
|
|
28601
28655
|
const pick = (file, hits) => pickByFrames(projectPath2, file, hits, frames);
|
|
28656
|
+
for (const f of frames) {
|
|
28657
|
+
const onLine = [];
|
|
28658
|
+
for (const matchers of tiers) {
|
|
28659
|
+
for (const s of hitsIn(f.file, matchers)) {
|
|
28660
|
+
if (s.line === f.line && !onLine.some((o) => o.file === s.file && o.valueStart === s.valueStart && o.find === s.find)) onLine.push(s);
|
|
28661
|
+
}
|
|
28662
|
+
if (onLine.length > 0) break;
|
|
28663
|
+
}
|
|
28664
|
+
if (onLine.length === 1) return { sites: onLine };
|
|
28665
|
+
}
|
|
28602
28666
|
for (const matchers of tiers) {
|
|
28603
28667
|
const own = [];
|
|
28604
28668
|
for (const f of [...new Set(preferredFiles.filter(Boolean))]) {
|
|
@@ -31681,6 +31745,7 @@ var auto_heal_service_exports = {};
|
|
|
31681
31745
|
__export(auto_heal_service_exports, {
|
|
31682
31746
|
_drainAutoHeal: () => _drainAutoHeal,
|
|
31683
31747
|
couldHealRun: () => couldHealRun,
|
|
31748
|
+
findKeptFixFor: () => findKeptFixFor,
|
|
31684
31749
|
gotFurther: () => gotFurther,
|
|
31685
31750
|
initAutoHeal: () => initAutoHeal,
|
|
31686
31751
|
isHealBusy: () => isHealBusy,
|
|
@@ -31689,7 +31754,8 @@ __export(auto_heal_service_exports, {
|
|
|
31689
31754
|
recordRejectedFix: () => recordRejectedFix,
|
|
31690
31755
|
refreshSummary: () => refreshSummary,
|
|
31691
31756
|
traceWrittenDuring: () => traceWrittenDuring,
|
|
31692
|
-
triggerAutoHeal: () => triggerAutoHeal
|
|
31757
|
+
triggerAutoHeal: () => triggerAutoHeal,
|
|
31758
|
+
waitForParentRun: () => waitForParentRun
|
|
31693
31759
|
});
|
|
31694
31760
|
import { existsSync as existsSync52, mkdirSync as mkdirSync18, readFileSync as readFileSync47, writeFileSync as writeFileSync16, readdirSync as readdirSync29 } from "fs";
|
|
31695
31761
|
import { dirname as dirname21, join as join52 } from "path";
|
|
@@ -31883,6 +31949,20 @@ ${stack}`.slice(0, 3e3), lines);
|
|
|
31883
31949
|
}
|
|
31884
31950
|
return { candidates: candidates.slice(0, MAX_LOCATOR_CANDIDATES), frames };
|
|
31885
31951
|
}
|
|
31952
|
+
async function waitForParentRun(parentRunId, maxMs = PARENT_WAIT_MS, pollMs = PARENT_POLL_MS) {
|
|
31953
|
+
const until = Date.now() + maxMs;
|
|
31954
|
+
let logged = false;
|
|
31955
|
+
while (Date.now() < until) {
|
|
31956
|
+
const parent = deps?.resultsStore.getRun(parentRunId);
|
|
31957
|
+
if (!parent || parent.status !== "running") return;
|
|
31958
|
+
touchPending(parentRunId);
|
|
31959
|
+
if (!logged) {
|
|
31960
|
+
console.log(`[auto-heal] waiting for suite run ${parentRunId} to finish before healing its failed tests`);
|
|
31961
|
+
logged = true;
|
|
31962
|
+
}
|
|
31963
|
+
await new Promise((r) => setTimeout(r, pollMs));
|
|
31964
|
+
}
|
|
31965
|
+
}
|
|
31886
31966
|
async function healRun(runId, cfg) {
|
|
31887
31967
|
const { projectPath: projectPath2, resultsStore: resultsStore4 } = deps;
|
|
31888
31968
|
const run2 = resultsStore4.getRun(runId);
|
|
@@ -31890,6 +31970,7 @@ async function healRun(runId, cfg) {
|
|
|
31890
31970
|
if (run2.origin === "auto-heal" || run2.origin === "ai-fix") return;
|
|
31891
31971
|
const failed = run2.tests.filter((t) => t.status === "failed" || t.status === "error");
|
|
31892
31972
|
if (failed.length === 0) return;
|
|
31973
|
+
if (run2.parentRunId) await waitForParentRun(run2.parentRunId);
|
|
31893
31974
|
const effectiveMode = await resolveEffectiveMode(run2, cfg);
|
|
31894
31975
|
if (effectiveMode === "off") {
|
|
31895
31976
|
stampSkip(
|
|
@@ -31983,6 +32064,10 @@ async function findFix(run2, cfg, candidates, ev, spendAttempt) {
|
|
|
31983
32064
|
if (loc.reason) locateReasons.push(loc.reason);
|
|
31984
32065
|
}
|
|
31985
32066
|
if (!located) {
|
|
32067
|
+
if (ev.initial) {
|
|
32068
|
+
const kept = findKeptFixFor(run2, candidates);
|
|
32069
|
+
if (kept) return { kept };
|
|
32070
|
+
}
|
|
31986
32071
|
const resolved = candidates[0] ? ` The failing value was ${displayLocator(candidates[0])}.` : "";
|
|
31987
32072
|
return {
|
|
31988
32073
|
skip: `${locateReasons[0] ?? "The broken locator could not be found in the code."}${resolved} Dynamic or data-driven locators need a human decision \u2014 use "Fix in AI Assistant".`
|
|
@@ -32011,11 +32096,25 @@ async function findFix(run2, cfg, candidates, ev, spendAttempt) {
|
|
|
32011
32096
|
const intentRejections = [];
|
|
32012
32097
|
const accept = (p2, elements) => {
|
|
32013
32098
|
if (!p2) return false;
|
|
32099
|
+
if (rejectedNote) return false;
|
|
32014
32100
|
const problem = dialectProblem(p2.value, broken, dialect);
|
|
32015
32101
|
if (problem) {
|
|
32016
32102
|
console.log(`[auto-heal] '${rep.name}': rejected ${p2.source} proposal \u2014 ${problem}`);
|
|
32017
32103
|
return false;
|
|
32018
32104
|
}
|
|
32105
|
+
const dup = sites.find((s) => {
|
|
32106
|
+
const r = replacementFor(s, broken, p2);
|
|
32107
|
+
if (r === s.find) return false;
|
|
32108
|
+
try {
|
|
32109
|
+
return readFileSync47(join52(projectPath2, s.file), "utf8").includes(r);
|
|
32110
|
+
} catch {
|
|
32111
|
+
return false;
|
|
32112
|
+
}
|
|
32113
|
+
});
|
|
32114
|
+
if (dup) {
|
|
32115
|
+
console.log(`[auto-heal] '${rep.name}': rejected ${p2.source} proposal \u2014 '${p2.value}' already appears in ${dup.file}, so the edit could not be undone exactly`);
|
|
32116
|
+
return false;
|
|
32117
|
+
}
|
|
32019
32118
|
if (bareValueOnly && !p2.valueIsName) {
|
|
32020
32119
|
console.log(`[auto-heal] '${rep.name}': rejected ${p2.source} proposal \u2014 the code passes only a test id to a helper, and '${p2.value}' is a selector`);
|
|
32021
32120
|
return false;
|
|
@@ -32024,6 +32123,10 @@ async function findFix(run2, cfg, candidates, ev, spendAttempt) {
|
|
|
32024
32123
|
console.log(`[auto-heal] '${rep.name}': rejected ${p2.source} proposal \u2014 '${p2.value}' cannot be expressed in the template`);
|
|
32025
32124
|
return false;
|
|
32026
32125
|
}
|
|
32126
|
+
if (sites.some((s) => s.template && p2.value === s.template.dyn)) {
|
|
32127
|
+
console.log(`[auto-heal] '${rep.name}': rejected ${p2.source} proposal \u2014 '${p2.value}' is only the template's dynamic part`);
|
|
32128
|
+
return false;
|
|
32129
|
+
}
|
|
32027
32130
|
if (isRejectedFix(sites, broken, p2)) {
|
|
32028
32131
|
rejectedNote ??= `the fix found ("${p2.value}") is one you undid before, so it will not be applied again`;
|
|
32029
32132
|
return false;
|
|
@@ -32057,7 +32160,7 @@ async function findFix(run2, cfg, candidates, ev, spendAttempt) {
|
|
|
32057
32160
|
...loadRecordedEntries(projectPath2, [...preferredFiles, ...sites.map((s) => s.file)])
|
|
32058
32161
|
];
|
|
32059
32162
|
if (recorded.length > 0) {
|
|
32060
|
-
|
|
32163
|
+
tierRecordedFallback(broken, recorded, failurePageElements.length ? failurePageElements : traceElements, (p2) => accept(p2, traceElements));
|
|
32061
32164
|
}
|
|
32062
32165
|
if (!proposal && snapshotMd) accept(tier1Match(broken, parseAriaSnapshot(snapshotMd), dialect), traceElements);
|
|
32063
32166
|
for (const els of [failurePageElements, traceElements]) {
|
|
@@ -32084,7 +32187,7 @@ async function findFix(run2, cfg, candidates, ev, spendAttempt) {
|
|
|
32084
32187
|
}
|
|
32085
32188
|
}
|
|
32086
32189
|
if (!proposal && recorded.length > 0 && captureElements.length > 0) {
|
|
32087
|
-
|
|
32190
|
+
tierRecordedFallback(broken, recorded, captureElements, (p2) => accept(p2, captureElements));
|
|
32088
32191
|
}
|
|
32089
32192
|
}
|
|
32090
32193
|
if (!proposal) {
|
|
@@ -32295,6 +32398,10 @@ async function healUnit(run2, unit, cfg, snapshotByTest) {
|
|
|
32295
32398
|
stampSkip(run2.runId, names, first.skip);
|
|
32296
32399
|
return;
|
|
32297
32400
|
}
|
|
32401
|
+
if ("kept" in first) {
|
|
32402
|
+
await confirmKeptFix(run2, tests, unit.frames, first.kept);
|
|
32403
|
+
return;
|
|
32404
|
+
}
|
|
32298
32405
|
spendAttempt();
|
|
32299
32406
|
const fixes = [];
|
|
32300
32407
|
const applyFix = (fix) => {
|
|
@@ -32414,6 +32521,32 @@ ${f.test.stackTrace || ""}`;
|
|
|
32414
32521
|
rationale: stamp2.rationale
|
|
32415
32522
|
})).catch((err5) => console.error("[notify] Auto-heal notification failed:", err5));
|
|
32416
32523
|
}
|
|
32524
|
+
async function confirmKeptFix(run2, tests, frames, kept) {
|
|
32525
|
+
const names = tests.map((t) => t.name);
|
|
32526
|
+
const by = `the verified heal of "${kept.testName}" (${kept.stamp.from} \u2192 ${kept.stamp.to})`;
|
|
32527
|
+
console.log(`[auto-heal] run ${run2.runId}: ${names.length} test(s) failed on a locator already fixed by ${by} \u2014 re-running them with the fix`);
|
|
32528
|
+
let v;
|
|
32529
|
+
try {
|
|
32530
|
+
v = await verifyTests(tests, run2, frames);
|
|
32531
|
+
} catch (err5) {
|
|
32532
|
+
stampSkip(run2.runId, names, `The locator was already fixed by ${by}, but re-running this test with that fix hit an error: ${err5.message}`);
|
|
32533
|
+
return;
|
|
32534
|
+
}
|
|
32535
|
+
if (!v.passed) {
|
|
32536
|
+
stampSkip(run2.runId, names, `The locator was already fixed by ${by}, but this test still failed when re-run with that fix (${v.failedTest}). Nothing was changed \u2014 use "Fix in AI Assistant".`);
|
|
32537
|
+
return;
|
|
32538
|
+
}
|
|
32539
|
+
stampTests(run2, names, {
|
|
32540
|
+
...kept.stamp,
|
|
32541
|
+
state: "healed",
|
|
32542
|
+
verifyRunId: v.verifyRunId ?? kept.stamp.verifyRunId,
|
|
32543
|
+
rationale: `Already fixed in the code by ${by}; this test was re-run with that fix and passed. ${kept.stamp.rationale ?? ""}`.trim(),
|
|
32544
|
+
revertReason: void 0,
|
|
32545
|
+
partialNote: void 0,
|
|
32546
|
+
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
32547
|
+
});
|
|
32548
|
+
console.log(`[auto-heal] run ${run2.runId}: healed (${names.length} test(s) verified against the fix already in the code)`);
|
|
32549
|
+
}
|
|
32417
32550
|
async function verifyTests(tests, run2, frames) {
|
|
32418
32551
|
let verifyRunId;
|
|
32419
32552
|
for (const t of tests) {
|
|
@@ -32609,6 +32742,47 @@ function findPendingSuggestion(sites) {
|
|
|
32609
32742
|
}
|
|
32610
32743
|
return null;
|
|
32611
32744
|
}
|
|
32745
|
+
function findKeptFixFor(run2, candidates) {
|
|
32746
|
+
const { resultsStore: resultsStore4, projectPath: projectPath2 } = deps;
|
|
32747
|
+
const started = Date.parse(run2.startTime || "");
|
|
32748
|
+
if (!Number.isFinite(started)) return null;
|
|
32749
|
+
const values = candidates.flatMap((c2) => [c2.raw, c2.hint]).filter((v) => !!v && v.length >= 3);
|
|
32750
|
+
if (values.length === 0) return null;
|
|
32751
|
+
const quoted = values.map((v) => new RegExp(`(^|[^\\w-])${v.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}($|[^\\w-])`));
|
|
32752
|
+
const fileCache = /* @__PURE__ */ new Map();
|
|
32753
|
+
const fileText = (rel) => {
|
|
32754
|
+
if (!fileCache.has(rel)) {
|
|
32755
|
+
try {
|
|
32756
|
+
fileCache.set(rel, readFileSync47(join52(projectPath2, rel), "utf8"));
|
|
32757
|
+
} catch {
|
|
32758
|
+
fileCache.set(rel, null);
|
|
32759
|
+
}
|
|
32760
|
+
}
|
|
32761
|
+
return fileCache.get(rel);
|
|
32762
|
+
};
|
|
32763
|
+
const pool = [];
|
|
32764
|
+
const parent = run2.parentRunId ? resultsStore4.getRun(run2.parentRunId) : void 0;
|
|
32765
|
+
if (parent) pool.push(parent);
|
|
32766
|
+
try {
|
|
32767
|
+
pool.push(...resultsStore4.getRunHistory(200, 0).runs);
|
|
32768
|
+
} catch {
|
|
32769
|
+
}
|
|
32770
|
+
for (const r of pool) {
|
|
32771
|
+
if (r.runId === run2.runId) continue;
|
|
32772
|
+
for (const t of r.tests) {
|
|
32773
|
+
const s = t.autoHeal;
|
|
32774
|
+
if (s?.state !== "healed" || !s.pairs?.length) continue;
|
|
32775
|
+
if (!(Date.parse(s.at) > started)) continue;
|
|
32776
|
+
if (!s.pairs.some((p2) => quoted.some((re) => re.test(p2.find)))) continue;
|
|
32777
|
+
if (!s.pairs.every((p2) => {
|
|
32778
|
+
const text3 = fileText(p2.file);
|
|
32779
|
+
return text3 !== null && text3.includes(p2.replace);
|
|
32780
|
+
})) continue;
|
|
32781
|
+
return { stamp: s, testName: t.name };
|
|
32782
|
+
}
|
|
32783
|
+
}
|
|
32784
|
+
return null;
|
|
32785
|
+
}
|
|
32612
32786
|
function flipIdenticalSuggestions(targets) {
|
|
32613
32787
|
const { resultsStore: resultsStore4 } = deps;
|
|
32614
32788
|
const want = targets.map((t) => `${t.file}|${t.find}|${t.replace}`).sort().join("\n");
|
|
@@ -32803,6 +32977,8 @@ async function runViaRunner(command, label4, original, opts = {}) {
|
|
|
32803
32977
|
if (opts.trace && /\bpytest\b/.test(command) && !/--tracing\b/.test(command) && usesPytestPlaywright()) {
|
|
32804
32978
|
command = `${command} --tracing retain-on-failure`;
|
|
32805
32979
|
}
|
|
32980
|
+
const parent = original.parentRunId ? resultsStore4.getRun(original.parentRunId) : void 0;
|
|
32981
|
+
const cloudFrom = original.source === "cloud" ? original : parent?.source === "cloud" ? parent : void 0;
|
|
32806
32982
|
try {
|
|
32807
32983
|
const res = await fetch(`${base}/api/runner/run`, {
|
|
32808
32984
|
method: "POST",
|
|
@@ -32813,9 +32989,9 @@ async function runViaRunner(command, label4, original, opts = {}) {
|
|
|
32813
32989
|
origin: "auto-heal",
|
|
32814
32990
|
label: label4,
|
|
32815
32991
|
headless: true,
|
|
32816
|
-
browser: original.targetBrowser || void 0,
|
|
32817
|
-
environment: original.targetEnvironment || void 0,
|
|
32818
|
-
cloudProvider:
|
|
32992
|
+
browser: original.targetBrowser || parent?.targetBrowser || void 0,
|
|
32993
|
+
environment: original.targetEnvironment || parent?.targetEnvironment || void 0,
|
|
32994
|
+
cloudProvider: cloudFrom?.cloudProvider
|
|
32819
32995
|
})
|
|
32820
32996
|
});
|
|
32821
32997
|
if (!res.ok) return { runId: null, passed: false };
|
|
@@ -32847,7 +33023,7 @@ async function runViaRunner(command, label4, original, opts = {}) {
|
|
|
32847
33023
|
return { runId: null, passed: false };
|
|
32848
33024
|
}
|
|
32849
33025
|
}
|
|
32850
|
-
var VERIFY_TIMEOUT_MS, VERIFY_POLL_MS, MAX_UNITS_PER_RUN, MAX_QUEUE, MAX_LOCATOR_CANDIDATES, deps, chain, queued, busy, pendingHeals, PENDING_STALE_MS, CATEGORY_EXPLAIN, MAX_CHAIN, LOCATOR_FAILURE, WAITISH, sourceFilesCache, PLAYWRIGHT_CONFIGS;
|
|
33026
|
+
var VERIFY_TIMEOUT_MS, VERIFY_POLL_MS, MAX_UNITS_PER_RUN, MAX_QUEUE, MAX_LOCATOR_CANDIDATES, deps, chain, queued, busy, pendingHeals, PENDING_STALE_MS, CATEGORY_EXPLAIN, MAX_CHAIN, LOCATOR_FAILURE, WAITISH, sourceFilesCache, PARENT_WAIT_MS, PARENT_POLL_MS, PLAYWRIGHT_CONFIGS;
|
|
32851
33027
|
var init_auto_heal_service = __esm({
|
|
32852
33028
|
"src/ui/services/auto-heal-service.ts"() {
|
|
32853
33029
|
"use strict";
|
|
@@ -32885,6 +33061,8 @@ var init_auto_heal_service = __esm({
|
|
|
32885
33061
|
LOCATOR_FAILURE = /no such element|unable to locate|could not be located|not found|never found|waiting for (?:locator|selector|getBy|get_by|element)|located by|still not (?:displayed|existing)|wasn't found|received: <element\(s\) not found>|strict mode violation|does not match any element|did not match any elements|did not appear in|resolved to 0 elements/i;
|
|
32886
33062
|
WAITISH = /wait|until|expected condition|located|timed out|timeout|did not appear/i;
|
|
32887
33063
|
sourceFilesCache = null;
|
|
33064
|
+
PARENT_WAIT_MS = 3 * 60 * 6e4;
|
|
33065
|
+
PARENT_POLL_MS = 3e3;
|
|
32888
33066
|
PLAYWRIGHT_CONFIGS = ["playwright.config.ts", "playwright.config.js", "playwright.config.mjs", "playwright.config.cjs", "playwright.config.mts"];
|
|
32889
33067
|
}
|
|
32890
33068
|
});
|
|
@@ -36632,6 +36810,38 @@ ${modified.map((f) => ` - ${f}`).join("\n")}`;
|
|
|
36632
36810
|
}
|
|
36633
36811
|
});
|
|
36634
36812
|
|
|
36813
|
+
// src/browser/secret-field.ts
|
|
36814
|
+
function secretKindFromHints(h) {
|
|
36815
|
+
const type = (h.type || "").toLowerCase();
|
|
36816
|
+
const ac = (h.autocomplete || "").toLowerCase();
|
|
36817
|
+
if (type === "password" || /\b(current|new)-password\b/.test(ac)) return "password";
|
|
36818
|
+
if (ac === "one-time-code") return "one-time code";
|
|
36819
|
+
const text3 = h.text || "";
|
|
36820
|
+
if (OTP_HINT.test(text3)) return "one-time code";
|
|
36821
|
+
if (PASSWORD_HINT.test(text3)) return "password";
|
|
36822
|
+
return null;
|
|
36823
|
+
}
|
|
36824
|
+
function secretKindFromSelector(selector) {
|
|
36825
|
+
if (!selector) return null;
|
|
36826
|
+
if (/type\s*=\s*["']?password/i.test(selector)) return "password";
|
|
36827
|
+
return secretKindFromHints({ text: selector.replace(/[[\]"'=#.:()-]/g, " ") });
|
|
36828
|
+
}
|
|
36829
|
+
function typedTextForDisplay(args2) {
|
|
36830
|
+
if (typeof args2.text !== "string") return void 0;
|
|
36831
|
+
if (args2.secret === true) return HIDDEN_VALUE;
|
|
36832
|
+
if (secretKindFromSelector(typeof args2.selector === "string" ? args2.selector : void 0)) return HIDDEN_VALUE;
|
|
36833
|
+
return args2.text;
|
|
36834
|
+
}
|
|
36835
|
+
var OTP_HINT, PASSWORD_HINT, HIDDEN_VALUE;
|
|
36836
|
+
var init_secret_field = __esm({
|
|
36837
|
+
"src/browser/secret-field.ts"() {
|
|
36838
|
+
"use strict";
|
|
36839
|
+
OTP_HINT = /\b(otp|totp|2fa|mfa|one[\s_-]?time|verification[\s_-]?code|auth(entication)?[\s_-]?code|security[\s_-]?code)\b/i;
|
|
36840
|
+
PASSWORD_HINT = /password|passwd|passcode|\bpwd\b|\bpass\b/i;
|
|
36841
|
+
HIDDEN_VALUE = "\u2022\u2022\u2022\u2022\u2022\u2022 (hidden)";
|
|
36842
|
+
}
|
|
36843
|
+
});
|
|
36844
|
+
|
|
36635
36845
|
// src/core/tools/browser.ts
|
|
36636
36846
|
function resolveTarget(manager, args2) {
|
|
36637
36847
|
const ref = typeof args2.ref === "string" && args2.ref.trim() ? args2.ref.trim() : void 0;
|
|
@@ -36777,6 +36987,7 @@ var browserLaunchTool, browserNavigateTool, browserClickTool, browserTypeTool, b
|
|
|
36777
36987
|
var init_browser = __esm({
|
|
36778
36988
|
"src/core/tools/browser.ts"() {
|
|
36779
36989
|
"use strict";
|
|
36990
|
+
init_secret_field();
|
|
36780
36991
|
browserLaunchTool = {
|
|
36781
36992
|
category: "browser",
|
|
36782
36993
|
definition: {
|
|
@@ -36947,14 +37158,15 @@ Page title: ${title}`;
|
|
|
36947
37158
|
category: "browser",
|
|
36948
37159
|
definition: {
|
|
36949
37160
|
name: "browser_type",
|
|
36950
|
-
description:
|
|
37161
|
+
description: 'Type text into an input field. Prefer passing `ref` from the latest browser_snapshot \u2014 fall back to `selector` only when needed. **Passwords and one-time codes:** to sign someone in while exploring, hand the browser over with browser_auth_state action "await_login" and let them type it. Type a password or code yourself only when the user gave it to you for this sign-in \u2014 never one you found in project files, test helpers, comments or fixtures. Set `secret: true` when you do, and never repeat a password, code or token in your reply, in a file, or in test code (tests read secrets from environment variables).',
|
|
36951
37162
|
parameters: {
|
|
36952
37163
|
type: "object",
|
|
36953
37164
|
properties: {
|
|
36954
37165
|
ref: { type: "string", description: 'Element ref ID from the latest browser_snapshot (e.g. "e3"). Preferred.' },
|
|
36955
37166
|
selector: { type: "string", description: "CSS selector for the input element. Use only when no ref is available." },
|
|
36956
37167
|
text: { type: "string", description: "Text to type" },
|
|
36957
|
-
clear: { type: "boolean", description: "Clear the field before typing (default: true)" }
|
|
37168
|
+
clear: { type: "boolean", description: "Clear the field before typing (default: true)" },
|
|
37169
|
+
secret: { type: "boolean", description: "true when the text is a password, one-time code or other secret. The value is then never shown in the chat, the result or the logs. Password and code fields are detected too." }
|
|
36958
37170
|
},
|
|
36959
37171
|
required: ["text"]
|
|
36960
37172
|
}
|
|
@@ -36963,6 +37175,7 @@ Page title: ${title}`;
|
|
|
36963
37175
|
const manager = ctx._browserManager;
|
|
36964
37176
|
if (!manager) throw new Error("No browser manager available");
|
|
36965
37177
|
const { selector, displayTarget } = resolveTarget(manager, args2);
|
|
37178
|
+
const secretKind = (typeof manager.secretFieldKind === "function" ? await manager.secretFieldKind(selector).catch(() => null) : null) ?? secretKindFromSelector(selector) ?? (args2.secret === true ? "password" : null);
|
|
36966
37179
|
try {
|
|
36967
37180
|
const result = await manager.type(
|
|
36968
37181
|
selector,
|
|
@@ -36972,12 +37185,15 @@ Page title: ${title}`;
|
|
|
36972
37185
|
if (!result.success) throw new Error(result.error || "Type failed");
|
|
36973
37186
|
const url = await manager.getUrl().catch(() => "unknown");
|
|
36974
37187
|
const title = await manager.getTitle().catch(() => "unknown");
|
|
36975
|
-
let msg = `Typed
|
|
37188
|
+
let msg = secretKind ? `Typed the ${secretKind} into ${displayTarget} (value hidden)
|
|
37189
|
+
Current URL: ${url}
|
|
37190
|
+
Page title: ${title}
|
|
37191
|
+
\u26A0 This is a ${secretKind} field. Never repeat the value in your reply, in a file, or in test code \u2014 tests read it from an environment variable.` : `Typed "${args2.text}" into ${displayTarget}
|
|
36976
37192
|
Current URL: ${url}
|
|
36977
37193
|
Page title: ${title}`;
|
|
36978
37194
|
if (result.note) msg += `
|
|
36979
37195
|
\u26A0 ${result.note}`;
|
|
36980
|
-
const typedPreview = String(args2.text || "").slice(0, 40);
|
|
37196
|
+
const typedPreview = secretKind ? HIDDEN_VALUE : String(args2.text || "").slice(0, 40);
|
|
36981
37197
|
recordStep(ctx, { tool: "browser_type", target: displayTarget, outcome: "ok", details: `value="${typedPreview}"` }, url);
|
|
36982
37198
|
return await appendFreshSnapshot(manager, msg);
|
|
36983
37199
|
} catch (err5) {
|
|
@@ -37566,7 +37782,7 @@ ${lines.join("\n")}`;
|
|
|
37566
37782
|
category: "browser",
|
|
37567
37783
|
definition: {
|
|
37568
37784
|
name: "browser_auth_state",
|
|
37569
|
-
description: 'Save, list, or remove a logged-in browser session so later runs do not need a human to log in again. **To get a human to log in, navigate to the login page and then call action "await_login"** \u2014 that call PAUSES you and shows the user a "sign in, then click Continue" prompt; it returns only once they have. Do NOT ask them in prose and end your turn, and never ask for a password in chat. Use "check" FIRST, so you never ask for a login you already hold. To REUSE a saved session, pass `authRole` to browser_launch \u2014 a session can only be restored when the browser starts, never injected into a running one. "save" captures the current session directly, for when the page is already authenticated. The saved state holds live session cookies and is encrypted at rest; it is never shown to you or the user.',
|
|
37785
|
+
description: 'Save, list, or remove a logged-in browser session so later runs do not need a human to log in again. **To get a human to log in, navigate to the login page and then call action "await_login"** \u2014 that call PAUSES you and shows the user a "sign in, then click Continue" prompt; it returns only once they have. Do NOT ask them in prose and end your turn, and never ask for a password in chat. This holds for every later sign-in in the run too, such as re-checking a login flow before writing tests: never type a role\'s password or one-time code yourself because you found it in the project (test helpers, comments, fixtures), and never repeat one in your reply or in a file. Use "check" FIRST, so you never ask for a login you already hold. To REUSE a saved session, pass `authRole` to browser_launch \u2014 a session can only be restored when the browser starts, never injected into a running one. "save" captures the current session directly, for when the page is already authenticated. The saved state holds live session cookies and is encrypted at rest; it is never shown to you or the user.',
|
|
37570
37786
|
parameters: {
|
|
37571
37787
|
type: "object",
|
|
37572
37788
|
properties: {
|
|
@@ -72285,6 +72501,18 @@ var init_knowledge_retrieval = __esm({
|
|
|
72285
72501
|
// src/core/tools/testver.ts
|
|
72286
72502
|
import { existsSync as existsSync59, readFileSync as readFileSync52 } from "fs";
|
|
72287
72503
|
import { isAbsolute as isAbsolute18, join as join60 } from "path";
|
|
72504
|
+
function findMappedTestCase(scriptPath, testName) {
|
|
72505
|
+
if (!tmStore || !scriptPath) return null;
|
|
72506
|
+
const norm8 = (p2) => p2.replace(/\\/g, "/").replace(/^\.\//, "").trim().toLowerCase();
|
|
72507
|
+
const want = norm8(scriptPath);
|
|
72508
|
+
const name2 = testName.trim().toLowerCase();
|
|
72509
|
+
try {
|
|
72510
|
+
const hits = tmStore.listScriptMappings().filter((m) => (norm8(m.scriptPath) === want || norm8(m.scriptPath).endsWith("/" + want) || want.endsWith("/" + norm8(m.scriptPath))) && (!name2 || (m.testName || "").trim().toLowerCase() === name2));
|
|
72511
|
+
return hits[0]?.testCaseId ?? null;
|
|
72512
|
+
} catch {
|
|
72513
|
+
return null;
|
|
72514
|
+
}
|
|
72515
|
+
}
|
|
72288
72516
|
function initTestverTool(store4) {
|
|
72289
72517
|
tmStore = store4;
|
|
72290
72518
|
}
|
|
@@ -72811,7 +73039,7 @@ var init_testver2 = __esm({
|
|
|
72811
73039
|
testverTool = {
|
|
72812
73040
|
definition: {
|
|
72813
73041
|
name: "testver",
|
|
72814
|
-
description: 'Access Testver platform data and operations. Query test cases, defects, test plans, execution results, coverage stats, analytics, sources, and more. Actions: query_test_cases, get_test_case, create_test_case, update_test_case, query_defects, create_defect, update_defect, query_plans, get_plan_details, get_cycle_results, get_execution_history, get_coverage_stats, get_health_score, get_analytics, get_automation_stats, dashboard, query_sources, get_source_content, add_source, search_knowledge, list_folders, list_tags, query_requirements, list_connectors, list_quality_gates. **After you write an automation test and it PASSES, record it here**: create_test_case with the steps, `automationStatus: "automated"`, `scriptPath` (+ `testName`, `framework`) and `requirementId` when one applies. A passing test with no test case is invisible to Test Management, coverage, and reporting. Create it after the test is green, never before.',
|
|
73042
|
+
description: 'Access Testver platform data and operations. Query test cases, defects, test plans, execution results, coverage stats, analytics, sources, and more. Actions: query_test_cases, get_test_case, create_test_case, update_test_case, query_defects, create_defect, update_defect, query_plans, get_plan_details, get_cycle_results, get_execution_history, get_coverage_stats, get_health_score, get_analytics, get_automation_stats, dashboard, query_sources, get_source_content, add_source, search_knowledge, list_folders, list_tags, query_requirements, list_connectors, list_quality_gates. **After you write an automation test and it PASSES, record it here**: create_test_case with the steps, `automationStatus: "automated"`, `scriptPath` (+ `testName`, `framework`) and `requirementId` when one applies. A passing test with no test case is invisible to Test Management, coverage, and reporting. Create it after the test is green, never before. **create_defect only when the user asked you to file that defect.** Findings you noticed yourself \u2014 an exploration run, a failing test, a document mismatch \u2014 are proposals: report them and let the user promote the ones they accept.',
|
|
72815
73043
|
parameters: {
|
|
72816
73044
|
type: "object",
|
|
72817
73045
|
properties: {
|
|
@@ -77070,7 +77298,7 @@ function findPrivilegeInversions(access) {
|
|
|
77070
77298
|
}
|
|
77071
77299
|
return out;
|
|
77072
77300
|
}
|
|
77073
|
-
function renderExploreReport(runDir, runId, projectPath2 = runDir) {
|
|
77301
|
+
function renderExploreReport(runDir, runId, projectPath2 = runDir, lookupCase = () => null) {
|
|
77074
77302
|
const plan = readJson(join65(runDir, "plan.json")) ?? {};
|
|
77075
77303
|
const tests = asArray(readJson(join65(runDir, "tests.json")), "tests");
|
|
77076
77304
|
const queue2 = asArray(readJson(join65(runDir, "automation-queue.json")), "queue");
|
|
@@ -77113,9 +77341,14 @@ Target: ${target2}${environment ? ` (${environment})` : ""} \xB7 Run: \`${runId}
|
|
|
77113
77341
|
const header2 = withRequirements ? "| # | Scenario | Test case | Spec \xB7 test | Verified | Status | Requirement |" : "| # | Scenario | Test case | Spec \xB7 test | Verified | Status |";
|
|
77114
77342
|
const rule = withRequirements ? "|---|----------|-----------|-------------|----------|--------|-------------|" : "|---|----------|-----------|-------------|----------|--------|";
|
|
77115
77343
|
out.push(header2, rule);
|
|
77344
|
+
const notes = [];
|
|
77116
77345
|
tests.forEach((t, i) => {
|
|
77117
77346
|
const spec = t.specPath ? `\`${cell(t.specPath)}\`${t.testName ? ` \xB7 "${cell(t.testName)}"` : ""}` : "\u2014";
|
|
77118
|
-
const
|
|
77347
|
+
const recordedId = String(t.testCaseId ?? "").trim();
|
|
77348
|
+
const id = TC_ID.test(recordedId) ? recordedId : t.specPath ? lookupCase(t.specPath, t.testName ?? "") : null;
|
|
77349
|
+
const note2 = [t.note, recordedId && !TC_ID.test(recordedId) ? recordedId : ""].map((x) => String(x ?? "").trim()).filter(Boolean).join(" ");
|
|
77350
|
+
if (note2) notes.push(`${i + 1}. ${cell(note2)}`);
|
|
77351
|
+
const tc = id ? cell(id) : "\u2014 (no test case)";
|
|
77119
77352
|
const row = [
|
|
77120
77353
|
String(i + 1),
|
|
77121
77354
|
cell(t.scenario),
|
|
@@ -77127,6 +77360,10 @@ Target: ${target2}${environment ? ` (${environment})` : ""} \xB7 Run: \`${runId}
|
|
|
77127
77360
|
if (withRequirements) row.push(cell(t.requirementId));
|
|
77128
77361
|
out.push(`| ${row.join(" | ")} |`);
|
|
77129
77362
|
});
|
|
77363
|
+
if (notes.length > 0) {
|
|
77364
|
+
out.push("");
|
|
77365
|
+
out.push(`**Notes** \u2014 ${notes.join(" \xB7 ")}`);
|
|
77366
|
+
}
|
|
77130
77367
|
}
|
|
77131
77368
|
out.push("");
|
|
77132
77369
|
const done2 = new Set(
|
|
@@ -77229,10 +77466,11 @@ Target: ${target2}${environment ? ` (${environment})` : ""} \xB7 Run: \`${runId}
|
|
|
77229
77466
|
out.push("");
|
|
77230
77467
|
return { markdown: out.join("\n"), testCount: tests.length, findingCount: findings.length };
|
|
77231
77468
|
}
|
|
77232
|
-
var REACH_CELL, SEVERITY_ORDER, NAV_CALL, exploreReportTool, exploreReportTools;
|
|
77469
|
+
var REACH_CELL, SEVERITY_ORDER, NAV_CALL, TC_ID, exploreReportTool, exploreReportTools;
|
|
77233
77470
|
var init_explore_report = __esm({
|
|
77234
77471
|
"src/core/tools/explore-report.ts"() {
|
|
77235
77472
|
"use strict";
|
|
77473
|
+
init_testver2();
|
|
77236
77474
|
REACH_CELL = {
|
|
77237
77475
|
ok: "\u2705",
|
|
77238
77476
|
blocked: "\u{1F6AB}",
|
|
@@ -77241,11 +77479,12 @@ var init_explore_report = __esm({
|
|
|
77241
77479
|
};
|
|
77242
77480
|
SEVERITY_ORDER = ["blocker", "critical", "major", "access", "minor", "trivial", "drift"];
|
|
77243
77481
|
NAV_CALL = /\b(?:page\.goto|cy\.visit|driver\.get|browser\.url|page\.navigate)\s*\(/g;
|
|
77482
|
+
TC_ID = /^TC-\d+$/i;
|
|
77244
77483
|
exploreReportTool = {
|
|
77245
77484
|
category: "testver",
|
|
77246
77485
|
definition: {
|
|
77247
77486
|
name: "explore_report",
|
|
77248
|
-
description: 'Render the final report for an Explore & Automate run, as tables, from the run artifacts you recorded. **Call this at the END of every exploration run instead of writing the summary yourself** \u2014 it builds the automated-tests table (scenario, test case id, spec \xB7 test, verified count, status), the findings table (deduplicated, worst first) and the coverage table from `tests.json` / `findings.json` / `coverage.json`, and writes `report.md` into the run folder. For a MULTI-ROLE run it also renders the access matrix from `access.json` (`{ roles: [least\u2026most privileged], entries: [{ template, title, byRole: { role: "ok"|"blocked"|"error" } }] }`) and derives privilege inversions \u2014 pages a lower-privileged role can reach and a higher one cannot \u2014 into the findings table. Record the matrix as you walk each role; the comparison is arithmetic and is done here, not by you. It also reads `automation-queue.json` (`[{ id, scenario, pageId, priority, status }]`) and lists any journey still `pending` \u2014 every explored journey belongs in that queue, and priority sets the order you work in, never which journeys get a test. If the pending section appears, the run is unfinished: keep working the queue rather than asking the user whether the remaining modules are wanted. Present what it returns to the user as-is, then add only what it cannot know: what you did not do and why. It reads recorded facts, so anything you did not write to those files will not appear \u2014 record each test as you finish it rather than reconstructing the run from memory at the end.',
|
|
77487
|
+
description: 'Render the final report for an Explore & Automate run, as tables, from the run artifacts you recorded. **Call this at the END of every exploration run instead of writing the summary yourself** \u2014 it builds the automated-tests table (scenario, test case id, spec \xB7 test, verified count, status), the findings table (deduplicated, worst first) and the coverage table from `tests.json` / `findings.json` / `coverage.json`, and writes `report.md` into the run folder. For a MULTI-ROLE run it also renders the access matrix from `access.json` (`{ roles: [least\u2026most privileged], entries: [{ template, title, byRole: { role: "ok"|"blocked"|"error" } }] }`) and derives privilege inversions \u2014 pages a lower-privileged role can reach and a higher one cannot \u2014 into the findings table. Record the matrix as you walk each role; the comparison is arithmetic and is done here, not by you. A role that is turned away \u2014 an "Access denied" / 403 page, or a redirect to sign-in \u2014 is `blocked`; `error` is only for a page that broke (5xx, crash, blank). `findings.json` is `{ findings: [{ title, severity, page, count, evidence?, drift? }] }`: a mismatch between a document the user gave you and the app is `drift: true` \u2014 possible spec drift, not a confirmed defect. Findings are proposals: never file them as defects yourself (no `create_defect`) \u2014 the report tells the user to promote the ones they accept. It also reads `automation-queue.json` (`[{ id, scenario, pageId, priority, status }]`) and lists any journey still `pending` \u2014 every explored journey belongs in that queue, and priority sets the order you work in, never which journeys get a test. If the pending section appears, the run is unfinished: keep working the queue rather than asking the user whether the remaining modules are wanted. Present what it returns to the user as-is, then add only what it cannot know: what you did not do and why. It reads recorded facts, so anything you did not write to those files will not appear \u2014 record each test as you finish it rather than reconstructing the run from memory at the end.',
|
|
77249
77488
|
parameters: {
|
|
77250
77489
|
type: "object",
|
|
77251
77490
|
properties: {
|
|
@@ -77273,7 +77512,7 @@ var init_explore_report = __esm({
|
|
|
77273
77512
|
if (!existsSync64(join65(runDir, "tests.json"))) {
|
|
77274
77513
|
return `Run "${runId}" has no tests.json, so there is nothing to tabulate. Write one entry per test as you finish it \u2014 { scenario, testCaseId, specPath, testName, runs: { passed, total }, status, requirementId? } \u2014 then call this again. Do NOT hand-write the report instead.`;
|
|
77275
77514
|
}
|
|
77276
|
-
const { markdown, testCount, findingCount } = renderExploreReport(runDir, runId, projectPath2);
|
|
77515
|
+
const { markdown, testCount, findingCount } = renderExploreReport(runDir, runId, projectPath2, findMappedTestCase);
|
|
77277
77516
|
let wrote = "";
|
|
77278
77517
|
if (args2.write !== false) {
|
|
77279
77518
|
try {
|
|
@@ -82881,6 +83120,7 @@ Then echo back the plan as one block and wait for a single yes. **Do not open a
|
|
|
82881
83120
|
- Read what it returns. It refuses to save a login that did not take (still on a login URL, or no cookies). If it refuses, look at the page and tell the user what you see \u2014 never continue as if the role were authenticated.
|
|
82882
83121
|
- **Guest run:** proceed, and treat what is reachable without logging in as a finding in its own right.
|
|
82883
83122
|
- Credentials for GENERATED TESTS come from environment variable names the user supplies \u2014 never inline a secret in code.
|
|
83123
|
+
- **The user types every password and one-time code.** Never type one yourself because you found it in the project (test helpers, comments, fixtures, seed data) \u2014 not at the start, not later to re-check a login flow. Never repeat a credential in chat, plan.json, findings, the report or a code comment.
|
|
82884
83124
|
|
|
82885
83125
|
## 4. Explore loop
|
|
82886
83126
|
Per page: arrive \u2192 read the snapshot the action already returned \u2192 \`browser_page_issues\` \u2192 append \`pages/<id>.json\` \u2192 enqueue in-scope links \u2192 checkpoint \`frontier.json\`.
|
|
@@ -89456,7 +89696,7 @@ var init_project_scanner = __esm({
|
|
|
89456
89696
|
const entries = readdirSync36(fullPath, { withFileTypes: true });
|
|
89457
89697
|
for (const entry2 of entries) {
|
|
89458
89698
|
if (IGNORE_DIRS2.has(entry2.name)) continue;
|
|
89459
|
-
if (entry2.name.startsWith(".") && entry2.name !== ".env") continue;
|
|
89699
|
+
if (entry2.name.startsWith(".") && entry2.name !== ".env" && !(entry2.name === ".gitignore" && entry2.isFile())) continue;
|
|
89460
89700
|
if (budget.remaining <= 0) {
|
|
89461
89701
|
truncated = true;
|
|
89462
89702
|
budget.hitLimit = true;
|
|
@@ -89550,7 +89790,7 @@ var init_project_scanner = __esm({
|
|
|
89550
89790
|
const entries = readdirSync36(dir, { withFileTypes: true });
|
|
89551
89791
|
for (const entry2 of entries) {
|
|
89552
89792
|
if (IGNORE_DIRS2.has(entry2.name)) continue;
|
|
89553
|
-
if (entry2.name.startsWith(".") && entry2.name !== ".env" && !entry2.name.startsWith(".env.")) continue;
|
|
89793
|
+
if (entry2.name.startsWith(".") && entry2.name !== ".env" && !entry2.name.startsWith(".env.") && !(entry2.name === ".gitignore" && entry2.isFile())) continue;
|
|
89554
89794
|
const relPath = relDir ? join75(relDir, entry2.name) : entry2.name;
|
|
89555
89795
|
if (entry2.isDirectory()) {
|
|
89556
89796
|
callback(relPath, true);
|
|
@@ -96207,6 +96447,9 @@ function formatToolArgs(toolName, args2) {
|
|
|
96207
96447
|
if (toolName === "create_directory") {
|
|
96208
96448
|
return String(args2.path || "");
|
|
96209
96449
|
}
|
|
96450
|
+
if (toolName === "browser_type") {
|
|
96451
|
+
return String(typedTextForDisplay(args2) || args2.selector || "");
|
|
96452
|
+
}
|
|
96210
96453
|
if (toolName.startsWith("browser_")) {
|
|
96211
96454
|
return String(args2.url || args2.selector || args2.text || "");
|
|
96212
96455
|
}
|
|
@@ -96885,6 +97128,7 @@ var init_shared_streaming = __esm({
|
|
|
96885
97128
|
init_tool_action_kinds();
|
|
96886
97129
|
init_whole_suite_guard();
|
|
96887
97130
|
init_registry();
|
|
97131
|
+
init_secret_field();
|
|
96888
97132
|
init_turn_changes();
|
|
96889
97133
|
activeStreams = /* @__PURE__ */ new Map();
|
|
96890
97134
|
pendingPermissions = /* @__PURE__ */ new Map();
|
|
@@ -97882,6 +98126,7 @@ var init_playwright_adapter = __esm({
|
|
|
97882
98126
|
init_config2();
|
|
97883
98127
|
init_utils();
|
|
97884
98128
|
init_snapshot_script();
|
|
98129
|
+
init_secret_field();
|
|
97885
98130
|
playwrightCore = null;
|
|
97886
98131
|
loadPlaywright = () => playwrightCore ??= import("playwright-core");
|
|
97887
98132
|
logger24 = createLogger("playwright");
|
|
@@ -98312,6 +98557,23 @@ URL: ${url}
|
|
|
98312
98557
|
async type(selector, text3, clear = true) {
|
|
98313
98558
|
return this.fill(selector, text3, clear);
|
|
98314
98559
|
}
|
|
98560
|
+
/** A password or one-time-code field, read from the element itself (never throws). */
|
|
98561
|
+
async secretFieldKind(selector) {
|
|
98562
|
+
try {
|
|
98563
|
+
const hints = await this.getLocator(selector).first().evaluate((el) => {
|
|
98564
|
+
const e = el;
|
|
98565
|
+
const label4 = e.id ? document.querySelector(`label[for="${CSS.escape(e.id)}"]`)?.textContent || "" : "";
|
|
98566
|
+
return {
|
|
98567
|
+
type: e.getAttribute("type"),
|
|
98568
|
+
autocomplete: e.getAttribute("autocomplete"),
|
|
98569
|
+
text: [e.getAttribute("name"), e.id, e.getAttribute("aria-label"), e.getAttribute("placeholder"), label4, e.closest("label")?.textContent || ""].filter(Boolean).join(" ")
|
|
98570
|
+
};
|
|
98571
|
+
}, void 0, { timeout: 2e3 });
|
|
98572
|
+
return secretKindFromHints(hints);
|
|
98573
|
+
} catch {
|
|
98574
|
+
return null;
|
|
98575
|
+
}
|
|
98576
|
+
}
|
|
98315
98577
|
async press(key2) {
|
|
98316
98578
|
const start = Date.now();
|
|
98317
98579
|
try {
|
|
@@ -99089,6 +99351,11 @@ var init_launcher = __esm({
|
|
|
99089
99351
|
await this.ensureSession();
|
|
99090
99352
|
return this.adapter.type(selector, text3, clear);
|
|
99091
99353
|
}
|
|
99354
|
+
/** A password or one-time-code field? Adapters that cannot tell return null. */
|
|
99355
|
+
async secretFieldKind(selector) {
|
|
99356
|
+
if (!this.adapter?.secretFieldKind) return null;
|
|
99357
|
+
return this.adapter.secretFieldKind(selector).catch(() => null);
|
|
99358
|
+
}
|
|
99092
99359
|
async press(key2) {
|
|
99093
99360
|
await this.ensureSession();
|
|
99094
99361
|
return this.adapter.press(key2);
|
|
@@ -126427,7 +126694,7 @@ async function streamBrowserWithToolEvents(orchestrator, browserManager, wss, pr
|
|
|
126427
126694
|
x,
|
|
126428
126695
|
y,
|
|
126429
126696
|
selector: typeof args2.selector === "string" ? args2.selector : void 0,
|
|
126430
|
-
text:
|
|
126697
|
+
text: typedTextForDisplay(args2),
|
|
126431
126698
|
url: typeof args2.url === "string" ? args2.url : void 0
|
|
126432
126699
|
});
|
|
126433
126700
|
}
|
|
@@ -126576,6 +126843,9 @@ function formatToolArgs2(toolName, args2) {
|
|
|
126576
126843
|
if (toolName === "create_directory") {
|
|
126577
126844
|
return String(args2.path || "");
|
|
126578
126845
|
}
|
|
126846
|
+
if (toolName === "browser_type") {
|
|
126847
|
+
return String(typedTextForDisplay(args2) || args2.selector || "");
|
|
126848
|
+
}
|
|
126579
126849
|
if (toolName.startsWith("browser_")) {
|
|
126580
126850
|
return String(args2.url || args2.selector || args2.text || args2.key || "");
|
|
126581
126851
|
}
|
|
@@ -126651,6 +126921,7 @@ var init_api_browser = __esm({
|
|
|
126651
126921
|
"use strict";
|
|
126652
126922
|
init_whole_suite_guard();
|
|
126653
126923
|
init_screencast_service();
|
|
126924
|
+
init_secret_field();
|
|
126654
126925
|
pendingPermissions2 = /* @__PURE__ */ new Map();
|
|
126655
126926
|
screencastServices = /* @__PURE__ */ new Map();
|
|
126656
126927
|
}
|