feat(locator): tap a node count times with tap({ count })
Merged
PR
1d ago+483+483+012345678901234567890123456789-69-69-01234567890123456789
What and why
locator.tap({ count })andclick({ count })tapcounttimes in a row: Detox'smultiTap(n)and Playwright'sclickCount.countis any positive safe integer; each engine keeps its own limit.count: 1is a plain tap.count: 2sends the existingdoubleTapaction, so it does whatdoubleTap()does on every engine. Its step is labelled… 2 times, like 3 or more.- 3 or more go through a new
multiTapaction kind{ count, modifiers? }. Following #1883, it isn't inLOCATOR_ACTION_KINDS(SPI v1); web and mobile list it explicitly. An engine without it fails withUNSUPPORTED_CAPABILITYbefore lookup instead of tapping once.- Web:
click({ clickCount }), one sequence with a risingdetail, so a triple click selects a paragraph. - Mobile: agent-device
press({ count }),countpresses at thedoubleTapcadence. Mobile refuses more than 200 (agent-device's limit) withUNSUPPORTED_CAPABILITYbefore pressing.
- Web:
- A count above 1 beside
positionisINVALID_ARGUMENT, asmodifiersbesidepositionis (as agreed in #1855).
await screen.getByText('Shipping address').tap({ count: 3 });
Issue
Part of #1855, item locator.tap({ count: 3 }) under Locators and actions. @okwasniewski
Verified
Ran it locally: yes, except the mobile benchmark, which ran in CI (see below).
- After merging
main(5ab9121):pnpm checkpasses, and the e2e (6,048), web (1,055) and mobile (633) suites pass. Core'sprovider-credentials.test.ts"leaves a provider key no pattern can be built for alone" times out at 30 s here, and fails the same way on a cleanmaincheckout, so it isn't from this PR. - Unit (
locator-action-options.test.ts): count 1 →tapwith a bare label; 2 →doubleTaplabelled… 2 times; 3+ → onemultiTap; modifiers carried;Number.MAX_SAFE_INTEGERpasses through; an engine withoutmultiTaprefused before lookup; bad counts and a count above 1 withpositionrefused before lookup;count: 1withpositionstill taps at the point. - Engine protocol: a served engine declaring
multiTapadvertises it, and{ kind: 'multiTap', count: 3, modifiers: ['Shift'] }reaches it unchanged over JSON-RPC. The valid manifest fixture listsmultiTap. - Chromium (
web/tests/integration/tap-actions.test.ts):clickdetail1, 2, 3 in one sequence, a triple click selects a paragraph, Shift held for each click. - Mobile:
multiTapmaps tointeractions.press({ count }); count 201 is refused with no device call at all, 200 goes through. - Testbed on the built CLI: Playwright's "should select the text by triple clicking" is ported into
click.e2e.tsand passes. - Mutation checks: each new rule (count 2 label, count 1 label, the mobile 200 guard and its placement, count 1 with
position) fails a test when broken. - Device:
apps/mobile-benchmark/tests/controls.e2e.tsadds "tap({ count: 3 }) lands three presses" on "Double-tap me", expecting "3 taps". I couldn't run it locally (no Xcode or Android SDK); it passed in CI on both the iOS simulator and the Android emulator with the real agent-device at fb1a25e. It checks that three presses arrive, not that the app reads them as one triple-tap gesture. Not tried on a physical device.
Checklist
- Changeset added (core, e2e, web, mobile).
- Breaking change: n/a.
- Mobile benchmark test added (runs in CI).
- Docs updated:
reference/screen.mdx,reference/engine.mdx,reference/mobile.mdx,migrate/detox.mdx,migrate/playwright.mdx,skills/e2e/(ja/zh synced, except themigrate/detoxrows). - Contract change:
tests/types/sdk-types.tsupdated; engine manifest schema and valid fixture listmultiTap. - Engine contract change: changesets for
e2e,@e2e-dev/web, and@e2e-dev/mobile.