feat: add expect(locator).toBeEmpty()
Closed
FT
18h ago+265+265+012345678901234567890123456789-16-16-01234567890123456789
What and why
- Adds the
toBeEmpty()locator matcher from the #1855 checklist (Assertions,expect(locator).toBeEmpty()). - Same rule as Playwright: a form control is empty when its value is
''(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''. - Takes only
timeout, works with.not, and is denied on a secure field like the other value/text matchers. - Added to the
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)
- New
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
- Changeset added (
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only. - Breaking change: n/a
- Docs updated in the same PR: the
docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. (No wire change.) - Engine contract change (
e2e/engine): n/a