feat(locator): add blur for web elements

Merged
WE
5d ago
+199-30

What and why

  • Add locator.blur({ timeout? }) for web tests that need to trigger focus-loss behavior on a specific element.
  • Declare the new action only when the web engine's core supports it. Keep the original action list stable so an older web engine does not advertise blur.
const email = screen.getByLabel('Email');
await email.fill('ada@example.test');
await email.blur();
await expect(email).not.toBeFocused();

Issue

Part of #1855. Assigned to @WellDunDun.

Verified

Ran it locally: yes, with the built CLI and Chromium.

  • e2e run tests/controls.e2e.ts --grep blur --video verifies the focused input loses focus, another input keeps focus when the target was already unfocused, and a locator matched by value can blur an input even if the app overrides its instance method.
  • Full testbed: 590 passed, 1 skipped. Deterministic web benchmark: 93 passed.
Test Files  1 passed (1)
     Tests  2 passed (2)