Repository navigation
fix(core): let an ordinal decide a click without the screenshot check - #155
Conversation
With screenshots on, "click the first Start fact find button" failed as ambiguous on a page with two identical buttons. Code had already picked the first one in document order, but the screenshot check asks how many elements could fit the step and counts the sibling the ordinal ruled out. resolveInCode now reports whether its pick came from an ordinal or price rank, and the locator skips the check for those picks. Clicks without an ordinal are still checked. Amp-Thread-ID: https://ampcode.com/threads/T-5442a904-1b2c-4f4c-89fc-47b15b8e6f04 Co-authored-by: Ignacio Gutierrez <nachojgutierrez@gmail.com>
|
2 findings · reviewed 🟠 the changeset says price ranks use document order ·
|
Fixes failure A from the alpha.17 screenshot-check report: with screenshots on (the default for the TypeSafe API),
click the first Start fact find buttonfails asambiguouson a page with two identical buttons. alpha.12 and--no-screenshotspass.Cause.
resolveInCodealready resolves the ordinal: it takes the first same-named button in document order. The screenshot target check then asksjev-1.14.0how many elements could be the one the step means. It sees two identical buttons, answers "several" (≥ 0.5), and the pick is refused. That question doesn't take into account that the ordinal already chose one button.Fix.
resolveInCodenow returns{ target, ranked }, whererankedmarks a pick by ordinal or price rank ("first", "last", "cheapest").RuntimeSelectionrecords it, andresolveTargetskips the target check for ranked picks. Section picks ("in the page header"), item references ("Edit for Jane") and model picks are still checked, and so are clicks without an ordinal. The diagnostic gate staysresolved_in_code.Evidence
The gist repro was run end to end with the real CLI (Chromium 1280×900, the real TypeSafe API, locator cache cleared before every run):
click the first Start fact find buttonambiguous, callsjev-1.13.0+jev-1.14.0)jev-1.13.0only)first/second/laston a page where each button opens a different dialogclick the Start fact find button(no ordinal)ambiguousambiguous; the check still runsalpha.12 passed gist test 1 5 / 5, and this branch with
--no-screenshotspassed 2 / 2.Regression test:
locator.test.ts› screenshot target check. The model leans to the second button and the checker answers several = 0.9. With "the first", the first button must win and the checker must not be called. Without an ordinal, the checker runs and the step is refused. The ordinal case fails onmain.Checks:
pnpm test(1347 passed),pnpm typecheck,pnpm lint, and prettier.sedum-evals locator benchmark (development split,
jev-1.13.0).mainran live and saved its replies. This branch then replayed them: 401/401 synthetic and 1011/1011 real-site replay hits, so both sides got the same model answers.main→ branchmain→ branchEvery case got the same score, pick and gate on both sides, including the 16 cases resolved in code. The harness doesn't enable the screenshot target check, so this shows the
resolveInCodechange is behavior-neutral; it doesn't measure the skip itself. The repro runs above cover the skip.Not addressed here: failures B (a title text counted as a second click target) and C (
is not shownclaims about icon buttons named byaria-label) from the same report.https://ampcode.com/threads/T-5442a904-1b2c-4f4c-89fc-47b15b8e6f04