feat: add topology graph v0.2.2 contract
This commit is contained in:
@@ -91,6 +91,45 @@ test("locator candidates carry context-scope evidence for duplicated actions", (
|
||||
assert.equal(candidates[0].scopes.some((scope) => scope.kind === "row"), true);
|
||||
});
|
||||
|
||||
test("scoped row locator resolves duplicated row actions to one target", async () => {
|
||||
await withPage(
|
||||
`
|
||||
<table>
|
||||
<tr><td>Acme Co</td><td><button>Edit</button></td></tr>
|
||||
<tr><td>Beta LLC</td><td><button>Edit</button></td></tr>
|
||||
</table>
|
||||
`,
|
||||
async (page) => {
|
||||
const rawElement = raw({
|
||||
uid: "button_1_Edit",
|
||||
candidateIndex: 1,
|
||||
tag: "button",
|
||||
role: "button",
|
||||
accessibleName: "Edit",
|
||||
identityText: "Edit",
|
||||
text: "Edit",
|
||||
attributes: {},
|
||||
context: {
|
||||
dialog: null,
|
||||
form: null,
|
||||
section: null,
|
||||
row: { kind: "row", name: null, text: "Acme Co Edit" },
|
||||
landmark: null,
|
||||
listitem: null,
|
||||
},
|
||||
});
|
||||
const scoped = generateLocators("el_scoped_edit", rawElement).find((candidate) => candidate.strategy === "scoped");
|
||||
assert.ok(scoped);
|
||||
|
||||
const [verified] = await verifyLocators(page, rawElement, [scoped]);
|
||||
|
||||
assert.equal(verified.verified, true);
|
||||
assert.equal(verified.matchCount, 1);
|
||||
assert.equal(verified.identity?.sameAccessibleName, true);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test("placeholder-only input locator verifies identity from raw placeholder evidence", async () => {
|
||||
await withPage(`<input placeholder="Search customers" />`, async (page) => {
|
||||
const rawElement = raw({
|
||||
|
||||
Reference in New Issue
Block a user