Skip to main content

Class: NavMenuDriver

Defined in: component-driver-astryx/src/components/NavMenuDriver.ts:18

Driver for the Astryx NavMenu (@astryxdesign/core/NavMenu, whose public component is NavHeadingMenu).

NavHeadingMenu renders an inline <div role="menu"> that forwards data-testid; each NavHeadingMenuItem is a role="menuitem" element (an <a> when it has an href, otherwise a <div>). It has no open/close or selected state — it is a flat list of navigation links/actions — so the driver is the menu itself: resolveMenuLocator returns its own root. All item operations (labels, count, click-by-label, disabled, href) come from AstryxMenuDriver, which iterates role="menuitem" children positionally and so copes with the mixed <a>/<div> rendering.

Extends​

Constructors​

Constructor​

new NavMenuDriver(locator, interactor, option?): NavMenuDriver

Defined in: core/dist/index.d.mts:1015

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. See the type-level fixture in @atomic-testing/component-driver-html.

Returns​

NavMenuDriver

Inherited from​

AstryxMenuDriver.constructor

Properties​

commutableOption​

readonly commutableOption: IComponentDriverOption<{ }>

Defined in: core/dist/index.d.mts:999

Option passed to the constructor includes both universal options which can be shared across all component driver tree, and component specific options which are only applicable to the component.

Commutable option is the option that can be shared across all component driver tree.

Inherited from​

AstryxMenuDriver.commutableOption


groupSelector​

protected readonly groupSelector: "[role="group"]" = MENU_GROUP_SELECTOR

Defined in: component-driver-astryx/src/components/AstryxMenuDriver.ts:30

Optional wrapper selector to recurse into (e.g. a role="group" section); flat when omitted.

Inherited from​

AstryxMenuDriver.groupSelector


interactor​

readonly interactor: Interactor

Defined in: core/dist/index.d.mts:990

Inherited from​

AstryxMenuDriver.interactor


itemDriverClass​

protected readonly itemDriverClass: typeof MenuItemDriver = MenuItemDriver

Defined in: component-driver-astryx/src/components/AstryxMenuDriver.ts:29

Driver class constructed for each matched item.

Inherited from​

AstryxMenuDriver.itemDriverClass


itemSelector​

protected readonly itemSelector: "[role="menuitem"]" = MENU_ITEM_SELECTOR

Defined in: component-driver-astryx/src/components/AstryxMenuDriver.ts:28

CSS for one item among the container's children (a single selector, no , union).

Inherited from​

AstryxMenuDriver.itemSelector

Accessors​

driverName​

Get Signature​

get driverName(): string

Defined in: component-driver-astryx/src/components/NavMenuDriver.ts:32

Returns​

string

Overrides​

AstryxMenuDriver.driverName


locator​

Get Signature​

get locator(): PartLocator

Defined in: core/dist/index.d.mts:1044

Return the locator of the component

Returns​

PartLocator

Inherited from​

AstryxMenuDriver.locator


parts​

Get Signature​

get parts(): ScenePartDriver<T>

Defined in: core/dist/index.d.mts:1040

Return driver instance of all the named parts

Returns​

ScenePartDriver<T>

Inherited from​

AstryxMenuDriver.parts

Methods​

activate()​

activate(): Promise<void>

Defined in: core/dist/index.d.mts:1091

Activate the component without relying on pointer geometry. See Interactor.activate.

Returns​

Promise<void>

Inherited from​

AstryxMenuDriver.activate


click()​

click(option?): Promise<void>

Defined in: core/dist/index.d.mts:1068

Parameters​

option?​

Partial<ClickOption>

Returns​

Promise<void>

Inherited from​

AstryxMenuDriver.click


clickItem()​

clickItem(label): Promise<boolean>

Defined in: component-driver-astryx/src/components/NavMenuDriver.ts:28

Click the item whose visible text matches label. Alias of AstryxMenuDriver.selectByLabel that reads as navigation intent.

Parameters​

label​

string

Returns​

Promise<boolean>

false when no such item exists.


contextMenu()​

contextMenu(): Promise<void>

Defined in: core/dist/index.d.mts:1087

Dispatch a right-click / contextmenu event on the component. See Interactor.contextMenu.

Returns​

Promise<void>

Inherited from​

AstryxMenuDriver.contextMenu


drag()​

drag(delta): Promise<void>

Defined in: core/dist/index.d.mts:1129

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​

AstryxMenuDriver.drag


dragTo()​

dragTo(target): Promise<void>

Defined in: core/dist/index.d.mts:1118

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​

AstryxMenuDriver.dragTo


enforcePartExistence()​

protected enforcePartExistence(partName): Promise<void>

