Interface: PointerActions
Defined in: packages/core/src/interactor/Interactor.ts:33
Pointer/mouse-driven, potentially DOM-mutating interactions: the pointer gestures a real user performs with a mouse, plus the two dispatch-based escape hatches (contextMenu, activate) for outcomes ordinary pointer geometry cannot reach, and the drag primitives.
Split out of Interactor as a capability facet (ADR-007) so a driver
can depend on just the pointer surface, and a partial-capability environment
can declare pointer support independently of the rest. Interactor
recomposes this facet unchanged.
Extended by​
Methods​
activate()​
activate(
locator):Promise<void>
Defined in: packages/core/src/interactor/Interactor.ts:87
Activate the desired element without relying on pointer geometry — a coordinate-free, dispatch-based click.
This reaches elements an ordinary click cannot:
a visually-hidden or zero-size input covered by another element (e.g. MUI
Rating's hidden <input type="radio">, where a positional click hit-tests to
the covering star label instead). Prefer click
for ordinary, visible targets.
Parameters​
locator​
Returns​
Promise<void>
click()​
click(
locator,option?):Promise<void>
Defined in: packages/core/src/interactor/Interactor.ts:39
Click on the desired element
Parameters​
locator​
option?​
Partial<ClickOption>
Returns​
Promise<void>
contextMenu()​
contextMenu(
locator):Promise<void>
Defined in: packages/core/src/interactor/Interactor.ts:73
Dispatch a right-click / contextmenu event on the desired element.
A contextmenu event is the only way to open a context menu: such menus have
no aria-expanded toggle or controlled-open prop to flip, so the menu is
reachable only by the event a right-click produces. This is analogous to
pressKey for keyboard-only behaviors — a
dedicated primitive for an outcome no ordinary click
can express. The element is focused first if focusable, mirroring pressKey,
so the event originates from the active element as in a real right-click.
Parameters​
locator​
Returns​
Promise<void>
drag()​
drag(
locator,delta):Promise<void>
Defined in: packages/core/src/interactor/Interactor.ts:135
Drag the desired element by the given pixel delta from its center.
Drives both DnD models, as dragTo does —
see #922. There is no separate drop target for a single-element delta
drag, so the native HTML5 drag-and-drop sequence
(dragstart/dragenter/dragover/drop/dragend) runs on the element
itself, as its own drop target.
jsdom has no layout engine, so the drag has no positional outcome there: the pointer sequence is synthesized from the caller-supplied delta and only the event wiring is exercised. Behavioral assertions about the resulting position are therefore E2E-only; the jsdom path only guarantees the events fire once the element is found.
Parameters​
locator​
Locator of the element to drag
delta​
Pixel offset to drag by, where x is horizontal and y is vertical
Returns​
Promise<void>
dragTo()​
dragTo(
source,target):Promise<void>
Defined in: packages/core/src/interactor/Interactor.ts:115
Drag the source element and drop it onto the target element.
Drives BOTH DnD models on the same gesture, so either kind of component
under test is driven: the pointer sequence
(mousedown/mousemove/mouseup, for pointer-based libraries such as
dnd-kit or react-beautiful-dnd) and native HTML5 drag-and-drop
(dragstart/dragenter/dragover/drop/dragend, sharing one
dataTransfer, for components built on draggable +
ondragstart/ondragover/ondrop) — see #922. The mechanism differs by
environment: Playwright drives a real, low-level pointer gesture that the
browser's own native drag recognition turns into genuine drag* events
with a real DataTransfer (no synthesis needed); jsdom has no browser
layer to recognize a gesture, so DOMInteractor explicitly synthesizes
both event families.
jsdom has no layout engine, so the drag has no positional outcome there:
every event is synthesized at zeroed coordinates and only the event wiring
(and any handler the sequence triggers, including a dataTransfer
payload set in dragstart and read in drop) is exercised. Behavioral
assertions about the final position are therefore E2E-only; the jsdom path
only guarantees the events fire once both elements are found.
Parameters​
source​
Locator of the element to drag
target​
Locator of the element to drop onto
Returns​
Promise<void>
hover()​
hover(
locator,option?):Promise<void>
Defined in: packages/core/src/interactor/Interactor.ts:141
Perform a mouse hover on the desired element
Parameters​
locator​
option?​
Returns​
Promise<void>
mouseDown()​
mouseDown(
locator,option?):Promise<void>
Defined in: packages/core/src/interactor/Interactor.ts:48
Parameters​
locator​
option?​
Partial<MouseDownOption>
Returns​
Promise<void>
mouseEnter()​
mouseEnter(
locator,option?):Promise<void>
Defined in: packages/core/src/interactor/Interactor.ts:56
Parameters​
locator​
option?​
Partial<MouseEnterOption>
Returns​
Promise<void>
mouseLeave()​
mouseLeave(
locator,option?):Promise<void>
Defined in: packages/core/src/interactor/Interactor.ts:58
Parameters​
locator​
option?​
Partial<MouseLeaveOption>
Returns​
Promise<void>
mouseMove()​
mouseMove(
locator,option?):Promise<void>
Defined in: packages/core/src/interactor/Interactor.ts:46
Mouse move on the desired element
Parameters​
locator​
option?​
Partial<MouseMoveOption>
Returns​
Promise<void>
mouseOut()​
mouseOut(
locator,option?):Promise<void>
Defined in: packages/core/src/interactor/Interactor.ts:54
Parameters​
locator​
option?​
Partial<MouseOutOption>
Returns​
Promise<void>
mouseOver()​
mouseOver(
locator,option?):Promise<void>
Defined in: packages/core/src/interactor/Interactor.ts:52
Parameters​
locator​
option?​
Partial<HoverOption>
Returns​
Promise<void>
mouseUp()​
mouseUp(
locator,option?):Promise<void>
Defined in: packages/core/src/interactor/Interactor.ts:50
Parameters​
locator​
option?​
Partial<MouseUpOption>
Returns​
Promise<void>