feat: add expect(locator).toBeEmpty()

Closed
FT
18h ago
+265-16

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, like toHaveValue('')); 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_code MCP surface, the expect reference, 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.ts fails on main (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 with main on the same machine (the existing failures on Windows are unrelated: git/\\.\nul, signals, paths).
  • pnpm check passes.

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/**/*.mdx page for the behavior, and skills/e2e/ if the skill describes it.
  • Contract change: emitted .d.ts reviewed, tests/types/sdk-types.ts updated; wire change edits the schema and both fixtures. (No wire change.)
  • Engine contract change (e2e/engine): n/a