Repository navigation
Conversation
A form control is empty when its raw value is '', any other node when its normalized text is ''. Part of e2e-inc#1855.
There was a problem hiding this comment.
All reported issues were addressed across 14 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
…nd migration notes An option carries a value but is not a field the user fills in, so one with a label and no reported value is not empty. Docs: list toBeEmpty under secure fields and rendered-text reads, and qualify the Cypress be.empty mapping.
There was a problem hiding this comment.
0 issues found across 7 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Requires human review: Auto-approval blocked by 2 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
…mpty # Conflicts: # docs/migrate/playwright.mdx # packages/e2e/tests/integration/scripted-matchers.test.ts # packages/e2e/tests/unit/mcp-code-parse.test.ts # plugins/e2e/skills/e2e/references/writing-tests.md # skills/e2e/references/writing-tests.md
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Reviewed bedb131. Diff is CI-safe, fork CI approved. The matcher shape matches its siblings (readOptions, poll, readsWithheld), but on a real page it passes on elements that visibly show text, so it doesn't behave as Playwright's toBeEmpty as the changeset says.
Must-fix
-
Value vs text is decided by role (
packages/e2e/src/expect/async.ts:565-567,readContent). Playwright decides by tag:INPUT/TEXTAREAare empty whenvalueis empty, anything else whentextContent.trim()is empty. A node with a value role and no reported value reads as''. Built the PR and ran these through the CLI on Chromium; every one passestoBeEmpty()here and fails in Playwright:Element this PR Playwright <button role="combobox">Select a fruit</button>(Radix Select trigger)empty not empty <ul role="listbox"><li role="option">Apple</li></ul>empty not empty <div role="textbox">hello</div>empty not empty <select><option value="">Choose a colour</option>...empty not empty <input type=submit value="Go">empty not empty <input type=checkbox>empty not empty The
role !== 'option'carve-out patches one case of the wrong discriminator. A plainnode.value ?? textbreaks mobile, where an empty field'stextis its label (packages/mobile/src/nodes.ts:598-604).SemanticNodehas no tag, so the node alone can't answer this. Emptiness probably needs to be an engine-side read, like Playwright'selementState. Please hold for a maintainer call on the shape before rewriting (see below). -
No real-browser test. Add cases to
packages/e2e/tests/integration/web-platform.test.ts, as #1857 did fortoHaveRole: ARIA combobox and listbox, native select, contenteditable, whitespace-only value. Those would have caught 1.
Should-fix
- On mobile,
textis the node's own label, so a container with labeled children may read as empty while web reads descendants. Either test it or document it. - Drop "as Playwright has it" from the changeset and
expect.mdxunless it holds, or list the differences. - cubic's two open threads (migrate row
{ ignoreCase }, Cypressbe.emptymeaning) are still unresolved.
Maintainer questions: engine-side emptiness read vs a narrower node rule with documented differences; whether a native <select> should copy Playwright (never empty when it has options) or mean "no selected value"; mobile support in scope.
… from Playwright
Add an /empty-matcher fixture page and web-platform cases: empty fields
and blank text, and the six elements from review. The contenteditable
textbox already matches Playwright; the ARIA combobox and listbox, native
select, submit input and checkbox read as empty here, so they are marked
as known differences until emptiness is read engine-side.
Drop 'as Playwright has it' from the changeset, give toBeEmpty its own
row in the Playwright migration table ({ timeout } only), list the
differences there, and note the mobile container case.
|
Thanks for the detailed review and the table. I'm holding the rewrite until you pick the shape. In the meantime, b07a1d6 does the parts that don't depend on it:
On your questions, my view:
|
There was a problem hiding this comment.
All reported issues were addressed across 5 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 b07a1d6, test-merged onto main fabb0c0. Thanks for holding the rewrite. The new tests and docs are accurate, and the earlier asks that don't depend on the shape decision are done: real-browser cases, changeset wording, the migrate row with { timeout } only, the Cypress be.empty qualifier, and the mobile container note. Must-fix 1 from the last review (value vs text decided by role) is still open and waits on Oskar's call on the shape.
Must fix
- Translations break after merging main.
docs/jaanddocs/zhlanded on main after this branch's base. On the merge,node scripts/check-docs-translations.tsfails:docs/{ja,zh}/reference/expect.mdx: heading #14 is h3, the English page has h4andcode block #8 differs. Fix: merge main, then add the#### toBeEmptyheading and its code block to both translatedreference/expect.mdxpages, in the same position as the English page. Mirroring the new migrate rows indocs/{ja,zh}/migrate/{playwright,cypress}.mdxwould be nice, but the check doesn't require it.
Should fix
web-platform.test.ts:559(cubic, real):it.fails.eachpasses on any throw. If someone renames a case or breaks the fixture,resultByTitlethrows "no result titled ...", and that throw counts as the expected failure. I confirmed that all five cases fail today withASSERTION_FAILED(expect.not.toBeEmpty failed), so the current tests are correct, just easy to break without anyone noticing. Fix: dropit.failsand assert the current behavior directly,expect(result.status).toBe('failed')andexpect(result.attempts[0]?.error?.code).toBe('ASSERTION_FAILED'), then flip each case topassedwhen it matches.- The
role="textbox"case from the earlier table was swapped for acontenteditableone.<div role="textbox">hello</div>withoutcontenteditablestill reads as empty here: I added it to the fixture locally and it failsnot.toBeEmpty()withASSERTION_FAILED. So "the contenteditable textbox already matches" is true, but the non-editable ARIA textbox is a sixth difference. Add it to the known-difference cases and to the list indocs/migrate/playwright.mdx.
Nits
docs/migrate/playwright.mdx:363(cubic, real): "a node with a value role reads its value" should mention thatoptionis the exception and reads its text, asexpect.mdxalready says.
Verified: vitest run of web-platform, scripted-matchers, expect-async-empty, expect-async-options, and mcp-code-parse gave 172 passed and 5 expected fails. Mutants: dropping normalizeText and dropping the option carve-out each fail a unit test. The integration blank-div case does not catch the first one. CI on b07a1d6 has spec, mobile, docs, docs translations, and benchmark at action_required (fork approval pending), so none of them have run on this head.
The main rewrite still waits on the maintainer's shape call (engine-side read by tag like Playwright vs role-based node rule). The translations fix can land now.
…d docs Merge main, add toBeEmpty to the ja and zh expect reference pages so the translation check matches the English outline, replace it.fails with direct ASSERTION_FAILED checks, cover a non-editable ARIA textbox, and note that an option reads its text.
|
Thanks for the re-check. Pushed 76eea00:
The |
There was a problem hiding this comment.
0 issues found across 5 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Requires human review: Auto-approval blocked by 2 unresolved issues from previous reviews.
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 76eea00 (based on main 847a09e). Every ask from the last review that doesn't depend on the shape decision is done. The main must-fix, deciding value vs text by role instead of by tag like Playwright, is still open and waits on the maintainer's call.
Done
- Translations:
docs/{ja,zh}/reference/expect.mdxhave#### toBeEmptyin the right spot.check-docs-translationsreports 162 of 162 pages matching. it.fails.eachis gone. Each known difference now assertsfailed+ASSERTION_FAILED. Mutant: renaming one case title now fails that test, where before it would have counted as an expected failure.- The non-editable
<div role="textbox">hello</div>is in the fixture, in the difference list, and indocs/migrate/playwright.mdx. - The
optionexception is in the migrate bullet.
Still open (waits on the shape decision)
packages/e2e/src/expect/async.ts:577(readContent): role-based value vs text, from the first review. No change requested until the maintainer picks engine-side read vs node rule.
Nits
async.ts:571: thereadContentJSDoc still says "as Playwright's does". The changeset and docs dropped that claim, so drop it here too.
Verified
vitest runof web-platform, scripted-matchers, expect-async-empty, expect-async-options, mcp-code-parse: 178 passed. oxlint on the changed source and test file is clean. No dashes in added lines.- CI on 76eea00: spec, mobile, docs, docs translations, and benchmark are
action_required(fork approval pending), so none of them have run on this head. Only check, pr-size, pr-policy, and cubic ran, and all passed.
|
Dropped "as Playwright's does" from the |
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.
Requires human review: Auto-approval blocked by 2 unresolved issues from previous reviews.
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 5aba6e4 and test-merged it onto main 8eb3cc2. The merge is clean, so no rebase is needed. The only new commit removes "as Playwright's does" from the readContent comment, which was the nit from the last review. Every ask that doesn't depend on the shape decision is now done.
Still open (waits on the maintainer's shape call)
packages/e2e/src/expect/async.ts:577(readContent) still decides value vs text by role. I re-checked Playwright's matcher in playwright-core's injected script: anINPUTorTEXTAREAis empty when!element.value, and any other element is empty when!element.textContent?.trim(). So the six known differences listed indocs/migrate/playwright.mdxand asserted inweb-platform.test.tsstill apply. There is nothing to change until the maintainer picks between an engine-side read by tag and the current node rule with documented differences.
Must fix
None that doesn't depend on the shape decision.
Verified
- On the merge with main:
vitest runof expect-async-empty, expect-async-options, mcp-code-parse, scripted-matchers and web-platform gave 179 passed.tsc --noEmiton packages/e2e is clean, and so is oxlint on the changed source and test files.check-docs-translationsreports 180 of 180 pages matching. No dashes in added lines. - Mutant: dropping the value branch in
readContentfails 2 unit tests. - Floors:
AsyncExpectationis implemented only ine2e, which pins@e2e-dev/coreasworkspace:*. Web and mobile don't implement it, so no peer floor change is needed. - CI on 5aba6e4: only check, cubic, drop and label have run, and all passed. spec, mobile, docs, docs translations and benchmark are
action_required(fork approval pending), so the suites haven't run on this head.
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked 7582a16 and test-merged it onto main 5acb822. The merge is clean. The only new commit is a merge of main, and the PR diff is the same as at 5aba6e4. Every ask that doesn't depend on the shape decision is still done.
Still open (waits on the maintainer's shape call)
packages/e2e/src/expect/async.ts:577(readContent) still decides value vs text by role. I checked Playwright's matcher again in playwright-core 1.65.1: anINPUTorTEXTAREAis empty when!element.value, and any other element is empty when!element.textContent?.trim(). So the six differences listed indocs/migrate/playwright.mdxand asserted inweb-platform.test.tsstill apply.
Must fix
- None that doesn't depend on the shape decision.
Should fix
- The cubic thread on
docs/migrate/cypress.mdxis still unresolved. You fixed it in 01c3d28 and replied, so please resolve the thread./readyrefuses while a thread is open.
Verified
- On the merge with main:
vitest runof expect-async-empty, expect-async-options, mcp-code-parse, scripted-matchers and web-platform gave 179 passed.tsc --noEmiton packages/e2e is clean, oxlint on the changed files is clean, and the translation check passes. No dashes in added lines. - Mutant: dropping the value branch in
readContentfails 2 unit tests. - Floors: none needed.
toBeEmptylives onAsyncExpectation. Onlye2eimplements it, ande2edepends on@e2e-dev/coreasworkspace:*, which publishes as an exact version. Web, mobile and desktop don't implement it, so no peer needs>=0.25.0. - CI on 7582a16: everything is green except spec
check(and sospec gate). It failed one Playwright parity test,apps/testbed/tests/locator-frame.e2e.ts:78"should wait for frame to go", which timed out ontoBeHiddenafter an iframe was removed. That test has nothing to do with this PR, which doesn't touch frames ortoBeHidden, and spec passed on the last 8 main runs. It looks like a flake, so a re-run should clear it.testx5, ios/android deterministic, web, docs, translations and benchmark all passed.
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Rebase hint at f65722e: main now conflicts after #1998 (run_code runs real JavaScript). That PR deleted packages/e2e/src/session-tools/code-surface.ts and packages/e2e/tests/unit/mcp-code-parse.test.ts, the run_code grammar this PR extended with toBeEmpty. Resolve by accepting the deletion of both files and dropping the toBeEmpty: matcher(0, 1) entry: run_code now calls the real expect, so toBeEmpty works there with no extra wiring. The rest merges cleanly. The earlier hold on the by-tag vs by-role shape still stands, so no new code asks.
* feat(expect): add expect(locator).toBeEmpty() Imported from #1869 (head f65722e), squashed onto main. The run_code grammar entry is dropped: #1998 deleted code-surface.ts, and run_code now calls the real expect. * fix(expect): read toBeEmpty's emptiness from the engine toBeEmpty decided value vs text by role in core, since a semantic node has no tag, so an ARIA combobox or listbox, a non-editable ARIA textbox, a native select, a submit input, and a checkbox all read as empty where Playwright finds them not empty. Engines now report an empty node state on located nodes, never in an observation and never on a secure field. The web engine reads it in the page as Playwright does: an input or textarea by its raw value, any other element by its trimmed text content. The mobile engine reads a text field by its value and any other node by the text and values in its subtree. toBeEmpty reads only that state, like toBeEditable reads readonly, and fails either way where an engine reports none (desktop, older engines). The empty state stays out of state-matcher failure messages and MCP locate output. * docs(expect): leave the secure-field rule to its table in toBeEmpty * fix(web,mobile): close toBeEmpty's cross-frame and child-field gaps - Web: read an input or textarea by tag name, as Playwright does. A filled input adopted from another frame failed instanceof, fell through to its empty text content, and passed toBeEmpty. - Mobile: a field below a container counts by its value alone and a secure one not at all, so a container holding only an empty field with a label or hint is empty, and a filled password field is not told. - Document that iOS reports a field Flutter or Compose Multiplatform draws as a plain view, so its placeholder counts. --------- Co-authored-by: ftaakash <gsaakash@outlook.com>
|
Note This text was drafted with AI and posted after human approval.
Thank you for this work, @ftaakash. #2219 also closed the open shape question from the reviews here. On the web, the engine now decides value or text by tag, as Playwright does. An I am closing this PR because #2219 replaces it. Thanks again for the tests and the docs work. |
What and why
toBeEmpty()locator matcher from the ☂️ Help us bring missing APIs to e2e #1855 checklist (Assertions,expect(locator).toBeEmpty()).''(read raw, so' 'is not empty; a control the platform reports without a value counts as empty, liketoHaveValue('')); any other node is empty when its normalized text is''.timeout, works with.not, and is denied on a secure field like the other value/text matchers.run_codeMCP surface, theexpectreference, the Playwright and Cypress migration guides (moved out of "What e2e doesn't have yet"), and the skill's matcher list.Issue
Part of #1855 (Assertions:
expect(locator).toBeEmpty()).Verified
Ran it locally: yes (Windows 11, Node 24.19, pnpm 12.3.4)
tests/unit/expect-async-empty.test.tsfails onmain(toBeEmpty is not a function) and passes with the change.pnpm --filter e2e exec vitest run tests/unit/expect-async-empty.test.ts tests/unit/expect-async-options.test.ts tests/unit/expect-async-value.test.ts tests/unit/mcp-code-parse.test.ts tests/integration/scripted-matchers.test.ts: all pass.pnpm --filter e2e test: no new failures compared withmainon the same machine (the existing failures on Windows are unrelated: git/\\.\nul, signals, paths).pnpm checkpasses.Checklist
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.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. (No wire change.)e2e/engine): n/a