feat: verify locators with context evidence

This commit is contained in:
赵义仑
2026-06-16 20:02:25 +08:00
parent 581724ea42
commit c41f260e51
5 changed files with 281 additions and 9 deletions

View File

@@ -40,6 +40,16 @@ test("scan captures a state-local inventory without clicking high-risk actions",
assert.equal(graph.elements.some((element) => element.accessibleName === "Delete account"), false);
});
test("duplicated row actions are verified with semantic locator evidence", async () => {
const graph = await withTempOutput("duplicate-locators", (out) => scanUrl({ url: fixturePath, out }));
const editButtons = graph.elements.filter((element) => element.accessibleName === "Edit");
assert.equal(editButtons.length, 2);
for (const edit of editButtons) {
assert.equal(edit.locators.some((locator) => locator.verified && locator.identity?.sameAccessibleName), true);
assert.equal(edit.locators.some((locator) => locator.scopes.some((scope) => scope.kind === "row")), true);
}
});
test("graph metadata records generation context and policy versions", async () => {
const graph = await withTempOutput("metadata", (out) => scanUrl({ url: fixturePath, out }));
assert.equal(graph.schemaVersion, "0.2");