feat(screen): accept percent points in tapAt, doubleTapAt, and swipe
RE
1h ago+231+231+012345678901234567890123456789-51-51-01234567890123456789
What and why
screen.tapAt({ x: '50%', y: '50%' })now taps the middle of the screen. Works fordoubleTapAtandswipetoo.- Plain numbers are still pixels without additional overhead.
- Unlike Maestro, decimals work too:
'12.5%'rounds to the nearest pixel.
Issue
Part of #1855 (screen.tapAt({ x: '50%', y: '50%' }) row).
Verified
Ran it locally: yes
-
Web, testbed,
e2e run tests/pointer.e2e.ts. -
iOS, iPhone 17 Pro, mobile benchmark's Control Inventory. Not run on Android.
-
An out-of-range percentage fails before the screen is read:
INVALID_ARGUMENT: tapAt takes a percentage from '0%' through '100%', got "120%" -
Perf: percent point costs one screen read. Median per
tapAt, M4, pixel and percent taps alternating:surface pixels percent extra web, testbed /pointer5.3 ms 10.2 ms +4.9 ms web, 1,000 buttons 26.1 ms 50.5 ms +24.4 ms web, 5,000 buttons 56.6 ms 107.7 ms +51.1 ms iOS simulator 720 ms 877 ms +157 ms
Videos: web testbed and iOS
https://github.com/user-attachments/assets/aea6c12a-c7dc-490a-9972-9cff095db83a
https://github.com/user-attachments/assets/991390c4-d200-4fa4-ae49-815ee6d9c091
Checklist
- Changeset added (
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only. - Breaking change: title carries
!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md). - 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. - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.