Class: ReactInteractor
Defined in: react-core/src/ReactInteractor.ts:5
Extends​
DOMInteractor
Constructors​
Constructor​
new ReactInteractor(
rootEl?,option?):ReactInteractor
Defined in: dom-core/dist/index.d.mts:39
Parameters​
rootEl?​
HTMLElement
option?​
DOMInteractorOption
Returns​
ReactInteractor
Inherited from​
DOMInteractor.constructor
Methods​
waitUntil()​
waitUntil<
T>(option):Promise<T>
Defined in: react-core/src/ReactInteractor.ts:83
Flush pending React work with a fresh act() around EACH probe, instead of
one act() around the whole wait loop.
The base routes both wait conditions through DOMInteractor.runInteraction
(#1052), which for React would wrap the ENTIRE probe loop in a single act().
That starves any commit a real timer schedules DURING the wait — MUI X's
debounced filter setState, or a dialog exit transition's unmount timer: the
update is queued onto the surrounding act, but that one act only unwinds when
the loop ends (at timeout), so every probe reads stale DOM and the wait times
out even though the condition has really been met.
Wrapping each probe in its own act() flushes the pending commit right before
every read, so the wait resolves as soon as the condition truly holds. Probes
are reads (no user-event), so the IS_REACT_ACT_ENVIRONMENT pin that
runInteraction needs for the mutation path is unnecessary here — a plain
per-probe act suffices. This deliberately does NOT delegate to the base wait
(which re-imposes the whole-loop act); it drives timingUtil.waitUntil
directly with the per-probe wrapper.
Type Parameters​
T​
T
Parameters​
option​
WaitUntilOption<T>
Returns​
Promise<T>
Overrides​
DOMInteractor.waitUntil
waitUntilComponentState()​
waitUntilComponentState(
locator,option?):Promise<void>
Defined in: react-core/src/ReactInteractor.ts:96
Component-state waits flush per-probe for the same reason as waitUntil.
interactorWaitUtil polls through this interactor's waitUntil, so
delegating to it reuses the per-probe flushing and bypasses the base's
whole-loop runInteraction wrapping.
Parameters​
locator​
PartLocator
option?​
Partial<Readonly<WaitForOption>>
Returns​
Promise<void>
Overrides​
DOMInteractor.waitUntilComponentState
Inherited members (42)
Methods​
activate()​
activate(
locator):Promise<void>
Defined in: dom-core/dist/index.d.mts:213
Activate the element matched by the locator without pointer geometry.
Uses userEvent.click, which ignores layout and coordinates, so it reaches a
visually-hidden or covered input that a positional click would miss (e.g. MUI
Rating's hidden <input type="radio">).
Parameters​
locator​
PartLocator
Locator used to find the target element
Returns​
Promise<void>
Promise resolved once the element has been activated
Throws​
If the element is not found
Inherited from​
DOMInteractor.activate
blur()​
blur(
locator,_option?):Promise<void>
Defined in: dom-core/dist/index.d.mts:159
Remove focus from the element found by the locator.
Parameters​
locator​
PartLocator
Locator used to find the target element
_option?​
Partial<BlurOption>
Reserved for future use
Returns​
Promise<void>
Promise resolved when blur has been applied
Throws​
If the element is not found
Inherited from​
DOMInteractor.blur
click()​
click(
locator,option?):Promise<void>
Defined in: dom-core/dist/index.d.mts:69
Dispatch a click event on the element that matches the locator.
Parameters​
locator​
PartLocator
Locator used to find the target element
option?​
ClickOption
Optional click configuration such as the click position
Returns​
Promise<void>
A promise that resolves after the event is triggered
Throws​
If the element is not found
Inherited from​
DOMInteractor.click
contextMenu()​
contextMenu(
locator):Promise<void>
Defined in: dom-core/dist/index.d.mts:201
Dispatch a contextmenu (right-click) event on the element matched by the locator.
The element is focused first if focusable, mirroring pressKey, so the
event originates from the active element as a real right-click would. A
context menu has no aria-expanded/controlled-open path, so this dispatched
event is the only way to exercise the menu-opening behavior.
Parameters​
locator​
PartLocator
Locator used to find the target element
Returns​
Promise<void>
Promise resolved once the event has been dispatched
Throws​
If the element is not found
Inherited from​
DOMInteractor.contextMenu
drag()​
drag(
locator,delta):Promise<void>
Defined in: dom-core/dist/index.d.mts:348
Drag the located element by the given pixel delta from its center.
The sequence (mousedown at center → mousemove at center + delta →
mouseup at center + delta) is synthesized with the shared
dispatchMouse + calculateMousePosition pattern, using the
caller-supplied delta for the move/up coordinates. jsdom has no layout, so the
center resolves to zeros and only the event wiring is exercised — the
behavioral outcome of the drag is E2E-only.
Only raw mouse events are fired; native HTML5 drag-and-drop is NOT synthesized — see #922.
Parameters​
locator​
PartLocator
Locator used to find the element to drag
delta​
Point
Pixel offset to drag by
Returns​
Promise<void>
Throws​
If the element is not found
Inherited from​
DOMInteractor.drag
dragTo()​
dragTo(
source,target):Promise<void>
Defined in: dom-core/dist/index.d.mts:330
Drag the source element and drop it onto the target element.
The pointer sequence (mousedown on source → mousemove on target →
mouseup on target) is synthesized with the shared dispatchMouse +
calculateMousePosition pattern. jsdom has no layout, so those
coordinates are all zeros — the event wiring (and any drop handler the
sequence triggers) is exercised, but the positional outcome is E2E-only.
Only raw mouse events are fired; native HTML5 drag-and-drop
(dragstart/dragover/drop + dataTransfer) is NOT synthesized, so
components built on the HTML5 DnD API are not driven by this — see #922.
Parameters​
source​
PartLocator
Locator used to find the element to drag
target​
PartLocator
Locator used to find the drop target
Returns​
Promise<void>
Throws​
If either element is not found
Inherited from​
DOMInteractor.dragTo
enterText()​
enterText(
locator,text,option?):Promise<void>
Defined in: dom-core/dist/index.d.mts:223
Type text into the element matched by the locator.
Parameters​
locator​
PartLocator
Locator used to find the target element
text​
string
The string to type
option?​
Partial<EnterTextOption>
Options such as appending or replacing existing value
Returns​
Promise<void>
Promise resolved when typing has completed
Throws​
If the element is not found
Inherited from​
DOMInteractor.enterText
exists()​
exists(
locator):Promise<boolean>
Defined in: dom-core/dist/index.d.mts:351
Parameters​
locator​
PartLocator
Returns​
Promise<boolean>
Inherited from​
DOMInteractor.exists
focus()​
focus(
locator,_option?):Promise<void>
Defined in: dom-core/dist/index.d.mts:150
Move focus to the element found by the locator.
Parameters​
locator​
PartLocator
Locator used to find the target element
_option?​
Partial<FocusOption>
Reserved for future use
Returns​
Promise<void>
Promise resolved when focus has been applied
Throws​
If the element is not found
Inherited from​
DOMInteractor.focus
getAttribute()​
Call Signature​
getAttribute(
locator,name,isMultiple):Promise<readonlystring[]>
Defined in: dom-core/dist/index.d.mts:56
Parameters​
locator​
PartLocator
name​
string
isMultiple​
true
Returns​
Promise<readonly string[]>
Inherited from​
DOMInteractor.getAttribute
Call Signature​
getAttribute(
locator,name,isMultiple):Promise<Optional<string>>
Defined in: dom-core/dist/index.d.mts:57
Parameters​
locator​
PartLocator
name​
string
isMultiple​
false
Returns​
Promise<Optional<string>>
Inherited from​
DOMInteractor.getAttribute
Call Signature​
getAttribute(
locator,name):Promise<Optional<string>>
Defined in: dom-core/dist/index.d.mts:58
Parameters​
locator​
PartLocator
name​
string
Returns​
Promise<Optional<string>>
Inherited from​
DOMInteractor.getAttribute
getBoundingRect()​
getBoundingRect(
locator):Promise<BoundingRect>
Defined in: dom-core/dist/index.d.mts:387
Get the located element's bounding rectangle.
jsdom has no layout engine, so getBoundingClientRect returns all zeros: the
rect is structurally valid but behaviorally meaningless. Real geometry is
E2E-only.
Parameters​
locator​
PartLocator
Locator used to find the element to measure
Returns​
Promise<BoundingRect>
The element's bounding rectangle (a zero-rect under jsdom)
Throws​
If the element is not found
Inherited from​
DOMInteractor.getBoundingRect
getElement()​
Call Signature​
getElement<
T>(locator,isMultiple):Promise<readonlyT[]>
Defined in: dom-core/dist/index.d.mts:359
Type Parameters​
T​
T extends Element = Element
Parameters​
locator​
PartLocator
isMultiple​
true
Returns​
Promise<readonly T[]>
Inherited from​
DOMInteractor.getElement
Call Signature​
getElement<
T>(locator,isMultiple):Promise<Optional<T>>
Defined in: dom-core/dist/index.d.mts:360
Type Parameters​
T​
T extends Element = Element
Parameters​
locator​
PartLocator
isMultiple​
false
Returns​
Promise<Optional<T>>
Inherited from​
DOMInteractor.getElement
Call Signature​
getElement<
T>(locator):Promise<Optional<T>>
Defined in: dom-core/dist/index.d.mts:361
Type Parameters​
T​
T extends Element = Element
Parameters​
locator​
PartLocator
Returns​
Promise<Optional<T>>
Inherited from​
DOMInteractor.getElement
getElementCount()​
getElementCount(
locator):Promise<number>
Defined in: dom-core/dist/index.d.mts:358
Count every element matching the locator — the length of the multi-match
query. Reuses the getElement multiple-overload rather than a second
querySelectorAll path, so the document-root (:root) escape is honored in
exactly one place. A read: it does NOT route through runInteraction.
Parameters​
locator​
PartLocator
Returns​
Promise<number>
Inherited from​
DOMInteractor.getElementCount
getInputValue()​
getInputValue(
locator):Promise<Optional<string>>
Defined in: dom-core/dist/index.d.mts:372
Parameters​
locator​
PartLocator
Returns​
Promise<Optional<string>>
Inherited from​
DOMInteractor.getInputValue
getSelectLabels()​
getSelectLabels(
locator):Promise<Optional<readonlystring[]>>
Defined in: dom-core/dist/index.d.mts:374
Get the select element's selected options' labels
Parameters​
locator​
PartLocator
Returns​
Promise<Optional<readonly string[]>>
Inherited from​
DOMInteractor.getSelectLabels
getSelectValues()​
getSelectValues(
locator):Promise<Optional<readonlystring[]>>
Defined in: dom-core/dist/index.d.mts:373
Get the select element's selected options' values
Parameters​
locator​
PartLocator
Returns​
Promise<Optional<readonly string[]>>
Inherited from​
DOMInteractor.getSelectValues
getStyleValue()​
getStyleValue(
locator,propertyName):Promise<Optional<string>>
Defined in: dom-core/dist/index.d.mts:59
Get the value of a style property
Parameters​
locator​
PartLocator
propertyName​
CssProperty
Returns​
Promise<Optional<string>>
Inherited from​
DOMInteractor.getStyleValue
getText()​
getText(
locator):Promise<Optional<string>>
Defined in: dom-core/dist/index.d.mts:375
Parameters​
locator​
PartLocator
Returns​
Promise<Optional<string>>
Inherited from​
DOMInteractor.getText
hasAttribute()​
hasAttribute(
locator,name):Promise<boolean>
Defined in: dom-core/dist/index.d.mts:395
Parameters​
locator​
PartLocator
name​
string
Returns​
Promise<boolean>
Inherited from​
DOMInteractor.hasAttribute
hasCssClass()​
hasCssClass(
locator,className):Promise<boolean>
Defined in: dom-core/dist/index.d.mts:394
Parameters​
locator​
PartLocator
className​
string
Returns​
Promise<boolean>
Inherited from​
DOMInteractor.hasCssClass
hover()​
hover(
locator,_option?):Promise<void>
Defined in: dom-core/dist/index.d.mts:78
Move the mouse over the element.
Parameters​
locator​
PartLocator
Locator used to find the target element
_option?​
HoverOption
Reserved for future use
Returns​
Promise<void>
A promise that resolves after the hover event
Throws​
If the element is not found
Inherited from​
DOMInteractor.hover
innerHTML()​
innerHTML(
locator):Promise<string>
Defined in: dom-core/dist/index.d.mts:396
Get the HTML of an element
Parameters​
locator​
PartLocator
Returns​
Promise<string>
Inherited from​
DOMInteractor.innerHTML
isChecked()​
isChecked(
locator):Promise<boolean>
Defined in: dom-core/dist/index.d.mts:388
Parameters​
locator​
PartLocator
Returns​
Promise<boolean>
Inherited from​
DOMInteractor.isChecked
isDisabled()​
isDisabled(
locator):Promise<boolean>
Defined in: dom-core/dist/index.d.mts:389
Parameters​
locator​
PartLocator
Returns​
Promise<boolean>
Inherited from​
DOMInteractor.isDisabled
isError()​
isError(
locator):Promise<boolean>
Defined in: dom-core/dist/index.d.mts:392
Whether the element is in an invalid/error state, signalled by
aria-invalid="true" (the cross-widget convention; native validity state is
not consulted).
Parameters​
locator​
PartLocator
Returns​
Promise<boolean>
Inherited from​
DOMInteractor.isError
isReadonly()​
isReadonly(
locator):Promise<boolean>
Defined in: dom-core/dist/index.d.mts:390
Parameters​
locator​
PartLocator
Returns​
Promise<boolean>
Inherited from​
DOMInteractor.isReadonly
isRequired()​
isRequired(
locator):Promise<boolean>
Defined in: dom-core/dist/index.d.mts:391
Whether the element is marked required, via the native required property or
an aria-required="true" attribute.
Parameters​
locator​
PartLocator
Returns​
Promise<boolean>
Inherited from​
DOMInteractor.isRequired
isVisible()​
isVisible(
locator):Promise<boolean>
Defined in: dom-core/dist/index.d.mts:393
Parameters​
locator​
PartLocator
Returns​
Promise<boolean>
Inherited from​
DOMInteractor.isVisible
mouseDown()​
mouseDown(
locator,option?):Promise<void>
Defined in: dom-core/dist/index.d.mts:96
Dispatch a mousedown event on the target element.
Parameters​
locator​
PartLocator
Locator used to find the target element
option?​
Partial<MouseDownOption>
Allows specifying the mouse position relative to the element
Returns​
Promise<void>
Promise resolved when the event is dispatched
Throws​
If the element is not found
Inherited from​
DOMInteractor.mouseDown
mouseEnter()​
mouseEnter(
locator,_option?):Promise<void>
Defined in: dom-core/dist/index.d.mts:132
Dispatch a mouseenter event on the target element.
Parameters​
locator​
PartLocator
Locator used to find the target element
_option?​
Partial<MouseEnterOption>
Reserved for future use
Returns​
Promise<void>
Promise resolved after the event dispatches
Throws​
If the element is not found
Inherited from​
DOMInteractor.mouseEnter
mouseLeave()​
mouseLeave(
locator,_option?):Promise<void>
Defined in: dom-core/dist/index.d.mts:141
Dispatch a mouseleave event on the target element.
Parameters​
locator​
PartLocator
Locator used to find the target element
_option?​
Partial<MouseLeaveOption>
Reserved for future use
Returns​
Promise<void>
Promise resolved once the event is dispatched
Throws​
If the element is not found
Inherited from​
DOMInteractor.mouseLeave
mouseMove()​
mouseMove(
locator,option?):Promise<void>
Defined in: dom-core/dist/index.d.mts:87
Dispatch a mousemove event on the target element.
Parameters​
locator​
PartLocator
Locator used to find the target element
option?​
Partial<MouseMoveOption>
Allows specifying the mouse position relative to the element
Returns​
Promise<void>
A promise that resolves once the event has been dispatched
Throws​
If the element is not found
Inherited from​
DOMInteractor.mouseMove
mouseOut()​
mouseOut(
locator,_option?):Promise<void>
Defined in: dom-core/dist/index.d.mts:123
Dispatch a mouseout event on the target element.
Parameters​
locator​
PartLocator
Locator used to find the target element
_option?​
Partial<MouseOutOption>
Reserved for future use
Returns​
Promise<void>
Promise resolved once the event is dispatched
Throws​
If the element is not found
Inherited from​
DOMInteractor.mouseOut
mouseOver()​
mouseOver(
locator,option?):Promise<void>
Defined in: dom-core/dist/index.d.mts:114
Dispatch a mouseover event on the target element.
Parameters​
locator​
PartLocator
Locator used to find the target element
option?​
Partial<HoverOption>
Optional mouse position relative to the element
Returns​
Promise<void>
Promise resolved once the event is dispatched
Throws​
If the element is not found
Inherited from​
DOMInteractor.mouseOver
mouseUp()​
mouseUp(
locator,option?):Promise<void>
Defined in: dom-core/dist/index.d.mts:105
Dispatch a mouseup event on the target element.
Parameters​
locator​
PartLocator
Locator used to find the target element
option?​
Partial<MouseUpOption>
Allows specifying the mouse position relative to the element
Returns​
Promise<void>
Promise resolved when the event is dispatched
Throws​
If the element is not found
Inherited from​
DOMInteractor.mouseUp
pressKey()​
pressKey(
locator,key,option?):Promise<void>
Defined in: dom-core/dist/index.d.mts:188
Dispatch a key press (keydown + keyup) on the element matched by the locator.
The element is focused first so the key originates from the active element,
matching a real key press. fireEvent is used over userEvent.keyboard for
determinism and because MUI handlers read event.key directly. The physical
code is derived from key (see deriveKeyCode) so handlers that
switch on event.code — e.g. PrimeVue's Slider — behave as they do under a
real browser event, where code is always populated.
Parameters​
locator​
PartLocator
Locator used to find the target element
key​
string
A KeyboardEvent.key value, e.g. 'Escape', 'Backspace'
option?​
Partial<PressKeyOption>
Modifier flags folded into the event init as
ctrlKey/shiftKey/altKey/metaKey, so a handler reading
event.ctrlKey (etc.) sees the chord — see PressKeyOption
Returns​
Promise<void>
Promise resolved once the events have been dispatched
Throws​
If the element is not found
Inherited from​
DOMInteractor.pressKey
scrollBy()​
scrollBy(
locator,delta):Promise<void>
Defined in: dom-core/dist/index.d.mts:306
Scroll the located element by the given pixel delta.
jsdom has no layout engine, so the scroll offset never changes — this is a
no-op behaviorally. As with scrollIntoView, jsdom may not implement
Element.prototype.scrollBy as a function, so the typeof guard prevents a
TypeError and keeps the call a safe no-op that resolves; real scroll
behavior is E2E-only.
Parameters​
locator​
PartLocator
Locator used to find the scrollable element
delta​
Point
Pixel offset to scroll by
Returns​
Promise<void>
Throws​
If the element is not found
Inherited from​
DOMInteractor.scrollBy
scrollIntoView()​
scrollIntoView(
locator):Promise<void>
Defined in: dom-core/dist/index.d.mts:292
Scroll the located element into view.
jsdom has no layout engine, so this never produces an observable scroll —
geometry stays zeroed and nothing becomes "visible". Worse, jsdom does not
implement Element.prototype.scrollIntoView as a function in every version,
so calling it unguarded would throw a TypeError. The typeof guard keeps
this a safe no-op that resolves; real scrolling behavior is E2E-only.
Parameters​
locator​
PartLocator
Locator used to find the element
Returns​
Promise<void>
Throws​
If the element is not found
Inherited from​
DOMInteractor.scrollIntoView
selectOptionValue()​
selectOptionValue(
locator,values):Promise<void>
Defined in: dom-core/dist/index.d.mts:262
Select one or more option values in a <select> element.
Parameters​
locator​
PartLocator
Locator used to find the select element
values​
string[]
Values of the options to select
Returns​
Promise<void>
Promise resolved when the options have been selected
Throws​
If the element is not found
Inherited from​
DOMInteractor.selectOptionValue
setInputFiles()​
setInputFiles(
locator,files):Promise<void>
Defined in: dom-core/dist/index.d.mts:279
Set the selected files on an <input type="file"> element.
The interactor contract passes filesystem paths, but a file input's value
cannot be assigned programmatically — the browser blocks it — so the
FileList must be populated through userEvent.upload, which also fires the
change event. jsdom has no filesystem and never reads file bytes; only
File.name is observable, so each path is wrapped in an empty File named
by its basename. The real bytes matter only to the Playwright layer, which
reads the paths natively — keeping dom-core free of any node dependency.
Parameters​
locator​
PartLocator
Locator used to find the file input element
files​
string | string[]
One or more filesystem paths to upload
Returns​
Promise<void>
Promise resolved once the upload change event has fired
Throws​
If the element is not found
Inherited from​
DOMInteractor.setInputFiles
setRangeValue()​
setRangeValue(
locator,value):Promise<void>
Defined in: dom-core/dist/index.d.mts:253
Set the value of a range input and fire its change event.
fireEvent.change assigns the value through the element's native value
setter (which both sanitizes it to the input's step and lets React's value
tracker observe the change) and dispatches the event so a controlled
component re-renders. Typing (enterText) does not apply to a range input.
Parameters​
locator​
PartLocator
Locator used to find the range input element
value​
number
The numeric value to set
Returns​
Promise<void>
Promise resolved once the change event has fired
Throws​
If the element is not found
Inherited from​
DOMInteractor.setRangeValue
typeText()​
typeText(
locator,text):Promise<void>
Defined in: dom-core/dist/index.d.mts:239
Type text into the element as real per-character keystrokes.
Focuses the element, then dispatches the characters through
userEvent.keyboard, which fires the full key event sequence
(keydown → beforeinput → input → keyup) against the active element —
matching PlaywrightInteractor's pressSequentially (focus + keys, no
pointer event, no clearing). {/[ are doubled so user-event's
descriptor syntax never engages and the text is typed literally.
Parameters​
locator​
PartLocator
Locator used to find the target element
text​
string
The literal text to type, one keystroke per character
Returns​
Promise<void>
Promise resolved once every keystroke has been dispatched
Throws​
If the element is not found
Inherited from​
DOMInteractor.typeText
Protected members (4)
Properties​
rootEl​
protectedreadonlyrootEl:HTMLElement
Defined in: dom-core/dist/index.d.mts:37
Inherited from​
DOMInteractor.rootEl
userEvent​
protectedreadonlyuserEvent:UserEventDispatcher
Defined in: dom-core/dist/index.d.mts:38
Inherited from​
DOMInteractor.userEvent
Methods​
calculateMousePosition()​
protectedcalculateMousePosition(el,preferredPoint?):Point
Defined in: dom-core/dist/index.d.mts:60
Parameters​
el​
Element
preferredPoint?​
Point
Returns​
Point
Inherited from​
DOMInteractor.calculateMousePosition
runInteraction()​
protectedrunInteraction<T>(interaction):Promise<T>
Defined in: react-core/src/ReactInteractor.ts:39
Flush React by running every mutating interaction inside act while holding
the IS_REACT_ACT_ENVIRONMENT global at true for its whole duration. This
is the single seam DOMInteractor routes all mutations through (see
DOMInteractor.runInteraction), so a new mutating primitive added to
the base is flushed here automatically — no per-method override to forget.
The two wait conditions are the deliberate exception: they override the base
to flush per-probe instead of routing through this whole-interaction wrapper
(see waitUntil), because one act around a whole poll loop starves
the very timer-driven commits the loop is waiting for.
@testing-library/react's asyncWrapper (installed into
@testing-library/dom's config, which user-event consults) temporarily
sets IS_REACT_ACT_ENVIRONMENT to false around every async user-event
API call — its contract assumes user-event is NOT already running inside
act. This interactor deliberately nests the whole interaction in act,
so during that window react-dom sees "act queue active, but the act
environment global is false" and logs The current testing environment is not configured to support act(...) for every update scheduled by event
handlers, focus callbacks, or timers. Update-heavy trees (e.g. Radix
primitives) emit thousands of these — enough log volume that CI jest runs
were killed mid-run (the "Test Radix components" CI outage of 2026-07-04,
introduced when #1014 unified the React module graph and made the outer
act queue visible to the components' react-dom).
Pinning the global to true here is truthful, not suppression: every
update in this window IS covered by the surrounding act. Pinning is inert
for the synthetic fireEvent-based primitives (they never trip the
asyncWrapper) and correct for the user-event-backed ones, so unifying
every mutation onto this one wrapper is safe. The original property state is
restored before the method resolves.
Type Parameters​
T​
T
Parameters​
interaction​
() => Promise<T>
Returns​
Promise<T>
Overrides​
DOMInteractor.runInteraction