Repository navigation
feat(locator): add blur for web elements - #1919
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 28 files
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Reviewed fdf97c1 (main 6fbcb66). locator.blur() itself is right. It matches Playwright: it waits only for the node to be attached, does nothing if the node is not focused, and works on a hidden node. The element path calls the native blur on the prototype. That has the same effect as Playwright running node.blur() in its utility world, where an app's override on the instance is not visible. Mobile refuses before the engine runs: DEVICE_ACTIONS leaves out blur, so the user gets UNSUPPORTED_CAPABILITY. Freezing LOCATOR_ACTION_KINDS and validating against a full list is the shape kdy1 chose on #1883 today. The web side does not follow that decision yet.
Must fix
packages/web/src/engine.ts:10,128-130:import * as coreEnginepluscoreEngine.KNOWN_LOCATOR_ACTION_KINDS?.includes('blur')checks the installed core at runtime. The type says the export always exists, so the?.hides a case the types do not model. It also hides bugs: remove'blur'fromKNOWN_LOCATOR_ACTION_KINDSand web stops declaring blur with no error, while typecheck and unit tests stay green. The decision on #1883 isactions: [...LOCATOR_ACTION_KINDS, 'blur']plus a higher@e2e-dev/corepeer floor inpackages/web/package.json:65(now>=0.23.2), set to the core release that shipsblur. Drop the namespace import and update the stale "every action kind of the contract" comment on line 126.
Should fix
packages/core/src/engine/contract.ts:327:satisfies readonly LocatorActionKind[]does not prove the list is complete. A kind added to theLocatorActionunion but not toKNOWN_LOCATOR_ACTION_KINDSstill typechecks, and every engine that declares it gets rejected. Add a compile-time check thatExclude<LocatorActionKind, (typeof KNOWN_LOCATOR_ACTION_KINDS)[number]>isnever. #1883 addssetInputFilePayloadsto the same list, so whichever PR lands second extends this one list (please don't add a second "all kinds" constant). The doc comment on line 306 should say "the kinds of SPI v1; list newer kinds explicitly", as kdy1 asked.docs/zh/reference/engine.mdx:88still saysLOCATOR_ACTION_KINDS; en and ja were updated (cubic is right).skills/e2e/references/writing-tests.md:279(and the plugin copy): addblurto the "Web only,UNSUPPORTED_CAPABILITYon a device" list two lines below, and drop the inline "(web only)" (cubic is right).packages/e2e/schema/fixtures/engine-manifest-v1.valid.json:26: this is the android manifest, and android does not performblur. Revert it. The schema enum test plus the invalid fixture already cover the new kind (cubic is right).
Nits
packages/web/src/actions.ts:322-328: add a one-line comment on why this calls the prototype'sblur, which matches Playwright's isolated world. Without it, someone will "simplify" it back tonode.blur(). An element that is neither anHTMLElementnor anSVGElement(for example MathML) gets no blur and returns success without an error.
Verified: core/e2e/web/mobile build and typecheck pass. oxlint, peer-range, and changeset checks pass. e2e unit tests engine-protocol, mcp-code-parse, schema-fixtures, and engine pass 197/197, and mobile passes 551/551. On the built CLI, testbed controls.e2e.ts --grep blur passes 2/2. Mutants: with the locator path as a no-op, test 1 fails; with the element path calling the instance blur, test 2 fails. A probe confirmed that a label-matched locator still blurs when the app overrides blur on the instance, and that blurring a hidden node succeeds. CI: check, label, and pr-policy are green. spec, mobile, docs, docs translations, and benchmark are action_required: they wait for approval of the fork's runs and have not run.
# Conflicts: # docs/ja/reference/engine.mdx # docs/zh/reference/engine.mdx # packages/e2e/schema/fixtures/engine-manifest-v1.invalid.json
|
[GPT-6] responding on behalf of @WellDunDun @okwasniewski addressed the review through ced6635. Web declares blur explicitly and requires core 0.24.0, the version on the current release branch. The SPI v1 list stays frozen, and typecheck now verifies that the full validation list covers every action kind. I also corrected the Chinese reference, documented the device error in both skill copies, restored the Android fixture, and explained the native prototype call. The branch includes current main. Local pnpm check and the built Chromium blur tests pass. Please re-review and approve the fork workflows for this revision. |
There was a problem hiding this comment.
All reported issues were addressed across 11 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
Unanchored findings
2 findings could not be posted inline, so cubic included the feedback here instead.
1. skills/e2e/references/writing-tests.md:308
P3: The Actions paragraph says every listed action waits for the node to be actionable, but blur() only waits for attachment, does nothing when the node is unfocused, and works on hidden nodes. Add a short note for blur() so agents don't assume actionability checks apply.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At skills/e2e/references/writing-tests.md, line 279:
<comment>The Actions paragraph says every listed action waits for the node to be actionable, but `blur()` only waits for attachment, does nothing when the node is unfocused, and works on hidden nodes. Add a short note for `blur()` so agents don't assume actionability checks apply.</comment>
<file context>
@@ -276,10 +276,10 @@ Each action resolves one node, waits up to `config.actionTimeout` (30 s, or
`press(key)`, `check()`, `uncheck()`,
`selectOption(label | { label } | { value } | { index })` (one option; an
-array is `INVALID_ARGUMENT`), `focus()`, `blur()` (web only), `hover()`, `setInputFiles(paths)`
+array is `INVALID_ARGUMENT`), `focus()`, `blur()`, `hover()`, `setInputFiles(paths)`
(relative to the project root; `[]` clears), `dragTo(locator)`, `scrollIntoView()`,
`swipe({ direction, momentum? })`. Web only, `UNSUPPORTED_CAPABILITY` on a
</file context>
2. plugins/e2e/skills/e2e/references/writing-tests.md:308
P3: The doc now presents blur() as unconditional. It should say that blur is available only on engines that declare it, and that others fail with UNSUPPORTED_CAPABILITY. The PR's stated goal is that older web engines do not advertise blur, so the reference should document that case.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At plugins/e2e/skills/e2e/references/writing-tests.md, line 279:
<comment>The doc now presents `blur()` as unconditional. It should say that blur is available only on engines that declare it, and that others fail with `UNSUPPORTED_CAPABILITY`. The PR's stated goal is that older web engines do not advertise blur, so the reference should document that case.</comment>
<file context>
@@ -276,10 +276,10 @@ Each action resolves one node, waits up to `config.actionTimeout` (30 s, or
`press(key)`, `check()`, `uncheck()`,
`selectOption(label | { label } | { value } | { index })` (one option; an
-array is `INVALID_ARGUMENT`), `focus()`, `blur()` (web only), `hover()`, `setInputFiles(paths)`
+array is `INVALID_ARGUMENT`), `focus()`, `blur()`, `hover()`, `setInputFiles(paths)`
(relative to the project root; `[]` clears), `dragTo(locator)`, `scrollIntoView()`,
`swipe({ direction, momentum? })`. Web only, `UNSUPPORTED_CAPABILITY` on a
</file context>
array is `INVALID_ARGUMENT`), `focus()`, `blur()` (an engine must declare `blur`, else `UNSUPPORTED_CAPABILITY`), `hover()`, `setInputFiles(paths)`
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked ced6635 (main 9d240ac) against my fdf97c1 review: core/web/e2e diff, the built CLI on the testbed, and a trial merge with #1883.
Every earlier ask is done:
- Web declares
[...LOCATOR_ACTION_KINDS, 'blur']. The namespace import and the runtime?.includescheck are gone. The@e2e-dev/corepeer floor is>=0.24.0. KNOWN_LOCATOR_ACTION_KINDSis the one "all kinds" list.sdk-types.tschecks at compile time that it coversLocatorActionKind, and theLOCATOR_ACTION_KINDSdoc comment says it is the v1 set.- The zh validation row,
blurin the deviceUNSUPPORTED_CAPABILITYlist (both skill copies), the android fixture revert, and the prototypeblurcomment are all done.
The shape matches #1883 exactly: same constant, same validator, same peer floor, same completeness check. That makes it one mechanism, not two. The changeset bumps core/e2e/web as patch, which is right for 0.x.
On the open cubic findings at 44f8b1a:
web/package.json:65floor0.23.3: outdated. The head has>=0.24.0, which matches the pending release (#1763 versions core to 0.24.0).web/src/engine.ts:126"restore the runtime guard": not real. The maintainer chose explicit declaration plus a peer floor instead of a runtime check, so web on an older core is excluded by the peer range.plugins/.../writing-tests.md"blur presented as unconditional": not real.bluris in the "Web only,UNSUPPORTED_CAPABILITYon a device" list.skills/.../writing-tests.md"every action waits for actionable": technically true, sincebluronly waits for attachment. The paragraph was already loose forfocusandsetInputFiles, so this is optional.
Must fix
- None.
Should fix
- This branch is based on main, not stacked on #1883. Both PRs add
KNOWN_LOCATOR_ACTION_KINDSand touch the same lines. A trial merge conflicts in 13 files (contract.ts,web/src/engine.ts, the schema enum, both manifest fixtures,engine-protocol.test.ts,sdk-types.ts,mobile/src/surface.ts, the en/ja/zhengine.mdx,migrate/playwright.mdx, both skill copies). After #1883 merges, rebase so the list is[...LOCATOR_ACTION_KINDS, 'setInputFilePayloads', 'blur'], the schema enum and webactionsinclude both kinds, mobile keeps bothcases, andsdk-types.tskeeps one completeness check.
Nits
web/src/actions.ts:322-328: an element that is neitherHTMLElementnorSVGElement(MathML) still returns success without blurring. Fine to leave.
Verified: core/e2e/web/mobile build + typecheck, oxlint, check:peer-ranges, check:changeset-bumps, docs:check-errors, plugins:check, check:dead-code. e2e unit (engine-protocol, engine, schema-fixtures, mcp-code-parse) 197/197, mobile engine 242/242. Testbed controls.e2e.ts --grep blur 2/2 on the built CLI. Mutants: blur dropped from KNOWN_LOCATOR_ACTION_KINDS is caught by the sdk-types typecheck. blur dropped from web's actions survives all web unit tests (372/372), so the testbed blur tests are the only coverage. CI at this SHA: check, docs, docs translations, web, build, bun, install, and cubic are green. spec, mobile, benchmark, and the test matrix were still running or queued when I checked.
Asks done, see latest automated re-check.
kdy1
left a comment
There was a problem hiding this comment.
Note
This text was drafted with AI and posted after human approval.
- Harnesses: T3 Code, Claude Code, Codex
- AI agents: Claude Opus 5.5 (claude-opus-5-5), coordinator and verification, in Claude Code, GPT-6.2 Astra (gpt-6.2-astra), independent reviewer, in Codex, GPT-6.1 Sol (gpt-6.1-sol), independent reviewer, in Codex, Claude Opus 5.5 (claude-opus-5-5), independent reviewer, in Claude Code, Claude Sonnet 5.5 (claude-sonnet-5-5), independent reviewer, in Claude Code
Requesting changes. locator.blur() works on the common paths. The two new testbed tests fail on main (second.blur is not a function) and pass at this head. But the element-handle path can report success while the node keeps focus, and nothing outside the testbed tests the new action kind.
I checked every item below at ced6635a against the built packages (core, e2e, web). For the behavior items, I ran the testbed CLI in Chromium. The findings come from a co-review pass and four independent reviewers (GPT-6.2 Astra, GPT-6.1 Sol, Claude Opus 5.5, Claude Sonnet 5.5). I re-ran each finding before I included it.
There are 6 inline comments. These findings are outside the diff:
docs/reference/screen.mdx:600: the locator action table goes fromfocustohover. Add ablurrow that links to#blur, and add it in the ja and zh pages too, which this PR already edits.docs/reference/mobile.mdx:410: the list of actions that the mobile engine does not declare ("selectOption,setInputFiles,scrollIntoView, andsecondaryTapare not declared") does not includeblur.
Non-blocking: browser.locator('#f').blur() on <form tabindex="0" id="f"><input name="blur"></form> throws locator.blur: TypeError: node.blur is not a function, because the form exposes its control as form.blur. Playwright behaves the same way, so you can leave this.
What I ran at the head:
- Builds and
typecheckfor core, e2e, web, and mobile. lint,check:dead-code,docs:check-errors,check:peer-ranges,check:changeset-bumps,plugins:check, anddocs:check. All passed.- e2e unit tests (
engine-protocol,engine,schema-fixtures,mcp-code-parse,locator-engine): 286/286. - web unit tests: 372/372.
- Testbed
controls.e2e.ts --grep blur: 2/2 at this head, 0/2 on main.
|
[GPT-6] responding on behalf of @WellDunDun @kdy1 the review fixes are pushed. The pinned element path now blurs MathML, with a Chromium test through getByLabel. The comment explains that prototype overrides still apply in the page world. Added web manifest, core dispatch and unsupported-capability tests, validated a manifest declaring blur, documented the public action lists, and added mobile to the contract changeset. pnpm check, 166 focused unit tests, and all three built-CLI blur tests pass. I'll rebase after #1883 merges. Please re-review and approve CI for this head. |
There was a problem hiding this comment.
0 issues found across 10 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
|
Note This text was drafted with AI and posted after human approval.
I re-checked
Please push the fixes for these two items. You do not need to ping me. An automation removes my change request when the review is addressed, so the fix itself is what matters. Also, the fork workflows (spec, mobile, benchmark, docs, docs translations) have not run at this head yet. They wait for approval. |
There was a problem hiding this comment.
0 issues found across 4 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked ce5cd79 (main ae36939) against my ced6635 review and kdy1's review of ced6635 plus his 05:18 comment.
kdy1's asks are all done:
web/src/actions.ts: the element path now blurs MathML throughMathMLElement.prototype.blur, and the comment says a prototype override still applies in the page world. kdy1 accepted the comment instead of an isolated world.web/tests/unit/surface-of.test.ts: a unit test checks that web declaresblur.e2e/tests/unit/locator-engine.test.ts: coversUNSUPPORTED_CAPABILITYon an engine that does not declareblur(nolocateorperformcall) and{ kind: 'blur' }reachingperform.engine-protocol.test.ts: the toy engine now declares['tap', 'blur']and validates against the schema.- The
LOCATOR_ACTION_KINDSdoc comment (and its copy inengine.mdx) says to useKNOWN_LOCATOR_ACTION_KINDSwhen checking an action kind. - The changeset now bumps
@e2e-dev/mobiletoo. screen.mdx(en/ja/zh) has ablurrow, andmobile.mdxlistsbluras not declared.
None of my earlier asks regressed. cubic found nothing new at 20ab8eb or ce5cd79.
Must fix
- None.
Should fix
- Same as last time: #1883 is still open, and a trial merge with it still conflicts in 13 files (
contract.ts,web/src/engine.ts, the schema enum, the invalid fixture,engine-protocol.test.ts,sdk-types.ts,mobile/src/surface.ts, en/ja/zhengine.mdx,migrate/playwright.mdx, both skill copies). After #1883 merges, rebase so the list is[...LOCATOR_ACTION_KINDS, 'setInputFilePayloads', 'blur'], webactionsand the schema enum include both kinds, andsdk-types.tskeeps one completeness check. The branch merges cleanly with main today.
Nits
web/src/actions.ts:329:typeof view.MathMLElement === 'function'guards a global that the DOM types say always exists, and every browser e2e drives has it.node instanceof view.MathMLElementalone is enough, as in kdy1's suggestion.locator-engine.test.ts:it.each([true, false])with anif/elsebody is really two tests. Two plainits would read more directly.
Verified: core/e2e/web/mobile build + typecheck, oxlint, check:peer-ranges, check:changeset-bumps, docs:check-errors, plugins:check. e2e unit (locator-engine, engine-protocol, schema-fixtures, mcp-code-parse, engine) 288/288, web unit 373/373. Testbed controls.e2e.ts --grep blur 3/3 on the built CLI. Mutants, each caught:
- web declares only
LOCATOR_ACTION_KINDS: the new web unit test fails. - core sends
{ kind: 'focus' }fromblur():locator-enginefails. blurdropped from the schema enum:engine-protocolfails.- MathML branch removed: the testbed MathML test fails.
CI at this SHA: check, cubic, label, pr-policy, and pr-size are green. spec, mobile, docs, docs translations, and benchmark are action_required: the fork runs wait for approval.
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Post-release check at ce5cd79 against main 8eb3cc2: merges clean today, typecheck and the PR's unit tests pass on the merged tree, CI green.
Must fix (peer floor): blur is not in the published @e2e-dev/core 0.24.0 (#1763). packages/web/package.json:65 still allows core 0.24.0, whose defineEngine rejects the unknown blur kind, so this web release would fail to load with it. Please raise both peers in packages/web/package.json:65-66 to >=0.24.1 <1.
Heads up: this lands after #1883. Both add KNOWN_LOCATOR_ACTION_KINDS, and a trial merge of this branch on top of #1883 conflicts in packages/core/src/engine/contract.ts, packages/web/src/engine.ts, packages/mobile/src/surface.ts, the engine manifest schema + its invalid fixture, engine-protocol.test.ts, sdk-types.ts, the engine/playwright docs, and both writing-tests.md skill copies. Please rebase once #1883 merges.
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
Superseded by the latest automated re-check.
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at 0644451 against main 309f690. It merges cleanly with main today. The PR shows blocked only because the earlier changes-requested review is still open.
Thanks, the peer floor is done. packages/web/package.json now has @e2e-dev/core and e2e at >=0.24.1 <1, so a new web can't resolve against the published 0.24.0 core that rejects blur. The new commit changes only those two lines. The mobile change is only an exhaustive case 'blur', which needs no floor. No unresolved review threads or cubic findings are left.
Before merge: rebase once #1883 lands. A trial merge of this branch on top of #1883 still conflicts in packages/core/src/engine/contract.ts, packages/web/src/engine.ts, packages/mobile/src/surface.ts, engine-manifest-v1.schema.json + its invalid fixture, engine-protocol.test.ts, sdk-types.ts, docs/reference/engine.mdx (and ja/zh), docs/migrate/playwright.mdx, and both writing-tests.md skill copies. Each conflict is two new action kinds added in the same spot, so keep both. In packages/web/src/engine.ts, the web actions list should read [...LOCATOR_ACTION_KINDS, 'setInputFilePayloads', 'blur']. This PR does not conflict with #1962.
CI: check is green. The fork workflows (docs, docs translations, spec, mobile, benchmark) are action_required and need a maintainer to approve them.
Verified: check:peer-ranges passes, and pnpm install --frozen-lockfile works at the head. Last pass's typecheck and unit tests on the merged tree are still valid, because the new commit only changes package.json peers.
Release 0.24.0 has shipped, so the floor can name it directly instead of the 0.23.1 placeholder the branch carried while the release was pending. Web stays at >=0.24.1, which main raised for the blur export in e2e-inc#1919; lowering it would drop a floor the web engine needs. Signed-off-by: Varshith Puli <pulivarshit@gmail.com>
Release 0.24.0 has shipped, so the floor can name it directly instead of the 0.23.1 placeholder the branch carried while the release was pending. Web stays at >=0.24.1, which main raised for the blur export in e2e-inc#1919; lowering it would drop a floor the web engine needs. Signed-off-by: Varshith Puli <pulivarshit@gmail.com>
What and why
locator.blur({ timeout? })for web tests that need to trigger focus-loss behavior on a specific element.Issue
Part of #1855. Assigned to @WellDunDun.
Verified
Ran it locally: yes, with the built CLI and Chromium.
e2e run tests/controls.e2e.ts --grep blur --videoverifies the focused input loses focus, another input keeps focus when the target was already unfocused, and a locator matched by value can blur an input even if the app overrides its instance method.