test(computer-use): element click carries the token from the live schema alone
Invariant through the real click() path on the modern tools/list shape (no capabilities[] array, element_token only in inputSchema); red on main.
This commit is contained in:
@@ -2228,6 +2228,17 @@ class TestElementTokenAttachment:
|
||||
# The matching token rode along — cua-driver will prefer it.
|
||||
assert args["element_token"] == "s0001:5"
|
||||
|
||||
def test_token_attached_when_only_input_schema_advertises_it(self):
|
||||
"""cua-driver >= 0.21 dropped the per-tool `capabilities[]` array from tools/list but advertises
|
||||
`element_token` in `click`'s inputSchema and REFUSES a bare element_index (`snapshot_id_required`).
|
||||
The token must ride along from the live schema alone, or every element click is refused."""
|
||||
backend = self._backend_with_session({}) # no capabilities[] at all — the modern shape
|
||||
backend._session.supports_input_property = lambda tool, prop: (tool, prop) == ("click", "element_token")
|
||||
backend._snapshot_tokens = {5: "s00000001:5"}
|
||||
backend.click(element=5, button="left")
|
||||
_, args = backend._session.call_tool.call_args.args
|
||||
assert args["element_token"] == "s00000001:5"
|
||||
|
||||
|
||||
def test_capture_refreshes_snapshot_tokens(self):
|
||||
"""A fresh capture should overwrite any stale tokens from a
|
||||
|
||||
Reference in New Issue
Block a user