Defined in: core/dist/index.d.mts:1050

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​

AstryxMenuDriver.enforcePartExistence


exists()​

exists(): Promise<boolean>

Defined in: core/dist/index.d.mts:1067

Whether the component exists/attached to the DOM

Returns​

Promise<boolean>

true if the component is attached to the DOM, false otherwise

Inherited from​

AstryxMenuDriver.exists


focus()​

focus(option?): Promise<void>

Defined in: core/dist/index.d.mts:1077

Parameters​

option?​

Partial<FocusOption>

Returns​

Promise<void>

Inherited from​

AstryxMenuDriver.focus


getAttribute()​

getAttribute(attributeName): Promise<Optional<string>>

Defined in: core/dist/index.d.mts:1062

Parameters​

attributeName​

string

Returns​

Promise<Optional<string>>

Inherited from​

AstryxMenuDriver.getAttribute


getBoundingRect()​

getBoundingRect(): Promise<BoundingRect>

Defined in: core/dist/index.d.mts:1136

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​

AstryxMenuDriver.getBoundingRect


getItemByLabel()​

getItemByLabel(label): Promise<MenuItemDriver | null>

Defined in: component-driver-astryx/src/internal/PositionalListDriver.ts:73

The item driver whose visible label matches label, or null when absent.

Parameters​

label​

string

Returns​

Promise<MenuItemDriver | null>

Inherited from​

AstryxMenuDriver.getItemByLabel


getItemCount()​

getItemCount(): Promise<number>

Defined in: component-driver-astryx/src/internal/PositionalListDriver.ts:59

Number of items in the list.

Returns​

Promise<number>

Inherited from​

AstryxMenuDriver.getItemCount


getItemHref()​

getItemHref(label): Promise<Optional<string>>

Defined in: component-driver-astryx/src/components/AstryxMenuDriver.ts:50

The href of the item with the given label, or undefined when absent/not a link.

Parameters​

label​

string

Returns​

Promise<Optional<string>>

Inherited from​

AstryxMenuDriver.getItemHref


getItemLabels()​

getItemLabels(): Promise<readonly string[]>

Defined in: component-driver-astryx/src/internal/PositionalListDriver.ts:68

Every item's visible label, in DOM order.

Returns​

Promise<readonly string[]>

Inherited from​

AstryxMenuDriver.getItemLabels


getItems()​

getItems(): Promise<MenuItemDriver[]>

Defined in: component-driver-astryx/src/internal/PositionalListDriver.ts:44

Every item driver, in DOM order.

Returns​

Promise<MenuItemDriver[]>

Inherited from​

AstryxMenuDriver.getItems


getMissingPartNames()​

protected getMissingPartNames(partName): Promise<readonly never[]>

Defined in: core/dist/index.d.mts:1056

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​

AstryxMenuDriver.getMissingPartNames


getText()​

getText(): Promise<Optional<string>>

Defined in: core/dist/index.d.mts:1061

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​

AstryxMenuDriver.getText


hover()​

hover(option?): Promise<void>

Defined in: core/dist/index.d.mts:1069

Parameters​

option?​

Partial<HoverOption>

Returns​

Promise<void>

Inherited from​

AstryxMenuDriver.hover


innerHTML()​

innerHTML(): Promise<string>

Defined in: core/dist/index.d.mts:1168

Get the inner HTML of the component

Returns​

Promise<string>

The inner HTML of the component

Inherited from​

AstryxMenuDriver.innerHTML


isItemDisabled()​

isItemDisabled(label): Promise<boolean>

Defined in: component-driver-astryx/src/components/AstryxMenuDriver.ts:44

Whether the item with the given label is disabled. false when absent.

Parameters​

label​

string

Returns​

Promise<boolean>

Inherited from​

AstryxMenuDriver.isItemDisabled


isVisible()​

isVisible(): Promise<boolean>

Defined in: core/dist/index.d.mts:1145

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​

AstryxMenuDriver.isVisible


mouseDown()​

mouseDown(option?): Promise<void>

Defined in: core/dist/index.d.mts:1071

Parameters​

option?​

Partial<MouseDownOption>

Returns​

Promise<void>

Inherited from​

AstryxMenuDriver.mouseDown


mouseEnter()​

mouseEnter(option?): Promise<void>

Defined in: core/dist/index.d.mts:1075

Parameters​

option?​

Partial<MouseEnterOption>

Returns​

Promise<void>

Inherited from​

AstryxMenuDriver.mouseEnter


mouseLeave()​

mouseLeave(option?): Promise<void>

Defined in: core/dist/index.d.mts:1076

Parameters​

option?​

