Class: ComplexSelectorDriver
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:45
Driver for the Astryx ComplexSelector (@astryxdesign/core/ComplexSelector),
added in Astryx 0.3.0.
ComplexSelector is a shell, not a listbox: it owns an accessible trigger and
a dialog popup, and the caller renders whatever goes inside (a grid of swatches,
a nested form, a two-pane picker). So this driver covers the shell — the trigger's
text and state, and opening/closing — and hands the popup's interior to the scene
through the inherited ComponentDriver.within, which resolves a
caller-supplied ScenePart against interiorLocator (ADR-019).
The scene anchors on the root <div>, which self-emits data-testid plus
data-size/data-status. Inside it the <button aria-haspopup="dialog"> carries
aria-expanded, aria-controls, aria-labelledby, aria-required,
aria-invalid, aria-busy and the native disabled — every read here is one of
those, never a StyleX-hashed class.
Popup visibility is native-popover behaviour that jsdom does not model, so —
as with the rest of the Astryx overlay family — isOpen reads the
React-state-driven aria-expanded (faithful everywhere) while what a user can
actually see is the E2E run's concern. The popup content is always mounted, so
within(...) parts read in both environments.
There is deliberately no tooltip read here, unlike the field-input drivers.
ComplexSelector has no disabledMessage prop, and it composes the trigger's
aria-describedby from the description and status ids only — so a
role="tooltip" probe over that list can never match. Its one tooltip,
labelTooltip, belongs to the Field label's info control rather than the
trigger; reach that through the label if a scene needs it.
Extends​
ComponentDriver<{ }>
Constructors​
Constructor​
new ComplexSelectorDriver(
locator,interactor,option?):ComplexSelectorDriver
Defined in: core/dist/index.d.mts:1374
Parameters​
locator​
PartLocator
Locator for the root of this component.
interactor​
Interactor
Environment adapter used for all interactions.
option?​
Partial<IComponentDriverOption<{ }>>
Driver option carrying the shared driver-tree context.
Composite-driver authoring rule: a driver that declares non-empty parts
must type this parameter as Partial<IComponentDriverOption> (i.e. the empty
<{}> default) and hardcode its own parts in the body —
super(locator, interactor, { ...option, parts }). The "natural"
Partial<IComponentDriverOption<typeof parts>> signature does NOT satisfy
ScenePartDefinition['driver'] (constructor parameters are checked
contravariantly), so a driver written that way could not be placed in a
parent ScenePart. Lock a composite driver against this rule in one line with
AssertScenePlaceableDriver; the rule itself is regression-tested
centrally in core/src/drivers/__type-tests__ and demonstrated in
@atomic-testing/component-driver-html.
Returns​
ComplexSelectorDriver
Inherited from​
ComponentDriver<{}>.constructor
Accessors​
driverName​
Get Signature​
get driverName():
string
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:177
Returns​
string
Overrides​
ComponentDriver.driverName
Methods​
close()​
close():
Promise<void>
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:96
Close the popup if it is open.
Returns​
Promise<void>
getDescription()​
getDescription():
Promise<Optional<string>>
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:163
The field's description text, resolved through the trigger's
aria-describedby — the target without a data-type marker (that one is
the status message). undefined when the field carries no description.
Returns​
Promise<Optional<string>>
getLabel()​
getLabel():
Promise<Optional<string>>
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:71
The selector's visible label, resolved through the trigger's aria-labelledby
→ the Field label element.
Returns​
Promise<Optional<string>>
getSize()​
getSize():
Promise<Optional<string>>
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:129
The size token from the root's data-size.
Returns​
Promise<Optional<string>>
getStatus()​
getStatus():
Promise<Optional<string>>
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:134
The validation severity from the root's data-status, or undefined when there is none.
Returns​
Promise<Optional<string>>
getStatusMessage()​
getStatusMessage():
Promise<Optional<string>>
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:144
The status.message text, resolved through the trigger's composed
aria-describedby — the id list also carries the description, so this picks
the target carrying FieldStatus's data-type severity marker, matching
AstryxFieldInputDriver.getStatusMessage.
Returns​
Promise<Optional<string>>
getTriggerText()​
getTriggerText():
Promise<Optional<string>>
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:79
The trigger's displayed text — the caller's triggerLabel when a value is
selected, otherwise the placeholder.
Returns​
Promise<Optional<string>>
isBusy()​
isBusy():
Promise<boolean>
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:124
Whether a changeAction is still in flight (aria-busy="true").
ComplexSelector runs changeAction inside a transition and shows the
optimistic value while it is pending, so this is how a test waits for the
commit rather than for a spinner to appear.
Returns​
Promise<boolean>
isDisabled()​
isDisabled():
Promise<boolean>
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:103
Whether the trigger is disabled (native disabled).
Returns​
Promise<boolean>
isInvalid()​
isInvalid():
Promise<boolean>
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:113
Whether the field is in an error state (aria-invalid="true").
Returns​
Promise<boolean>
isOpen()​
isOpen():
Promise<boolean>
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:84
Whether the popup is open (aria-expanded on the trigger).
Returns​
Promise<boolean>
isRequired()​
isRequired():
Promise<boolean>
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:108
Whether the field is required (aria-required="true").
Returns​
Promise<boolean>
open()​
open():
Promise<void>
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:89
Open the popup if it is not already open.
Returns​
Promise<void>
Inherited members (21)
Properties​
commutableOption​
readonlycommutableOption:CommutableComponentDriverOption
Defined in: core/dist/index.d.mts:1356
The component-agnostic slice of the constructor option that is safe to share
across the whole driver tree — everything the constructor received EXCEPT the
component-specific parts, which each driver owns for itself. Parent drivers
pass this straight to the constructors of children they create dynamically
(see the list helpers). See CommutableComponentDriverOption.
Inherited from​
ComponentDriver.commutableOption
interactor​
readonlyinteractor:Interactor
Defined in: core/dist/index.d.mts:1346
Inherited from​
ComponentDriver.interactor
Accessors​
locator​
Get Signature​
get locator():
PartLocator
Defined in: core/dist/index.d.mts:1414
Return the locator of the component
Returns​
PartLocator
Inherited from​
ComponentDriver.locator
parts​
Get Signature​
get parts():
ScenePartDriver<T>
Defined in: core/dist/index.d.mts:1410
Return driver instance of all the named parts
Returns​
ScenePartDriver<T>
Inherited from​
ComponentDriver.parts
Methods​
click()​
click(
option?):Promise<void>
Defined in: core/dist/index.d.mts:1492
Parameters​
option?​
Partial<ClickOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.click
exists()​
exists():
Promise<boolean>
Defined in: core/dist/index.d.mts:1491
Whether the component exists/attached to the DOM
Returns​
Promise<boolean>
true if the component is attached to the DOM, false otherwise
Inherited from​
ComponentDriver.exists
focus()​
focus(
option?):Promise<void>
Defined in: core/dist/index.d.mts:1501
Parameters​
option?​
Partial<FocusOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.focus
getAttribute()​
getAttribute(
attributeName):Promise<Optional<string>>
Defined in: core/dist/index.d.mts:1486
Parameters​
attributeName​
string
Returns​
Promise<Optional<string>>
Inherited from​
ComponentDriver.getAttribute
getText()​
getText():
Promise<Optional<string>>
Defined in: core/dist/index.d.mts:1485
Get the combined text content of the component
Returns​
Promise<Optional<string>>
If the component exists and has content, it should return the text or otherwise undefined
Inherited from​
ComponentDriver.getText
hover()​
hover(
option?):Promise<void>
Defined in: core/dist/index.d.mts:1493
Parameters​
option?​
Partial<HoverOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.hover
isVisible()​
isVisible():
Promise<boolean>
Defined in: core/dist/index.d.mts:1576
Whether the component is visible. Visibility is defined
that the component does not have the CSS property display: none,
visibility: hidden, or opacity: 0. However this does not
check whether the component is within the viewport.
Returns​
Promise<boolean>
true if the component is visible, false otherwise
Inherited from​
ComponentDriver.isVisible
pressKey()​
pressKey(
key,option?):Promise<void>
Defined in: core/dist/index.d.mts:1508
Dispatch a keyboard key press on the component. See Interactor.pressKey for the full contract, including modifier-key delivery via PressKeyOption.
Parameters​
key​
string
A KeyboardEvent.key value, e.g. 'Escape', 'Backspace', 'Enter'
option?​
Partial<PressKeyOption>
Modifier flags and other per-press options — see PressKeyOption
Returns​
Promise<void>
Inherited from​
ComponentDriver.pressKey
runtimeCssSelector()​
runtimeCssSelector():
Promise<string>
Defined in: core/dist/index.d.mts:1641
Get the runtime CSS selector of the component. This is useful for debugging and testing purposes.
Returns​
Promise<string>
The runtime CSS selector of the component
Inherited from​
ComponentDriver.runtimeCssSelector
scrollIntoView()​
scrollIntoView():
Promise<void>
Defined in: core/dist/index.d.mts:1529
Scroll the component into the viewport. See Interactor.scrollIntoView.
jsdom has no layout engine, so the scroll is a no-op there and behavioral assertions (visibility, offset) are E2E-only.
Returns​
Promise<void>
Inherited from​
ComponentDriver.scrollIntoView
typeText()​
typeText(
text):Promise<void>
Defined in: core/dist/index.d.mts:1514
Type text into the component as real per-character keystrokes, inserting at the current caret without clearing. See Interactor.typeText.
Parameters​
text​
string
The literal text to type, one keystroke per character
Returns​
Promise<void>
Inherited from​
ComponentDriver.typeText
waitUntil()​
waitUntil<
T>(option):Promise<T>
Defined in: core/dist/index.d.mts:1596
Type Parameters​
T​
T
Parameters​
option​
WaitUntilOption<T>
Returns​
Promise<T>
Inherited from​
ComponentDriver.waitUntil
waitUntilComponentState()​
waitUntilComponentState(
option?):Promise<void>
Defined in: core/dist/index.d.mts:1595
Wait until the component is in the expected state such as the component's visibility or existence. If the component has not reached the expected state within the timeout, it will throw an error.
By default it waits until the component is attached to the DOM within 30 seconds.
Parameters​
option?​
Partial<Readonly<WaitForOption>>
The option to configure the wait behavior
Returns​
Promise<void>
Inherited from​
ComponentDriver.waitUntilComponentState
waitUntilVisible()​
waitUntilVisible(
timeoutMs?):Promise<void>
Defined in: core/dist/index.d.mts:1583
Wait until the component is attached and becomes visible to the DOM.
Parameters​
timeoutMs?​
number
The number of milliseconds to wait before timing out. Defaults to defaultWaitForOption.timeoutMs so this wait shares a single flake-tolerance source with waitUntilComponentState (#1057).
Returns​
Promise<void>
Inherited from​
ComponentDriver.waitUntilVisible
within()​
within<
ContentT>(parts):ScenePartDriver<ContentT>
Defined in: core/dist/index.d.mts:1468
Driver instances for a caller-supplied interior scene, resolved against this component's ComponentDriver.interiorLocator.
The call-time counterpart to ComponentDriver.parts: parts is the
chrome the driver author hardcodes, this is the interior the scene author
owns — a dialog's body, a popover's panel, a toast's action area. A
PartLocator resolves lazily and queries nothing here, so this is
synchronous and safe to call before the interior has mounted.
This replaced an earlier ContainerDriver base whose content option
required the same scene to be named twice — once as a type argument, once in
the driver option — plus a laundering constructor in every subclass (ADR-019).
Named within rather than getContent because leaf drivers already own that
name for reading a component's own text (a badge's content, a tooltip's
content), and a base-class member cannot collide with them.
Interior children are constructed with an empty option, exactly as content
parts always have been: an interior belongs to the scene, so it inherits no
driver-specific configuration from its host. This differs deliberately from
ComponentDriver.parts, whose children do inherit the host's option.
Type Parameters​
ContentT​
ContentT extends ScenePart
Parameters​
parts​
ContentT
The interior scene to resolve against this component's interior
Returns​
ScenePartDriver<ContentT>
One driver instance per named part
Inherited from​
ComponentDriver.within
overriddenParentLocator()​
staticoverriddenParentLocator(_option?):Optional<PartLocator>
Defined in: core/dist/index.d.mts:1393
Portal hook: where to re-root this driver's locator when its component renders
outside the parent's DOM (a modal, popup, drawer). Return the PartLocator
that locates the component from the document root, or undefined (the default)
for normal in-tree components whose locator chains from the parent.
This is static because it is per-class metadata read off the constructor
before any instance exists — which makes the "no instance state" constraint
structural rather than a documented caution. Override with static override.
option is the fully-merged constructor option the driver is about to receive
(the same value passed to the driver's own constructor) — a purely static,
per-invocation input, not instance state — so a driver whose portalling is
conditional on how its scene configures it (e.g. an overlay that can render
teleported OR in-tree, such as PrimeVue's appendTo="self") can branch on a
flag there instead of always re-rooting. Ignore it to keep unconditional
portal behavior.
Parameters​
_option?​
Partial<IComponentDriverOption<any>>
Returns​
Optional<PartLocator>
Inherited from​
ComponentDriver.overriddenParentLocator
overrideLocatorRelativePosition()​
staticoverrideLocatorRelativePosition(_option?):Optional<LocatorRelativePosition>
Defined in: core/dist/index.d.mts:1406
Portal hook: the locator relative position to apply when the component's real
DOM is a sibling/elsewhere rather than a descendant (e.g. a MUI dialog rendered
at the document root, located by a "Same"-level selector). Return undefined
(the default) to keep the natural position declared by the ScenePart.
Static for the same reason as ComponentDriver.overriddenParentLocator:
it is class-level metadata read before construction. Override with static override.
See ComponentDriver.overriddenParentLocator for what option carries
and why accepting it does not reintroduce instance state.
Parameters​
_option?​
Partial<IComponentDriverOption<any>>
Returns​
Optional<LocatorRelativePosition>
Inherited from​
ComponentDriver.overrideLocatorRelativePosition
Protected members (19)
Accessors​
interiorLocator​
Get Signature​
get
protectedinteriorLocator():PartLocator
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:60
The popup's content box, resolved through the trigger's aria-controls → the
content id.
A linked locator rather than a class or a Root-scoped id interpolation:
it is lazy (nothing is queried until a part resolves, which is what keeps
within synchronous) and it is instance-safe — two ComplexSelectors on one
page each resolve their own popup, which the shared
astryx-complex-selector-popup surface class could not distinguish.
Returns​
PartLocator
Overrides​
ComponentDriver.interiorLocator
trigger​
Get Signature​
get
protectedtrigger():PartLocator
Defined in: component-driver-astryx/src/components/ComplexSelectorDriver.ts:46
Returns​
PartLocator
Methods​
activate()​
protectedactivate():Promise<void>
Defined in: core/dist/index.d.mts:1522
Activate the component without relying on pointer geometry. See Interactor.activate.
Returns​
Promise<void>
Inherited from​
ComponentDriver.activate
awaitPostcondition()​
protectedawaitPostcondition(postcondition,probeFn,option?):Promise<void>
Defined in: core/dist/index.d.mts:1628
Hold an action open until its own postcondition holds, so the action does not resolve while the DOM it promised is still arriving.
Why actions, not reads or assertions. An interactor settles the
framework's scheduler after a write (React act(), Vue nextTick(),
Angular whenStable()) and then treats the DOM as final. A component that
defers its own DOM work onto a host timer — a setTimeout to re-register a
select's options, to restore a picker's section spans — lands after that
settle, so the next single-shot read observes a transient state that is
neither the old value nor the new one. Making reads retry cannot fix this
(a read does not know what it is waiting for, and negative reads must stay
fast); making every mutation drain a fixed extra macrotask is a sleep at
framework scale. The action is the only layer that knows what it promised,
so the action is where the wait belongs.
Probing uses waitUntil's escalating intervals, so a postcondition that already holds costs one probe and no delay.
Parameters​
postcondition​
string
Human-readable description of the awaited state, used verbatim in PostconditionNotMetError. Phrase it as the state that must arrive, not the action taken.
probeFn​
() => boolean | Promise<boolean>
Returns true once the postcondition holds. Keep it cheap — it runs repeatedly.
option?​
timeoutMs?​
number
Defaults to defaultWaitForOption.timeoutMs so every wait in the library shares one flake-tolerance source (#1057).
Returns​
Promise<void>
Throws​
If the postcondition never holds. Failing here is deliberate: an action that cannot keep its promise is a real defect, and reporting it at the action gives a far better diagnostic than the downstream assertion mismatch it would otherwise become.
Inherited from​
ComponentDriver.awaitPostcondition
contextMenu()​
protectedcontextMenu():Promise<void>
Defined in: core/dist/index.d.mts:1518
Dispatch a right-click / contextmenu event on the component. See Interactor.contextMenu.
Returns​
Promise<void>
Inherited from​
ComponentDriver.contextMenu
drag()​
protecteddrag(delta):Promise<void>
Defined in: core/dist/index.d.mts:1560
Drag this component by the given pixel delta from its center. See Interactor.drag.
Prefer a keyboard-driven setValue over a true drag in real drivers — these
drag primitives exist only for cases keyboard cannot express (e.g. panning a
Lightbox, reordering a column). jsdom has no layout engine, so the positional
outcome of the drag is E2E-only there.
Parameters​
delta​
Point
Pixel offset to drag by
Returns​
Promise<void>
Inherited from​
ComponentDriver.drag
dragTo()​
protecteddragTo(target):Promise<void>
Defined in: core/dist/index.d.mts:1549
Drag this component and drop it onto another component. See Interactor.dragTo.
Prefer a keyboard-driven setValue over a true drag in real drivers — these
drag primitives exist only for cases keyboard cannot express (e.g. panning a
Lightbox, reordering a column). jsdom has no layout engine, so the positional
outcome of the drag is E2E-only there.
Parameters​
target​
ComponentDriver<any>
Another driver whose root element is the drop target
Returns​
Promise<void>
Inherited from​
ComponentDriver.dragTo
enforcePartExistence()​
protectedenforcePartExistence(partName):Promise<void>
Defined in: core/dist/index.d.mts:1474
Check the specified parts' existences, and throw MissingPartError if any of the part is found not existence. Existence is defined by the part's existence in the DOM regardless of its visibility on the screen
Parameters​
partName​
readonly never[]
Single or array of the names of the parts to be enforced
Returns​
Promise<void>
Inherited from​
ComponentDriver.enforcePartExistence
getBoundingRect()​
protectedgetBoundingRect():Promise<BoundingRect>
Defined in: core/dist/index.d.mts:1567
Get this component's bounding rectangle. See Interactor.getBoundingRect.
jsdom has no layout engine, so every coordinate and dimension is 0 there;
real geometry is E2E-only.
Returns​
Promise<BoundingRect>
Inherited from​
ComponentDriver.getBoundingRect
getMissingPartNames()​
protectedgetMissingPartNames(partName):Promise<readonlynever[]>
Defined in: core/dist/index.d.mts:1480
Get the names of parts not in the DOM
Parameters​
partName​
readonly never[]
Single or array of the names of the parts to be examined
Returns​
Promise<readonly never[]>
Inherited from​
ComponentDriver.getMissingPartNames
innerHTML()​
protectedinnerHTML():Promise<string>
Defined in: core/dist/index.d.mts:1635
Get the inner HTML of the component
Returns​
Promise<string>
The inner HTML of the component
Inherited from​
ComponentDriver.innerHTML
mouseDown()​
protectedmouseDown(option?):Promise<void>
Defined in: core/dist/index.d.mts:1495
Parameters​
option?​
Partial<MouseDownOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.mouseDown
mouseEnter()​
protectedmouseEnter(option?):Promise<void>
Defined in: core/dist/index.d.mts:1499
Parameters​
option?​
Partial<MouseEnterOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.mouseEnter
mouseLeave()​
protectedmouseLeave(option?):Promise<void>
Defined in: core/dist/index.d.mts:1500
Parameters​
option?​
Partial<MouseLeaveOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.mouseLeave
mouseMove()​
protectedmouseMove(option?):Promise<void>
Defined in: core/dist/index.d.mts:1494
Parameters​
option?​
Partial<MouseMoveOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.mouseMove
mouseOut()​
protectedmouseOut(option?):Promise<void>
Defined in: core/dist/index.d.mts:1498
Parameters​
option?​
Partial<MouseOutOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.mouseOut
mouseOver()​
protectedmouseOver(option?):Promise<void>
Defined in: core/dist/index.d.mts:1497
Parameters​
option?​
Partial<HoverOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.mouseOver
mouseUp()​
protectedmouseUp(option?):Promise<void>
Defined in: core/dist/index.d.mts:1496
Parameters​
option?​
Partial<MouseUpOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.mouseUp
scrollBy()​
protectedscrollBy(delta):Promise<void>
Defined in: core/dist/index.d.mts:1538
Scroll the component by the given pixel delta. See Interactor.scrollBy.
jsdom has no layout engine, so the scroll is a no-op there and behavioral assertions (resulting offset) are E2E-only.
Parameters​
delta​
Point
Pixel offset to scroll by
Returns​
Promise<void>
Inherited from​
ComponentDriver.scrollBy