Repository navigation
feat(expect): add toBeEditable locator matcher - #1962
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 19 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
There was a problem hiding this comment.
0 issues found across 6 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
Reviewed at 1e67154 (main ae36939, mergeable clean, CI green). Compared against Playwright 1.65.1 getReadonly / elementState('editable') from node_modules/playwright-core.
Thanks, the matcher is well tested and the docs are careful. The problem is where read-only gets decided.
Must fix
-
packages/core/src/internal/roles.ts:81(isReadOnly) decides read-only in core from raw HTML attributes plus the role. Core can't see the tag orisContentEditable, which is everything Playwright branches on.disabledis already an engine state (states.disabled, computed inread-semantics.tswith Playwright's rules), and read-only should work the same way. I added these cases to/editable-matcherinweb-platform.test.tsand ran them on Chromium. All 5 disagree with Playwright:<input aria-readonly="true">: Playwright says editable (native tags only readreadonly, and you can type into it). This PR saysobserved: read-only. Not documented.<div role="textbox" aria-readonly="TRUE">: Playwright lowercases (getAriaBoolean), so it's read-only. This PR compares=== 'true'and says editable. Not documented.<div contenteditable><p data-testid="child">: Playwright says editable (isContentEditable). This PR saysobserved: no role (not a control that can be read-only). Not documented.<input type="radio" readonly>: Playwright readsreadonly. This PR fails with role "radio". Documented in the migrate doc.<div role="textbox" readonly>: Playwright says editable. This PR says read-only. Documented.
Suggested fix: have the engine report it, e.g. a
readonlyboolean inSemanticNode.statesthat is present only where Playwright'sgetReadonlywould not throw. The web reader computes it in-page with Playwright's rules (tag first, then thearia-readonlyroles with case folding, then contenteditable). ThentoBeEditableonly reads states,READONLY_ROLES/canBeReadOnly/isReadOnlyleave core, and the divergence bullet atdocs/migrate/playwright.mdx:367goes away. This changes the engine contract, so it needs changesets for e2e, core, web and mobile. If maintainers would rather keep this in core, at minimum fold thearia-readonlycase and document the<input aria-readonly>and contenteditable-descendant differences.
Should fix
packages/e2e/src/expect/async.ts:389-409and:586:observedrepeats the logic ofisNodeEditable(disabled first, then read-only), andisNodeEditabledepends on the comment "the caller has checked that its role can be read-only". Use oneeditState(node): 'disabled' | 'read-only' | 'editable' | undefined. ThenevaluableNodeisstate !== undefined,predicateis(state === 'editable') === holds, andobservedprints the state, so the hidden invariant goes away. If read-only moves into the engine, this becomes a few lines.- Mobile (
docs/reference/expect.mdx:156): "a field there is editable whenever it is enabled". This meanstoBeEditable()passes on an enabled native field that isn't editable. agent-device already sends aneditableflag, whichpackages/mobile/src/nodes.tsreads to decide the role but doesn't pass on. With an enginereadonlystate, mobile could report it where the platform knows it (AndroidisTextEditable()). Or the matcher could refuse on mobile rather than pass silently. I didn't check this on a device.
Nits
roles.tsnow hasisEditable(a role that takes text) alongside the matcher's "editable" (enabled and not read-only), and both mean different things. Rename one, e.g.takesText.
Verified
tests/unit/expect-async-editable.test.tsandmcp-code-parse.test.ts: 96 passed. Integrationweb-platformandscripted-matchers: 55 passed.tsc --noEmitand oxlint are clean on the changed files.- Mutants: dropping the
readonlyread, dropping the disabled check, and droppingevaluableNodeeach fail one unit test. - The 5 Playwright-parity cases above, run on Chromium (scratch edits, not pushed).
- Both earlier cubic findings are fixed in 1e67154.
1e67154 to
2ce2eb0
Compare
|
Thanks, all done in 2ce2eb0 (rebased on main f3cd032). Must fix: read-only is now an engine state. Should fix
Nit:
|
There was a problem hiding this comment.
All reported issues were addressed across 23 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
There was a problem hiding this comment.
0 issues found across 6 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
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 95a5bff against main 8eb3cc2 (it merges cleanly, and the tests below pass on that merge too). CI is green at 95a5bff. The PR shows blocked only because the earlier changes-requested review is still open.
Thanks, the earlier asks are all done:
- Read-only is now an engine state.
readOnlyOfinpackages/web/src/in-page/read-semantics.tsmatches Playwright 1.65.1'sgetReadonlyline by line: tag first, then the same 14aria-readonlyroles with case folding, thenisContentEditable, else no state.READONLY_ROLES/canBeReadOnly/isReadOnlyare gone from core, and so is the migrate-doc divergence bullet. - All 5 parity cases from the last review, plus the new
contenteditable+role="textbox"+aria-readonlycase, are in/editable-matcherand pass on Chromium. editStatereplaces the duplicated logic and the hidden invariant.- Mobile no longer passes silently. A
textbox/searchboxgetsreadonly: !editableonly when agent-device sends the flag. Without the flag there is no state, so the matcher fails. isEditable->takesText.- Both new cubic findings (editing-host wording in
expect.mdxandcontract.ts) were real, and the wording fix is correct, because Playwright checks the role beforeisContentEditable.
Must fix
packages/web/package.json:65-66andpackages/mobile/package.json:75,77still have@e2e-dev/coreande2epeers at>=0.23.2 <1.states.readonlyis a new core contract, and 0.24.0 is already published without it. Raise both engines'@e2e-dev/coreande2epeers to>=0.24.1 <1. Otherwise a new@e2e-dev/webcan resolve against e2e 0.24.0, and a new e2e paired with an older engine failstoBeEditableon every node withrole "textbox", no read-only state. A rebase on main also picks up the 0.24.0 version bump, which you need before choosing the floor.
Nits
readonly: truenow shows up as[readonly]in the agent's observation lines and the MCP catalog, because those print every true state. That looks useful (the model can see a field it can't type into). It's a model-input change, though, so maybe mention it in thereadonly-statechangeset.
Verified
- Unit
expect-async-editable+mcp-code-parse(96), integrationweb-platform+scripted-matchers(55), mobilenodes.test.ts(33), webobservation-capture(12): all pass at the head and on the merge with main (152 e2e tests). core, e2e, web and mobile build (with declaration emit). - Mutants, each caught by one failing test: dropping the
aria-readonlycase fold, checkingisContentEditablebefore the role, letting a native input readaria-readonly, and dropping thetextbox/searchboxrestriction on mobile. - I didn't check mobile on a device. On iOS agent-device sends no
editableflag, sotoBeEditablealways fails there, as documented.
|
Thanks! Rebased on main (8eb3cc2, which has the 0.24.0 bump) and done in 8269c8e:
|
95a5bff to
8269c8e
Compare
There was a problem hiding this comment.
0 issues found across 3 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
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 8269c8e against main 309f690. It merges cleanly, CI is green at 8269c8e, and the PR shows blocked only because the earlier changes-requested review is still open.
Thanks, everything from the last review is done:
- The rebase is clean.
git range-diffshows the 4 earlier commits unchanged, plus one new commit. packages/web/package.jsonandpackages/mobile/package.jsonnow have@e2e-dev/coreande2epeers at>=0.24.1 <1.check:peer-rangespasses.- The
readonly-statechangeset mentions the 0.24.1 requirement and[readonly]in observations and the MCP catalog.
No must-fix or should-fix items. No open kdy1 or cubic threads.
Verified
check:peer-rangespasses at the head.- I trial-merged main + #1883 + this PR (they merge cleanly, and both raise the web peers to the same
>=0.24.1 <1). On that tree, core, e2e, web and mobile build and typecheck, andexpect-async-editable,mcp-code-parseandengine-protocolpass (137 tests). - The behavior tests and mutants from the last pass still apply, because the rebased commits are byte-identical.
kdy1
left a comment
There was a problem hiding this comment.
Note
This text was drafted with AI and posted after human approval.
- Harness: T3 Code
- AI agents: Claude Opus 5.5 (claude-opus-5-5) as coordinator and verifier, GPT-6.2 Astra (gpt-6.2-astra) as Review Once reviewer, GPT-6.2 Sol (gpt-6.2-sol) as Review Once reviewer, Claude Opus 5.5 (claude-opus-5-5) as Review Once reviewer, Claude Sonnet 5.5 (claude-sonnet-5-5) as Review Once reviewer
I checked this PR at 8269c8e2 against Playwright 1.65.1 in Chromium, and I ran the mobile projection on nodes from agent-device 0.21.40. The matcher, the editState logic, and the tests look good. But I found two behavior problems: on iOS the matcher passes on read-only text views, and on the web an editing host with no ARIA role is reported read-only. Both contradict the docs. There are 4 inline comments. The items below are outside the diff.
Outside the diff
docs/reference/engine.mdx:2407-2418still shows the oldSemanticNode.statesunion, with no'readonly'and none of the new JSDoc. On the base, this block was identical tocontract.ts. An engine author who reads this page will not emitreadonly, and thentoBeEditablefails on every node of that engine withno read-only state. Copy the new union and comment frompackages/core/src/engine/contract.ts:174-189.- The PR description describes the first design. It says
canBeReadOnly/isReadOnlyinpackages/core/src/internal/roles.tsdo the check, and that "a field there is editable whenever it is enabled" on a device. Both are no longer true. The squash commit takes this text, so please update it, including## Verified.
Not blocking
- When a locator matches a
<label>, Playwright'sisEditable()reads the associated control. This PR reads the label and fails withno role, no read-only state. The existingtoBeEnabledhas the same gap (a label for a disabled input passestoBeEnabled()here, and Playwright says disabled), so I do not ask for a change in this PR.
| ...(secure ? { secure: true } : {}), | ||
| ...(checked === undefined ? {} : { checked }), | ||
| ...(spelled?.states.expanded === undefined ? {} : { expanded: spelled.states.expanded }), | ||
| ...readOnlyState(role, source.editable), |
There was a problem hiding this comment.
iOS: a read-only text view gets readonly: false, so toBeEditable() passes.
agent-device 0.21.40 fills in editable: true for every TextField, SecureTextField, SearchField, and TextView when the flag is absent (dist/src/ios-node-interpretation.js). The runner snapshot bridge (bridge-source.js, used by runner-runtime.js) applies this to every node. So on iOS, source.editable is a guess from the element type, not a platform fact, and this line turns it into readonly: false.
I ran agent-device's own interpretation function and then projectSnapshot at this head:
IOS after agent-device: [{"type":"TextView","editable":true},{"type":"TextField","editable":true}]
IOS projected textbox Terms {"readonly":false}
IOS projected textbox City {"readonly":false}
So a non-editable UITextView (for example a React Native multiline TextInput with editable={false}, which stays enabled) passes toBeEditable(). This contradicts docs/reference/expect.mdx:160-162 ("A field without it fails the matcher"). The iOS fixtures in tests/fixtures/snapshots/ios/ have no editable key because they were captured on 2026-11-12, before the 0.21.40 bump (#1975), so the unit test e3 (TextField with no flag) does not show what a device sends now. I did not run this on a simulator.
Suggested fix: do not emit readonly from the iOS snapshot. For example, apply readOnlyState only to Android nodes, where the flag comes from TextView.isTextEditable(), and add a unit case that feeds an iOS node through the agent-device interpretation.
There was a problem hiding this comment.
Done in 8fc6e85: readOnlyState now returns no state unless the node is an Android class, so an iOS TextView/TextField gets none. agent-device does not export its iOS interpretation function (only from the snapshot bridge), so the unit case feeds the nodes in the shape it produces (editable: true on TextView and TextField) and checks there is no readonly.
| function readOnlyState(role: string | undefined, editable: boolean | undefined): { readonly?: boolean } { | ||
| if (editable === undefined || (role !== 'textbox' && role !== 'searchbox')) return {}; | ||
| return { readonly: !editable }; |
There was a problem hiding this comment.
Small one: editableRole keeps combobox when the driver reports editable: true, but this guard drops the state for every combobox. So a combobox that the platform says takes text has no state, and toBeEditable() fails on it with role "combobox", no read-only state:
ANDROID projected combobox Search city undefined (android.widget.Spinner, editable: true)
ANDROID projected textbox Name {"readonly":false} (android.widget.EditText, editable: true)
The comment's case (a picker that takes no text) is still right to leave out. Suggested fix: report readonly: false for a combobox only when editable === true, and keep no state when it is false or absent.
There was a problem hiding this comment.
Done in 8fc6e85: a combobox gets readonly: false only when editable === true, and no state otherwise. Added the Spinner with editable: true case.
| const readOnlyOf = (el: Element, tag: string, role: string | null): boolean | null => { | ||
| if (tag === 'input' || tag === 'textarea' || tag === 'select') return el.hasAttribute('readonly'); | ||
| if (role !== null && ARIA_READONLY_ROLES.indexOf(role) !== -1) { | ||
| return (el.getAttribute('aria-readonly') ?? '').toLowerCase() === 'true'; |
There was a problem hiding this comment.
An editing host with no ARIA role and aria-readonly="true" is reported read-only, but Playwright says editable.
role here comes from implicitRole, which returns textbox for every editing host (line 245, the vocabulary's editor-host rule). Playwright's getReadonly uses getAriaRole, which gives a plain <div contenteditable> no role, so Playwright skips the aria-readonly branch and returns editable through isContentEditable.
Same HTML in Chromium, Playwright isEditable() and this head's toBeEditable():
| Element | Playwright | This PR |
|---|---|---|
<div contenteditable aria-readonly="true"> |
editable | observed: read-only |
<article contenteditable aria-readonly="true"> |
editable | observed: read-only |
<h1 contenteditable aria-readonly="true"> |
editable | observed: read-only |
<div contenteditable role="textbox" aria-readonly="true"> |
read-only | read-only |
<td contenteditable aria-readonly="true"> in <table role="grid"> |
read-only | read-only |
This contradicts docs/reference/expect.mdx:148-155 and contract.ts:177 ("as Playwright's getReadonly decides").
A simple "skip the branch for an editing host with no explicit role" fix breaks the grid-cell row, because Playwright reads that td as gridcell. What worked for me is to compute the role without the editor-host shortcut:
- const implicitRole = memoized((el: Element): string | null => {
+ const computeRole = (el: Element, editorHostIsTextbox: boolean): string | null => {
...
- if (isEditingHost(el)) return 'textbox';
+ if (editorHostIsTextbox && isEditingHost(el)) return 'textbox';
...
- });
+ };
+ const implicitRole = memoized((el: Element): string | null => computeRole(el, true));
+ /** The ARIA role Playwright reads: the tag's role, with no editor-host textbox. */
+ const ariaRoleOf = memoized((el: Element): string | null => computeRole(el, false));
const readOnlyOf = (el: Element, tag: string, role: string | null): boolean | null => {
if (tag === 'input' || tag === 'textarea' || tag === 'select') return el.hasAttribute('readonly');
- if (role !== null && ARIA_READONLY_ROLES.indexOf(role) !== -1) {
+ const ariaRole = isEditingHost(el) ? ariaRoleOf(el) : role;
+ if (ariaRole !== null && ARIA_READONLY_ROLES.indexOf(ariaRole) !== -1) {With this patch, all 5 rows above and 8 other parity cases (native and ARIA checkbox, switch, aria-disabled, select readonly, input button, and so on) match Playwright. web-platform.test.ts passes, and the whole @e2e-dev/web suite passes (856 passed, 1 skipped). Please add the div and td rows to /editable-matcher.
There was a problem hiding this comment.
Done in 8fc6e85 with your computeRole split: an editing host reads aria-readonly by ariaRoleOf. Added the plain div and the grid td rows to /editable-matcher; the div row fails before the change. web-platform 50 pass, @e2e-dev/web 856 pass.
|
|
||
| Report a `readonly` node state where a node can be read-only. The web engine decides it as Playwright's `getReadonly` does; the mobile engine reports it on a text field when agent-device says whether the field takes text. | ||
|
|
||
| The web and mobile engines now need `@e2e-dev/core` and `e2e` 0.24.1 or later, since `toBeEditable` reads this state. Agent observations and the MCP catalog now show `[readonly]` on such nodes, so the model can see a field it can't type into. |
There was a problem hiding this comment.
"since toBeEditable reads this state" gives the dependency in the wrong direction: the engines do not use toBeEditable; e2e reads the state the engines emit. The peer floor is right, because the engines now emit a contract field that is new in 0.24.1. But it does not cover the pairing that breaks: the published @e2e-dev/web@0.16.1 and @e2e-dev/mobile@0.12.8 accept e2e >=0.23.2 <1, so a user who updates only e2e gets toBeEditable failing on every node with no read-only state, and nothing says why.
Suggested fix: reword this as "the engines emit a contract field that is new in 0.24.1", and in docs/reference/expect.mdx say that toBeEditable needs the @e2e-dev/web and @e2e-dev/mobile releases that ship with this change.
There was a problem hiding this comment.
Reworded in 8fc6e85: the engines emit a contract field new in 0.24.1, and toBeEditable needs the engine releases that ship with this change. expect.mdx (en/ja/zh) now says an older engine fails every node with no read-only state.
8269c8e to
8fc6e85
Compare
There was a problem hiding this comment.
0 issues found across 13 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 at 8fc6e85 (based on 160cbfe). It merges cleanly with main a5d1788 (the only new commit there, #1921, touches nothing here). CI is green at 8fc6e85.
Thanks, all of kdy1's points are done:
- iOS:
readOnlyStatenow returns no state for a non-Android node, so an iOSTextView/TextFieldgets no state even with theeditable: truethat agent-device 0.21.40 fills in. The unit casese7/e8cover this. - Combobox: the state is
readonly: falseonly wheneditable === true, and there is no state when the flag isfalseor missing. Casee6covers this. - Editing host:
computeRole(el, editorHostIsTextbox)givesimplicitRoleandariaRoleOf, andreadOnlyOfreadsaria-readonlyon an editing host byariaRoleOf. That matches Playwright'sgetReadonly, which goes throughgetAriaRole: a plain<div contenteditable aria-readonly="true">is editable, and a gridtdhost is read-only. Both rows are now in/editable-matcher. - The changeset wording now gives the dependency the right way round, and
expect.mdxsays an older engine fails every node withno read-only state. - Outside the diff: the
statesunion indocs/reference/engine.mdxmatchescontract.ts, and the PR description and## Verifieddescribe the current design.
The earlier asks still hold. @e2e-dev/web and @e2e-dev/mobile peer on @e2e-dev/core and e2e at >=0.24.1 <1, and check:peer-ranges passes.
No must-fix or should-fix items. No open cubic findings (0 issues at 8fc6e85). I agree with kdy1's non-blocking <label> note: toBeEnabled has the same gap, so it belongs in a follow-up.
Verified
- I built core, e2e, web and mobile (with declaration emit).
web-platform+expect-async-editablepass (60 tests), and mobilenodes.test.tspasses (33). - I tried 5 mutants, and one failing test caught each:
- reading
aria-readonlyby the textbox role on an editing host fails onplain-host - giving every editing host without an explicit role no ARIA role fails on
grid-cell - dropping the Android guard fails on the iOS
e7/e8cases - dropping the combobox branch fails on
e6 - setting a combobox to
readonly: !editablealso fails
- reading
- I didn't run it on a device. On iOS
toBeEditablenow always fails, as the docs say.
michal-e2e
left a comment
There was a problem hiding this comment.
Note
Drafted with AI using Codex and Claude Code, with GPT-6.2 Sol, GPT-6.2 Astra and Claude Fable 5.2.
Reviewed at 8fc6e8540 (merge base 160cbfe7a).
Must fix
- Web. Please add two cases to the Chromium test for
/editable-matcher. Expect<select readonly>to pass.not.toBeEditable()and<select aria-readonly="true">to pass.toBeEditable(). The existingSizeselect has neither attribute. Removingselectfrom the native-control rule still passed the existing matcher cases and the web engine suite. The proposed Chromium test passed on this commit and failed with that rule removed. Chromium test - Android. Please add an
android.widget.EditTextwithout aneditableflag and assert thatstates?.readonlyis undefined. The existingCityfixture uses an iOSTextField, so the Android check could report a field with a missing flag as read-only and the mobile suite would still pass. The proposed test passed on this commit and caught that change. Mobile projection test
Optional
The reference says read-only is “decided on the web as Playwright's toBeEditable decides it”. On the same Chromium page, Playwright reported a plain editing host inside aria-disabled="true" as editable, while e2e reported it as disabled. The comparison also differed for a read-only datalist and a column header in a presentation table. Suggested wording for the reference and changeset is “The web engine follows Playwright’s rules for native controls and aria-readonly, using e2e’s roles and the disabled state reported by toBeEnabled().” Matcher reference · Changeset
Verified
On this commit, pnpm check, the Chromium matcher tests, mobile projection tests, MCP parser tests and the Control Inventory replay with --strict-cache passed.
Of 29 mutations at 22 changed locations, 23 failed an assertion, one threw a matcher error, and one failed to compile. Four passed the existing checks. The two tests above catch the native-select and missing-Android-flag mutations. The other two made the MCP options argument required or removed a searchbox branch that no Android class in the role map reaches.
Not run
The matcher on a live Android emulator or iOS simulator. The mobile evidence comes from projection tests and recorded device snapshots.
michal-e2e
left a comment
There was a problem hiding this comment.
Re-reviewed at 12ad52c5dd577a194f10d3ce39749ba801c00f5f. The rebase preserves the table and list role handling from #1957, and the PR description now matches the engines’ peer range. I verified the overlapping editing-host cases in Chromium against Playwright. The build, focused matcher tests, Android projection tests, peer-range checks, and Control Inventory replay passed locally.
One new merge conflict. After #2008 landed on main, Git reports a conflict in packages/mobile/package.json. Main sets the mobile package’s @e2e-dev/core peer to >=0.24.1 <1. Please keep this PR’s >=0.25.0 <1 when resolving that line. The mobile package’s e2e peer already merges at >=0.25.0 <1. This was the only conflict in my merge check against 5b61f221a. Mobile peer ranges
Reviewed with GPT-6.2 Astra and Claude Fable 5.2.
|
Rebased on main after #2008. Git resolved |
12ad52c to
0be4285
Compare
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at 0be4285 (based on ed48b0b). It merges cleanly with main c30354f (mergeable_state: clean), and CI is green at 0be4285.
Since our last review at adeae44, the branch was only rebased twice. git range-diff shows 6 of the 8 commits unchanged. The other 2 differ only where they meet main:
packages/web/src/in-page/read-semantics.ts:computeRole(el, editorHostIsTextbox)keeps main'stagRoleand the presentational inheritance from #1957 (inheritedPresentationRole(el) ?? role). The editing-host textbox check stays behind the flag, soimplicitRolepassestrueandariaRoleOfpassesfalse. This is what michal-e2e asked for at 12:56.packages/mobile/package.json: main's@e2e-dev/corepeer of>=0.24.1 <1(from #2008) has been replaced. Both mobile peers are now>=0.25.0 <1, which is what michal-e2e asked for at 13:36.
michal-e2e's optional ask is also done: the PR description now says the engines need @e2e-dev/core and e2e at >=0.25.0 <1. No new cubic findings.
No must-fix, should-fix, or nits.
Verified
- Built core, e2e, web and mobile.
check:peer-rangespasses, and it lists web and mobile on core and e2e at>=0.25.0 <1. No0.24.1is left in the diff. - Mobile
nodes.test.tspasses (33),expect-async-editablepasses (10), webread-node-rolespasses (17), and the ChromiumtoBeEditabletests inweb-platformpass (3). - I tried 2 mutants on the conflict resolution, and one test caught each:
- dropping
inheritedPresentationRolefromcomputeRolefails the #1957 presentational table/list case inread-node-roles - passing
truefromariaRoleOffailsplain-hostin the ChromiumtoBeEditabletest
- dropping
- Not run on a device.
|
[claude-opus-5-5] automated review on behalf of @okwasniewski The label dropped because #2013 ( To resolve: #2013 deleted the unsupported-table row |
The web engine now reports a readonly node state with Playwright's getReadonly rules (native tag by readonly, aria-readonly roles by aria-readonly with case folding, editing hosts never), and the mobile engine reports it on text fields where agent-device sends editable. toBeEditable reads only states; the core role list and attribute read are gone. Rename roles.ts isEditable to takesText.
…and iOS fields The web engine reads aria-readonly on an editing host by its ARIA role, not the textbox it reads as, so a plain contenteditable div is editable and a grid cell still reads the attribute. The mobile engine reports the readonly state only on Android, where the flag comes from the platform: agent-device fills in editable for every iOS text field. A combobox the platform says takes text is editable. The engine reference shows the new states union, and the changeset and expect docs say toBeEditable needs the engine releases that ship with this change.
- Chromium: <select readonly> is not editable, <select aria-readonly=true> is. - Android: an EditText with no editable flag has no readonly state. - Reference and changeset: the web engine follows Playwright's rules for native controls and aria-readonly, with e2e's roles and disabled state.
0be4285 to
214797f
Compare
|
Rebased on main after #2013. The /ready |
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at 214797f (based on main 6fdb1c2). mergeable_state: clean, it merges cleanly with main, and all CI checks at 214797f pass (cubic neutral, no new findings).
Since our review at 0be4285, the branch was only rebased onto #2013. git range-diff shows 7 of 8 commits unchanged, including 457f0bc (read-only rules) and 473953c (tests). The first commit differs only in docs/migrate/playwright.mdx: the expect(fn).toPass() row stays deleted as on main, and the toBeEmpty() row no longer lists toBeEditable(). That was our ask from 04:32.
michal-e2e's asks (12:56 and 13:36 on 2026-11-21) are still done at this head: computeRole keeps #1957's presentational inheritance, the editor-host textbox stays behind the flag, both engines' @e2e-dev/core and e2e peers are >=0.25.0 <1, and the description names that range. He has not reviewed since.
I compared the web reader with Playwright 1.65.1's injected getReadonly and its editable state again:
input,textarea, andselectusehasAttribute('readonly')first, soaria-readonlyon them is ignored.- The 14
kAriaReadonlyRolesmatch exactly.aria-readonlyis lowercased and compared with'true'. - An editing host is checked by its ARIA role, not by the textbox role e2e gives it, and is otherwise
false. - Anything else gets no state (
null), which is where Playwright throws. disabledwins over read-only, as in Playwright'sreceived: disabled ? 'disabled' : ....
No must-fix, should-fix, or nits.
Verified
- Range-diff against 0be4285: the code is identical, and only the migrate doc table changed. The earlier test and mutant results still apply (mobile
nodes.test.ts,expect-async-editable, webread-node-roles, the ChromiumtoBeEditabletests, and theinheritedPresentationRoleandariaRoleOfmutants). - CI at 214797f is green: unit on Node 22/24/26, Bun, check, docs gate, web, and iOS and Android deterministic.
- No em or en dashes in the diff. The stale ja/zh
toPass()row is on main too, which is fine since translations are best effort.
michal-e2e
left a comment
There was a problem hiding this comment.
Drafted by an AI agent and posted autonomously on Michal's behalf, without him reading it first.
Re-reviewed at 214797fb0 (merge base 6fdb1c278, main).
Nothing blocks from my side. Thanks for resolving the mobile peer conflict @bardrop: both engines' @e2e-dev/core and e2e peers are >=0.25.0 <1, and the branch merges cleanly with current main 5acb82235.
Must fix: none.
Verified
-
The rebase changed no code since my review at
12ad52c5d.git range-diffshows 6 of 8 commits unchanged. The other 2 differ only where they meet main: thetoPass()row in the Playwright guide, and the mobile@e2e-dev/corepeer that main already had at0.24.1. -
git merge-tree --write-tree --name-onlyexits 0 against the merge base6fdb1c278and against main5acb82235. -
No wire schema needs a change. No schema under
packages/e2e/schema/lists node states, and the engine protocol does not check state keys. The[readonly]the agent and the MCP catalog now show comes from existing code that prints every state that istrue(observation.ts:509,catalog.ts:283). -
Suites at
214797fb0, run here:pnpm checkand the testbed passed.pnpm testpassed in every package except desktop.@e2e-dev/desktopfailed twice while the machine was heavily loaded, a differentsurface.test.tstest each time. The package then passed on its own at this commit on a quiet machine (193 passed, 1 skipped). This PR does not touch the desktop engine, so I classed those failures as flaky.- The web benchmark passed (43 files, 95 tests) on a quiet rerun. The first run reused another review's server on port 4280, which stopped mid-run.
- The web agent suite from its recordings (
--strict-cache, no model key): the same 8 of 34 tests fail here and at the merge base, each after a model call that has no key. There was noREPLAY_STALEon either side, so this change broke no recording.
-
New tests: 14 added, all 14 red on the merge base. 12 fail under at least one mutant with an assertion. The other 2 ("passes on an enabled control that is not read-only" and "answers on a secure field") fail under the mutants that invert the match or swap the read-only result, through the matcher's own error rather than an assertion. Both new type assertions in
sdk-types.tsfailtscwhen thetoBeEditableoptions are loosened. -
Mutation testing: 34 mutants over the matcher, the web reader, the Android projection and the MCP code surface, applied to
214797fb0. 29 killed by a failing assertion. 4 survived:- Two in the MCP code surface: requiring an argument (
matcher(1, 1)) or refusing one (matcher(0, 0)) fortoBeEditable. No test runstoBeEditablethroughrun_code. - Dropping
searchboxfrom the Android read-only roles. No test has an Android searchbox. - Letting a missing node match in the predicate. No test can catch this one:
conditionEvaluablerefuses a missing node before the predicate runs.
The code these mutants change is the same as at my earlier reviews, so I'm not asking for anything new. One more mutant (reporting a disabled control as editable) failed its test through the matcher's own error rather than an assertion, so I did not count it as a kill.
- Two in the MCP code surface: requiring an argument (
Not run
- The mobile benchmark. No simulator or emulator was assigned to this review.
pnpm test:mobile-benchmarkwould close it. The Android read-only state is covered by the projection unit tests only.
For the maintainer
- The
>=0.25.0floor is right only if this merges before #1974 (chore: version packages), which versions@e2e-dev/coreande2eto 0.25.0. If #1974 merges first, 0.25.0 ships without the read-only state, and the floor needs to move to the next release.
The findings are mine; the approval is @okwasniewski's, since this changes the engine contract, the public types and both engine manifests.
kdy1
left a comment
There was a problem hiding this comment.
Note
This text was drafted with AI and posted after human approval.
- Harness: T3 Code
- AI agents: Claude Opus 5.5 (claude-opus-5-5), GPT-6.2 Astra (gpt-6.2-astra, Codex, review-once reviewer), GPT-6.2 Sol (gpt-6.2-sol, Codex, review-once reviewer), Claude Opus 5.5 (claude-opus-5-5, review-once reviewer), Claude Sonnet 5.5 (claude-sonnet-5-5, review-once reviewer)
Approving. Four independent reviewers and my own runs found no blocking issues. The web reader matches Playwright's isEditable() on every case we tried (35, 39, and about 55 elements in three separate probes). The replay cache keys do not change. The 0.25.0 peer floor matches the pending changesets.
All findings are P3 and optional. Fix them here or in a follow-up, as you prefer. Three are inline. One is outside the diff:
- P3,
packages/mobile/tests/unit/captured-snapshots.test.ts:19: the golden-tree renderer does not includereadonlyinSTATES, and it prints onlytruestates. So the Android trees cannot show the new state, and a capture where it is dropped or flipped passes.nodes.test.tsstill covers it. If you addreadonlyand also printfalsefor it, 18 Android lines change in 9 trees (allreadonly=false), and the iOS trees do not change.
Merge order: this needs to land before the chore: version packages PR (#1974), so that the 0.25.0 floor is the version that ships.
| - On a device, a text field has a read-only state only where the platform | ||
| reports whether it takes text, as Android does. iOS does not, so an iOS | ||
| field fails the matcher rather than pass as a guess. |
There was a problem hiding this comment.
P3, optional: the desktop engine is not mentioned. @e2e-dev/desktop reports no readonly state (STATE_NAMES in packages/desktop/src/nodes.ts does not include it), so on desktop every node fails with no read-only state. docs/desktop.mdx says the same expect APIs work there. One sentence here would prevent the surprise.
| | Playwright | e2e | | ||
| | --- | --- | | ||
| | `toBeVisible()`, `toBeHidden()`, `toBeEnabled()`, `toBeDisabled()`, `toBeChecked()`, `toBeFocused()`, `toBeAttached()`, `toHaveText()`, `toContainText()`, `toHaveValue()`, `toHaveAttribute()`, `toHaveCount()`, `toHaveAccessibleName()`, `toHaveRole()` | the same, with `{ visible }`, `{ enabled }`, `{ checked }`, `{ attached }`, and `{ ignoreCase }` | | ||
| | `toBeVisible()`, `toBeHidden()`, `toBeEnabled()`, `toBeDisabled()`, `toBeChecked()`, `toBeFocused()`, `toBeAttached()`, `toHaveText()`, `toContainText()`, `toHaveValue()`, `toHaveAttribute()`, `toHaveCount()`, `toHaveAccessibleName()`, `toHaveRole()`, `toBeEditable()` | the same, with `{ visible }`, `{ enabled }`, `{ editable }`, `{ checked }`, `{ attached }`, and `{ ignoreCase }` | |
There was a problem hiding this comment.
P3, optional, not caused by this PR: Playwright retargets a <label> locator to its control, but e2e reads the label node, which has no states. I checked on one page: for a label bound to a checked, disabled checkbox, Playwright gives checked=true, enabled=false, editable=false, and e2e's label node has states={}. On main, toBeChecked already fails on such a label and toBeEnabled passes on it. So "the same" in this row was already too strong for every state matcher, and toBeEditable only joins the row. A caveat or a separate issue is enough.
| ...(secure ? { secure: true } : {}), | ||
| ...(checked === undefined ? {} : { checked }), | ||
| ...(spelled?.states.expanded === undefined ? {} : { expanded: spelled.states.expanded }), | ||
| ...readOnlyState(role, source.editable, android), |
There was a problem hiding this comment.
P3, optional, rare: android here comes from the per-node isAndroidClass heuristic (the class name contains a .). An Android custom view whose getAccessibilityClassName returns an unqualified name (for example AmountField) loses its editable flag, and its read-only state is not reported. EditText, Compose, Flutter, and React Native all report qualified names, and the same heuristic already drives role mapping, so it is fine to leave for now. Passing the session's platform would make it robust.
…d review of the desktop engine (e2e-inc#2091) * fix(desktop): read again while the screen is locked, not an empty screen A Mac that locks after app.open() lists none of the app's windows while the app still runs. capture() took that as an app with no window open, so not.toBeVisible() passed on a control that was there, and a window chosen with useWindow() read as closed. Before either answer, the engine now asks macOS whether the screen is locked, and a locked screen is a retryable NODE_STALE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): report the read-only state toBeEditable reads toBeEditable (e2e-inc#1962) reads only the engine's readonly state, and the desktop engine reported none, so the matcher failed on every desktop node, editable or not. agent-desktop marks a text field whose value cannot be set readonly and offers SetValue on one whose value can: a text field now reports readonly from those, and a combo box that takes text reports readonly false. A pop-up menu takes no text and gets no state, as a picker on the mobile engine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): cap maxDepth at 50, the deepest read agent-desktop takes desktop({ maxDepth }) took up to 255, but agent-desktop 1.3.1 refuses a snapshot deeper than 50 levels ("max depth 51 exceeds the supported maximum of 50"; ABSOLUTE_MAX_DEPTH in its macOS reader). A config with 51 to 255 loaded and then failed every read. Config load now refuses it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): swipe the window's custom view that offers Scroll A swipe on the window picked its target by role alone (scroll area, list, table, and the like), so a custom view that scrolls, which agent-desktop lists with a Scroll action, failed with "the window has nothing that scrolls". A node that offers Scroll now counts too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): report a failed capture as no screenshot, not unproven masking observe({ pixels: true }) turned every capture failure but a timeout into maskedRegionCount 0, so a Mac without Screen Recording permission failed toHaveScreenshot with POLICY_DENIED, "could not prove every secure field was masked", even on a window with no password field. Only a screenshot withheld for its secure fields now reports a masked count; a capture that failed returns no pixels and no count, as on the mobile engine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(core): read a masked count sent without pixels as withheld An engine asked for pixels that withholds them reports maskedRegionCount alone. The session took that as proven when the count was at least the secure nodes, so a desktop screenshot withheld because the window was read only in part, with no secure field in the part read, lost its reason: the observation had no pixels and no pixelsWithheld, toHaveScreenshot waited out its timeout, and the agent read UNSUPPORTED_CAPABILITY and stopped asking for pixels. A count without pixels now always reads as MASKING_UNPROVEN. No web or mobile answer changes: web never sends a count alone, and mobile does so only with a secure node on screen. This reverses one line e2e-inc#2014 tested, agreed with the maintainer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): read window titles from accessibility, not the window list agent-desktop's window list takes a title from CoreGraphics, which macOS hides without Screen Recording permission, and lists the app's name in its place. desktop.windows() then gave every window the app's name, and every observation's location read "SignInForm › SignInForm"; the testbed's fresh-launch test failed on such a Mac. The window's accessibility root still carries the title: the location now takes it from there, and windows() reads it for a window listed under the app's name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): say a partial read makes a locator retry, not app.open() fail The Reading row read as if app.open() failed on a window read only in part. app.open() takes the first window it can read, partial or not; it is a locator on such a window that reads again until its timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): stop waiting for a menu to close once the step is cancelled After Escape, closeOpenMenu looks for the menu until a second has passed. Once the operation's signal aborted, each look failed at once and the sleep between looks returned at once, so the loop spun without yielding to the event loop for the rest of that second. It now returns unconfirmed when the step is cancelled, as the other waits of the engine stop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): swipe only a node agent-desktop offers Scroll The window's swipe target was the first list, table, scroll area, or node offering Scroll. agent-desktop scrolls only a node that offers Scroll (its actionability gate asks for that capability), so a short sidebar list or a fixed table ahead of the scrolling pane took the swipe and agent-desktop refused it. The target is now the first node that offers Scroll. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): check for a locked screen when a chosen window's read fails A Mac that locks after list-windows found the chosen window answers the snapshot with WINDOW_NOT_FOUND. That branch reported the window closed (INVALID_STATE) without asking whether the screen is locked, so a locator failed at once. It now reads again while the screen is locked, as the window-list branch does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): refuse an unmaskable screenshot as policy, and retry the rest pixelsFor withheld an image for five reasons and marked all of them as unproven masking. Two were wrong: a window with no secure field that changed size, or closed, during the capture has nothing to mask, yet with the count-alone rule in core it now failed toHaveScreenshot at once with POLICY_DENIED instead of being captured again. And app.screenshot() gave ENGINE_FAILURE for a partial read, a field that moved, or a capture of the wrong size, though withheld pixels are POLICY_DENIED (AGENTS.md). A withholding that involves a secure field, seen in either read or possibly left out of a partial one, is now POLICY_DENIED and reports no masked region; one that does not is a plain ENGINE_FAILURE with no count, so the poll captures again. Tests cover each kind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(core): say a masked count without pixels always reads as withheld The public JSDoc of EngineSnapshot.maskedRegionCount still said an engine reports a count "fewer than the secure nodes", which ee739fc4 no longer requires. It now says what the session does, as engine.mdx does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): read again in app.open() when the window went stale mid-read An app that replaces its startup window while the first snapshot reads it gets STALE_REF (locator_root_invalid) from agent-desktop, a retryable NODE_STALE. The launch wait retried only its own three causes and threw anything else, so app.open() failed on the first read. Any retryable stale read now waits for the next one, within the same deadline; the app is launched once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): need core and e2e 0.25.0, which carry the readonly state c57646f7 made the desktop engine report the readonly node state, a contract field new in 0.25.0. e2e-inc#1962 raised the web and mobile peer floors to 0.25.0 for the same field (AGENTS.md: raise the floor when a package starts relying on a newer contract field); desktop stayed at 0.23.2. It now needs 0.25.0 too, and the expect reference names it beside them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(desktop): skip a window accessibility cannot read when reading titles desktop.windows() reads the accessibility title of each window listed under the app's name, one snapshot at a time. Without Screen Recording every window is listed that way, and a window agent-desktop marks not accessible can only fail that read, spending the call's budget. Those keep their listed title. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): say what agent-desktop leaves out of a field's state and value Two limits of agent-desktop 1.3.1 the engine cannot see past, kept as they are with the maintainer. When one of a field's state attributes cannot be read, agent-desktop drops the field's whole state list, secure included, and marks nothing unknown, so such a password field is not painted over. And it leaves out a text field's value both when the field is empty and when the value could not be read, so both read as empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): find a focused look-alike by its name too before a key A look-alike field has a new id in every read, so after focusing it holdsFocus found it by role, place, and the twins around it. A focus handler that replaced the form with other fields at the same places passed that check, and the key went to the replacement. The focused field must now have the binding's name too, which look-alikes share. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): read a control collapsed to no width or height as hidden The projection marked a node hidden only from agent-desktop's hidden and offscreen states, so a control collapsed to a 0-wide or 0-high box, which draws nothing and which agent-desktop refuses to act on (bounds_are_visible), passed toBeVisible(). A leaf with such a box is now hidden; a container is left alone, since one with no box of its own can still hold drawn children. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): fail an observation cancelled during its pixel capture observe({ pixels: true }) passed on only OPERATION_TIMEOUT from the pixel capture and turned every other failure into no pixels. An operation cancelled while agent-desktop took the screenshot (CANCELLED) therefore returned a successful observation without them. A cancellation now fails the observation, as a timeout does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(engine): match the maskedRegionCount example to the count-alone rule The EngineSnapshot example in the engine reference still said a count sent without pixels is "fewer than the secure nodes"; ee739fc4 reads any such count as withheld. It now carries the same comment as the declaration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep agent-desktop's raw capture inside the worker directory agent-desktop screenshots a window to capture.png in a directory of its own under TMPDIR, unmasked, and removes it in a destructor that a process killed mid-capture (a timeout or a cancellation) never runs. That directory was in the run's TMPDIR, where neither the worker's cleanup nor the next run's sweep looks. The screenshot command now gets the shot's own directory under the worker's state directory as its TMPDIR, which the engine removes after every capture and the sweep removes after a killed worker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): tell a dead worker from a process that took its id A state directory's owner file held only the worker's process id, so once macOS gave that id to another process, every later sweep took the dead worker for one still running: its app stayed up and agent-desktop's field text stayed on disk. The owner file now records when the worker started too, and the sweep takes a directory whose id runs with another start time as left behind. A start time that cannot be read still counts as the same process, so a directory in use is never taken. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): retry a screenshot whose read ran out of time, refuse a deep one Since a masked count without pixels reads as withheld, a screenshot of a window with no password field failed toHaveScreenshot at once with POLICY_DENIED whenever one read came back incomplete because agent-desktop ran out of time, though the next capture would have read it whole. Such a read (complete: false) with no secure field seen is now a capture that failed: no count, and the poll captures again. A tree cut at its depth limit is cut the same way every time, so it stays POLICY_DENIED, and the message now names maxDepth and says to raise it. Agreed with the maintainer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): say a floating window over a point gets a point tap A headed point tap is a real click at a screen point. The engine brings the window forward and refuses when it lost focus, but agent-desktop 1.3.1 has no click aimed at a window and no way to ask which window is topmost at a point, so a floating window over the point gets the click. Kept as it is with the maintainer, and said in the Physical input row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): read the whole window for a locator in interactive mode With snapshot: 'interactive', locate() read the window with snapshot -i too, which leaves out static text, so a visible label matched nothing: toBeVisible() timed out on it and not.toBeVisible() passed. A locator now reads the whole window whatever the option says, as on the mobile engine (locateSnapshot); only the agent's observations use the interactive read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): read process start times in one time zone startedAt() stored and compared ps -o lstart=, which prints local time, and passed on the run's TZ. A worker in a run with another TZ (a project that sets TZ=UTC beside one that does not, both on the Mac at once) wrote its owner file in that zone, so every other run's sweep saw its owner with another start time, took it for a later process, killed the app it had launched, and removed its state mid-test. b25edd88 brought this in; before it the sweep compared the process id alone. A clock change while a test ran also made stillLaunched() leave the app running. ps now prints the time in UTC for every reader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): read the controls of a minimized window as hidden capture() reads a minimized window when no other is open, and accessibility still lists its controls with their usual boxes, so toBeVisible() passed on a control that was in the Dock. A window agent-desktop lists as minimized now projects every node but the root as hidden; a locator still finds them, and a visibility assertion sees them hidden. visible: false alone is left as it is, since a window on another Space reports it too and is still read and driven. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): skip a hidden or disabled pane when choosing what a swipe scrolls The window's swipe took the first node offering Scroll, even one the projection already marked hidden (off screen) or disabled. agent-desktop scrolls only a visible, enabled target, so an off-screen pane ahead of the main one in the tree took the swipe and agent-desktop refused it. Those are now passed over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): give Calculator as the bundleId example, not TextEdit TextEdit is document-based: launched in the background, as by default, it opens no window, so app.open() fails and asks for headed: true. A user who copied the example failed on the first run. Calculator opens a window in the background, and the engine was run against it by bundleId. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * style(desktop): drop the backslashes from a comment's code span c70ec376 wrote the start-time comment with escaped backticks, which read as literal backslashes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): read a minimized window itself as hidden, not only its controls 937775cd hid every node of a minimized window but its root, and the root is a node of role window that a locator matches, so expect(screen.getByRole('window')).not.toBeVisible() failed for a window in the Dock. The root is hidden too now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): hide what is under a hidden node, a wrapper left out included The resolver reads each node's own hidden state only, and the projection set it from that node's own agent-desktop states. A control under a hidden or off-screen group, and above all under an anonymous one the projection drops and lifts the children of, read as visible: it matched a visible role query, and a pane under it took the window's swipe. Every node under a hidden one is now hidden too, through a dropped wrapper as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep separate ids for interactive and whole reads d0d95a86 made a locator read the whole window while the agent's observations, and the focus check before a key, still read with -i. -i prunes a container that held only text, so the two reads give a control under look-alike containers a different id and different look-alike counts. A press on a located field there failed (the focus check, an -i read, found no match for the whole read's binding), and each locate retired the ids of the observation before it, and each observation those of the locate. The two kinds of read now keep their own identities per window, so neither retires the other's ids, and each binding records which kind gave it, so the focus check reads the control the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep the ids of controls a read cut short did not reach projectWindow retired every identity of the window a read did not see, even when agent-desktop said the read was incomplete (complete: false), so a control still in the window got a new id on the next complete read; a locator that rejected the partial read and read again did the same. A read cut short now retires only the identities it saw a look-alike sibling take, which must never pass their id on; the projection reports those. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): retire an identity two siblings shared, even told apart by name 34101b1b made a read cut short retire only the identities a look-alike took, and reported one only when a control had no identity left at all. Two siblings that share a developer id (AppKit menu items with menuItemSelected:) but differ in name each get a name-qualified identity, so the one keyed by the developer id alone was never reported: a cut read kept it, and the next complete read gave it to whichever sibling remained. Every identity more than one sibling has is now reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): give no reused id to a control whose siblings a read cut off A read that ran out of time lists only some children of the node it was reading. A control that looks unique among those may have a look-alike the read did not reach, and it took that twin's id: row A's new Delete button carried row B's id, so an agent tapping the id it knew reached the wrong row. The children of a node the read cut off (subtree_truncated, or fewer children listed than children_count) now get fresh ids; the next complete read gives the right ones back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): leave a container cut at the depth limit visible when it has no box c2fab331 hid a node with no width or height when it listed no children, taking it for a collapsed leaf. A container cut at the maxDepth limit lists no children either, only children_count, and can still hold drawn children, so it read as hidden. A node with a children_count is no leaf. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): take no screenshot when the window resized after the observed read With snapshot: 'interactive', pixelsFor reads the window whole to place its masks, and checked the capture only against that read. A window that changed size between the interactive read and the whole one went out as a new image beside the old viewport and boxes, which misplaces a point action. A size that differs from the observed read is now a capture that failed: no pixels and no count, and the next capture may work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(changeset): say which screenshots capture again after a failed capture The changeset said a screenshot of a window read only in part, or one that changed size, "is taken again". Only toHaveScreenshot and the agent's observations capture again; a test's own app.screenshot() fails with ENGINE_FAILURE. The lines now say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): count a wrapper's cut-off children when giving its siblings ids 56a94dbc gave fresh ids to the children of a node whose children a read cut off. An anonymous wrapper the projection leaves out can be the one cut off at the depth limit; its unread children are lifted into the parent, and one could be a twin of a listed control, but the parent itself looked complete, so the listed control took an existing id. A wrapper left out with children cut off now counts as a cut in its parent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep no identity for a control whose parent has none A control under a look-alike, or under a node a read cut off, gets an id built on its parent's fresh one, which no later read gives out again. Its identity still went into the identity map, and a read cut short retires nothing it did not see a twin take, so a locator polling a slow window added entries on every read until its timeout, and each read walked the growing map. A child of a node with no stable identity now takes a fresh id without keeping one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): say a focus check was cut short instead of that focus moved agent-desktop flags every ancestor of a read cut short by time, the window included, so since 56a94dbc such a read gives every control a fresh id. The focus check before a key or a replace's delete then found no match and reported "did not keep keyboard focus", though focus never moved. A focus check whose read ran out of time now fails as a read cut short (NODE_STALE), which press reports as ACTION_MAY_HAVE_COMMITTED with the control already focused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): say a run off macOS needs --target to skip the desktop target The note said the other targets of a config with a desktop target run on Windows and Linux while the desktop target fails to start. The engine's prepare refuses the OS, which the runner reports before any target starts, so a run that selects the desktop target runs no test at all. The note now says to pick the other targets with --target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): name AGENT_DESKTOP_HOME among the variables a bundleId app gets The docs listed the variables the app under test gets as a closed set. agent-desktop gets AGENT_DESKTOP_HOME too, and its launch starts an app by bundle id with its own environment, so such an app also sees the path of the worker's private state directory. The docs and the INHERITED_ENV comment now say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): say a window on another Space still reads as visible agent-desktop lists a window on another Space, or of a hidden app, as not on screen, the same way as a minimized one. Only a minimized window reads as hidden, so a user can switch Spaces during a background run without every visibility check failing; kept that way with the maintainer, and said in the Windows row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): correct what pressKey's comment says agent-desktop does The comment said agent-desktop sends the key to the process without focusing its window. pressKey is declared with headed only, and sendKey runs press --window-id --headed, which brings that window forward first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): press a key into a window on another Space, refuse a minimized one A locator press looked for the control's window among the windows agent-desktop lists as visible, so one on another Space, which the rest of the engine reads and drives (6578e8e1), was refused as "gone" after focus had moved. The window is now found among all of the app's windows, a minimized one is refused for what it is, and only another window that is on screen counts against it as a possible key window; press --headed brings the control's window forward. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep point actions on the window of the agent's last image observe() moved the window point actions measure from to the window it read before it took the screenshot. When that screenshot failed, the agent still held the previous window's image and took its points from it, but a point tap measured them in the newly read window and could click another window. The point window now moves only with an observation that delivered its image, or asked for none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): take static text in view as scrolled into view toHaveScreenshot on a locator scrolls its node into view first. The engine sent agent-desktop's scroll-to, which needs a ref, and static text gets none, so expect(screen.getByText('...')).toHaveScreenshot() failed with NOT_ACTIONABLE on a label that was on screen. agent-desktop marks a node outside the window offscreen, which reads as hidden, so a node with no ref that is not hidden is in view already: scrollIntoView does nothing for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): find a focused look-alike by its developer id too before a key dbad285c made holdsFocus match a look-alike field by role, name, place, and the twins around it. A focus handler that replaced the form with one of the same layout and labels but other developer ids (AXIdentifier) passed that check, and the key went to the replacement. A binding now keeps its developer id, and the focused field must carry the same one; the check before a replace's delete uses the same rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): drop the identities of a window the app no longer lists Each read retired only identities of the window it read, so a window that closed kept its identities for the rest of the attempt: an app that opens and closes document windows one after another piled them up, and every read walked the growing map. A read now drops the identities of every window the app's window list no longer has, once that list is known to be whole (after the checks for a quit app and a locked screen). Two tests read a snapshot whose window id the window list never gave out, which agent-desktop does not do (a snapshot is taken by the listed id); their fixtures now agree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): move the point window only with an observation that has an image 47ca501e kept the window point actions measure from when an observation's screenshot failed, but an observation that asked for no image still moved it: a read after an action, which takes no screenshot, set it to a dialog the action opened, and the agent's next point, taken from the image it held of the first window, was clicked in the dialog. Only an observation that delivered an image moves it now; a locator still sets it for a test's own points. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): read again when agent-desktop says a failed read may be retried agent-desktop answers APP_UNRESPONSIVE with details.retryable when the app's window list changed while it read (surface_array_incomplete). The engine took every APP_UNRESPONSIVE for an ENGINE_FAILURE, so app.open() gave up on the first such read instead of reading again within its wait, and a locator did not retry. Such a read is now a retryable NODE_STALE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): read again when a typing or swipe read ran out of time typeText() looked for the focused field, and a swipe on the window for the node that scrolls, in one read, and a read cut short by time that stopped before it failed for good: "no field has keyboard focus" or "the window has nothing that scrolls" (NOT_ACTIONABLE), though nothing was sent and the next read could find it. Such a read is now a retryable NODE_STALE that says what it could not tell, as locate and the focus check already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): say off macOS a run needs --target in the README and JSDoc too ba88098f corrected docs/desktop.mdx: a run that includes the desktop target stops before any test starts off macOS, since prepare refuses the OS. The package README and the desktop() JSDoc still said the other targets run and only the desktop target fails to start; they now say to pick the other targets with --target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(desktop): give each run of the sweep tests launch tokens of its own The sweep tests planted launch records with literal tokens (token-1, token-keep, ...) and children carrying them. The sweep finds a token in any process on the machine, so a second run of the suite at the same time (another checkout, a reviewer, a CI matrix on one host) killed this run's children and failed its assertions. Every token now carries a suffix unique to the file's run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): measure a test's point in the newest read, the agent's in its image b4da3187 let only an observation with an image move the window point actions measure from, for the agent, whose points come from its newest image. A test's point does not: core sizes a percentage point (screen.tapAt({ x: '50%' })) with a read that takes no image, so after a dialog took focus the point was measured in the dialog but clicked in the window a locator read before it. The engine now keeps both: the window of the newest read, for a test's points, and the window of the newest image, for the agent's (origin 'agent'). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): refuse the shortcuts agent-desktop will not press, before focus agent-desktop 1.3.1 refuses cmd+q, cmd+shift+q, ctrl+cmd+q, cmd+alt+escape, cmd+shift+delete, and any combo that adds modifiers to one, with POLICY_DENIED unless --force is passed, which the engine never does. press('ControlOrMeta+q') focused the control and then failed with agent-desktop's advice to pass --force. toCombo now refuses them first, as it refuses a character agent-desktop has no key for, and says to end the app with desktop.closeApp(); the docs' Keys row says so too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): open again after a failed launch that left no process A launch whose outcome was unknown stays pending, and the next quit looks for the process it started. app.open() quits first, so after a launch that timed out and started nothing it spent the wait, found nothing, and failed with "no process it started was found; quit it by hand" without launching. That is worth saying when a test ends; before a new launch there is nothing to clean up, and the launch now goes ahead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): refuse desktop(null) instead of taking it for the defaults resolveOptions turned a null option bag into {} before its own check that the bag is an object, so desktop(null), which a JSON config or an e2e mcp open_session an agent wrote can pass, started with the defaults and hid the mistake. Only a missing bag defaults now; null is INVALID_CONFIG, as mobile() answers it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): measure every point in the newest observation's window, as core does 47ca501e, b4da3187, and f97579ee measured an agent's point in the window of its newest image, so a point after a dialog's observation without an image clicked the window before it. Core aims an agent's point against the newest observation (pointVerb): it clamps the point to that observation's viewport and hit-tests it there, image or not, so the click landed in another window than the one core and the trace named, and a test's own screenshot could move it too. Every observation and locate now moves the point window again, for the agent and a test alike; an agent that still holds an older image is core's to handle. Agreed with the maintainer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): report unproven masking when the read after a capture fails pixelsFor reads the window again after the screenshot to check its secure fields did not move. When that read itself failed (the window answered WINDOW_NOT_FOUND, or could not be read), the error left the capture without UNMASKED, so an image of a window with a password field was dropped as a failed capture with no count, and the agent read that as an engine with no screenshots. With a secure field in the image it is now a withholding for masking (POLICY_DENIED, count 0); a timeout or a cancellation still ends the observation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): take a visible window as scrolled into view The window root, which getByRole('window') resolves to, took only swipe, and toHaveScreenshot on a window locator scrolls its subject into view first, so expect(screen.getByRole('window')).toHaveScreenshot() failed with "the window takes swipe only". A window on screen is in view: the root now takes scrollIntoView as done, and refuses it when the window is minimized or closed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): ask whether the screen is locked within the operation's budget When the app listed no window, a read asked macOS whether the screen is locked with ioreg, outside the operation's budget, and took a failure of that question, a cancellation or a budget run out included, for "cannot tell". A locator then returned no match, as from an empty screen, after its time was up. The question now runs within the budget, and a cancellation or a budget run out ends the read as such. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): name AGENT_DESKTOP_HOME in the README's environment list too a13679ed added it to docs/desktop.mdx and the INHERITED_ENV comment: an app launched by bundleId inherits agent-desktop's environment, which holds the worker's state directory path. The package README, the npm page, still listed the variables the app gets as a closed set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(desktop): shorten the lines this round of fixes added The shortening pass (authoring-docs) on the sections the fixes touched: the AGENT_DESKTOP_HOME sentence, the Physical input, Keys, Windows, Reading, and Secrets rows, and the deep-window screenshot sentence each say their fact once and drop how the engine gets there. 1,519 to 1,421 prose words (main: 1,293). No fact is cut. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(changeset): summarize the desktop fixes as one paragraph The desktop changeset had grown a line per fix, some since reversed, and missed the later ones. It is now one paragraph of what a user sees. The core changeset no longer says the agent stopped asking for pixels for the rest of the session: the presenter only calls that step's pixel-less screens unavailable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): retire twins' identities under the id their parent held before A read cut short gives every node under a cut a fresh id (agent-desktop flags the window itself), and reported the identities two siblings share under that fresh id, while their identities are kept under the id the parent held before. So the shared identity was not retired: a menu item whose twin appeared in a cut read passed its id to the twin in the next complete read. Each node now carries the id it held before, looked up without handing one out, and shared identities are reported under it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Adds
expect(locator).toBeEditable(), Playwright's locator matcher: it waits for an enabled control that is not read-only.SemanticNode.states.readonly), present only where a node has one. The matcher reads it; a disabled node is not editable either, read the same way astoBeEnabled.getReadonlydoes.input,textarea,selectby theirreadonlyattribute alone; an element whose ARIA role takesaria-readonlyby that attribute, case folded (an editing host by its ARIA role, so a plain<div contenteditable>stays editable and atdin a grid reads it); any other editing host and what is inside itfalse.editablecomes fromTextView.isTextEditable(): a text field or search field getsreadonly: !editable, a comboboxreadonly: falseonly when the platform says it takes text. iOS gets no state, because agent-device fills ineditable: truefor every iOS text field from its type.@e2e-dev/coreande2eat>=0.25.0 <1, since they emit a new contract field;toBeEditableneeds those engine releases.packages/core/src/types.ts, pinned intests/types/sdk-types.ts; MCP code surface lists the matcher.reference/expect.mdxand thestatesunion inreference/engine.mdx(en/ja/zh), the Playwright migration table; skill reference updated.Issue
Part of #1855 (Assertions row, assigned).
Verified
Ran it locally: yes
packages/e2e/tests/unit/expect-async-editable.test.ts(10 cases: the engine state read both ways, disabled,editable: false, a node with no state, a secure field).packages/e2e/tests/integration/web-platform.test.tsin Chromium,/editable-matcher: nativereadonly,aria-readonlywith case folding, a fieldset-disabled input, an editing host and a line inside it,aria-readonlyon an input (ignored), a role="textbox" editing host witharia-readonly, a plaincontenteditablewitharia-readonly(editable), a gridtdediting host witharia-readonly(read-only), a button. 50 passed.packages/mobile/tests/unit/nodes.test.ts: Android text fields both ways, Android combobox witheditable: true, iOSTextView/TextFieldwith theeditable: trueagent-device fills in (no state). Whole mobile unit suite 558 passed;@e2e-dev/websuite 856 passed, 1 skipped.pnpm checkclean.Checklist
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it..d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures.e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.