Partial<MouseLeaveOption>

Returns​

Promise<void>

Inherited from​

AstryxMenuDriver.mouseLeave


mouseMove()​

mouseMove(option?): Promise<void>

Defined in: core/dist/index.d.mts:1070

Parameters​

option?​

Partial<MouseMoveOption>

Returns​

Promise<void>

Inherited from​

AstryxMenuDriver.mouseMove


mouseOut()​

mouseOut(option?): Promise<void>

Defined in: core/dist/index.d.mts:1074

Parameters​

option?​

Partial<MouseOutOption>

Returns​

Promise<void>

Inherited from​

AstryxMenuDriver.mouseOut


mouseOver()​

mouseOver(option?): Promise<void>

Defined in: core/dist/index.d.mts:1073

Parameters​

option?​

Partial<HoverOption>

Returns​

Promise<void>

Inherited from​

AstryxMenuDriver.mouseOver


mouseUp()​

mouseUp(option?): Promise<void>

Defined in: core/dist/index.d.mts:1072

Parameters​

option?​

Partial<MouseUpOption>

Returns​

Promise<void>

Inherited from​

AstryxMenuDriver.mouseUp


pressKey()​

pressKey(key, option?): Promise<void>

Defined in: core/dist/index.d.mts:1083

Dispatch a keyboard key press on the component. See Interactor.pressKey.

Parameters​

key​

string

A KeyboardEvent.key value, e.g. 'Escape', 'Backspace', 'Enter'

option?​

Partial<PressKeyOption>

Reserved for future modifier-key support

Returns​

Promise<void>

Inherited from​

AstryxMenuDriver.pressKey


resolveListContainer()​

protected resolveListContainer(): Promise<PartLocator | null>

Defined in: component-driver-astryx/src/components/AstryxMenuDriver.ts:39

The element whose children are the list items, or null when it cannot be resolved (e.g. a closed menu with no aria-controls).

Returns​

Promise<PartLocator | null>

Inherited from​

AstryxMenuDriver.resolveListContainer


resolveMenuLocator()​

protected resolveMenuLocator(): Promise<PartLocator>

Defined in: component-driver-astryx/src/components/NavMenuDriver.ts:19

The role="menu" element whose role="menuitem" children are this menu's items, or null when it cannot be resolved (e.g. a closed menu with no aria-controls).

Returns​

Promise<PartLocator>

Overrides​

AstryxMenuDriver.resolveMenuLocator


runtimeCssSelector()​

runtimeCssSelector(): Promise<string>

Defined in: core/dist/index.d.mts:1174

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​

AstryxMenuDriver.runtimeCssSelector


scrollBy()​

scrollBy(delta): Promise<void>

Defined in: core/dist/index.d.mts:1107

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​

AstryxMenuDriver.scrollBy


scrollIntoView()​

scrollIntoView(): Promise<void>

Defined in: core/dist/index.d.mts:1098

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​

AstryxMenuDriver.scrollIntoView


selectByLabel()​

selectByLabel(label): Promise<boolean>

Defined in: component-driver-astryx/src/internal/PositionalListDriver.ts:86

Click the item whose visible label matches label.

Parameters​

label​

string

Returns​

Promise<boolean>

false when no such item exists.

Inherited from​

AstryxMenuDriver.selectByLabel


waitUntil()​

waitUntil<T>(option): Promise<T>

Defined in: core/dist/index.d.mts:1163

Type Parameters​

T​

T

Parameters​

option​

WaitUntilOption<T>

Returns​

Promise<T>

Inherited from​

AstryxMenuDriver.waitUntil


waitUntilComponentState()​

waitUntilComponentState(option?): Promise<void>

Defined in: core/dist/index.d.mts:1162

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​

AstryxMenuDriver.waitUntilComponentState


waitUntilVisible()​

waitUntilVisible(timeoutMs?): Promise<void>

Defined in: core/dist/index.d.mts:1150

Wait until the component is attached and becomes visible to the DOM.

Parameters​

timeoutMs?​

number

The number of milliseconds to wait before timing out

Returns​

Promise<void>

Inherited from​

AstryxMenuDriver.waitUntilVisible


overriddenParentLocator()​

static overriddenParentLocator(): Optional<PartLocator>

Defined in: core/dist/index.d.mts:1026

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.

Returns​

Optional<PartLocator>

Inherited from​

AstryxMenuDriver.overriddenParentLocator


overrideLocatorRelativePosition()​

static overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>

Defined in: core/dist/index.d.mts:1036

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.

Returns​

Optional<LocatorRelativePosition>

Inherited from​

AstryxMenuDriver.overrideLocatorRelativePosition