Class: SelectDriver
@atomic-testing/component-driver-mui-v5.SelectDriver
Hierarchy
-
ComponentDriver
<SelectScenePart
>↳
SelectDriver
Implements
IInputDriver
<string
|null
>
Constructors
constructor
• new SelectDriver(locator
, interactor
, option?
): SelectDriver
Parameters
Name | Type |
---|---|
locator | PartLocator |
interactor | Interactor |
option? | Partial <IComponentDriverOption <>> |
Returns
Overrides
ComponentDriver<SelectScenePart>.constructor
Defined in
packages/component-driver-mui-v5/src/components/SelectDriver.ts:58
Properties
commutableOption
• Readonly
commutableOption: IComponentDriverOption
<{ dropdown
: { driver
: typeof HTMLElementDriver
= HTMLElementDriver; locator
: CssLocator
} ; input
: { driver
: typeof HTMLTextInputDriver
= HTMLTextInputDriver; locator
: CssLocator
} ; nativeSelect
: { driver
: typeof HTMLSelectDriver
= HTMLSelectDriver; locator
: CssLocator
} ; trigger
: { driver
: typeof HTMLButtonDriver
= HTMLButtonDriver; locator
: CssLocator
} }>
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
ComponentDriver.commutableOption
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:19
interactor
• Readonly
interactor: Interactor
Inherited from
ComponentDriver.interactor
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:10
Accessors
driverName
• get
driverName(): string
Returns
string
Overrides
ComponentDriver.driverName
Defined in
packages/component-driver-mui-v5/src/components/SelectDriver.ts:221
locator
• get
locator(): PartLocator
Return the locator of the component
Returns
PartLocator
Inherited from
ComponentDriver.locator
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:50
parts
• get
parts(): ScenePartDriver
<T
>
Return driver instance of all the named parts
Returns
ScenePartDriver
<T
>
Inherited from
ComponentDriver.parts
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:46
Methods
click
▸ click(option?
): Promise
<void
>
Parameters
Name | Type |
---|---|
option? | Partial <ClickOption > |
Returns
Promise
<void
>
Inherited from
ComponentDriver.click
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:74
closeDropdown
▸ closeDropdown(): Promise
<void
>
Returns
Promise
<void
>
Defined in
packages/component-driver-mui-v5/src/components/SelectDriver.ts:192
enforcePartExistence
▸ enforcePartExistence(partName
): Promise
<void
>
Check the specified parts' existences, and throw MissPartError 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
Name | Type | Description |
---|---|---|
partName | "input" | "dropdown" | "trigger" | "nativeSelect" | readonly ("input" | "dropdown" | "trigger" | "nativeSelect" )[] | Single or array of the names of the parts to be enforced |
Returns
Promise
<void
>
Inherited from
ComponentDriver.enforcePartExistence
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:56
exists
▸ exists(): Promise
<boolean
>
Returns
Promise
<boolean
>
Overrides
ComponentDriver.exists
Defined in
packages/component-driver-mui-v5/src/components/SelectDriver.ts:161
focus
▸ focus(option?
): Promise
<void
>
Parameters
Name | Type |
---|---|
option? | Partial <FocusOption > |
Returns
Promise
<void
>
Inherited from
ComponentDriver.focus
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:83
getAttribute
▸ getAttribute(attributeName
): Promise
<Optional
<string
>>
Parameters
Name | Type |
---|---|
attributeName | string |
Returns
Promise
<Optional
<string
>>
Inherited from
ComponentDriver.getAttribute
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:68
getMenuItemByLabel
▸ getMenuItemByLabel(label
, option?
): Promise
<null
| MenuItemDriver
>
Select menu item by its label, if it exists Limitation, this method will not work if the dropdown is a native select.
Parameters
Name | Type |
---|---|
label | string |
option? | MenuItemGetOption |
Returns
Promise
<null
| MenuItemDriver
>
Defined in
packages/component-driver-mui-v5/src/components/SelectDriver.ts:109
getMissingPartNames
▸ getMissingPartNames(partName
): Promise
<readonly ("input"
| "dropdown"
| "trigger"
| "nativeSelect"
)[]>
Get the names of parts not in the DOM
Parameters
Name | Type | Description |
---|---|---|
partName | "input" | "dropdown" | "trigger" | "nativeSelect" | readonly ("input" | "dropdown" | "trigger" | "nativeSelect" )[] | Single or array of the names of the parts to be examined |
Returns
Promise
<readonly ("input"
| "dropdown"
| "trigger"
| "nativeSelect"
)[]>
Inherited from
ComponentDriver.getMissingPartNames
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:62
getSelectedLabel
▸ getSelectedLabel(): Promise
<null
| string
>
Returns
Promise
<null
| string
>
Defined in
packages/component-driver-mui-v5/src/components/SelectDriver.ts:150
getText
▸ getText(): Promise
<Optional
<string
>>
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
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:67
getValue
▸ getValue(): Promise
<null
| string
>
Returns
Promise
<null
| string
>
Implementation of
IInputDriver.getValue
Defined in
packages/component-driver-mui-v5/src/components/SelectDriver.ts:69
hover
▸ hover(option?
): Promise
<void
>
Parameters
Name | Type |
---|---|
option? | Partial <HoverOption > |
Returns
Promise
<void
>
Inherited from
ComponentDriver.hover
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:75
isDisabled
▸ isDisabled(): Promise
<boolean
>
Returns
Promise
<boolean
>
Defined in
packages/component-driver-mui-v5/src/components/SelectDriver.ts:200
isDropdownOpen
▸ isDropdownOpen(): Promise
<boolean
>
Check if the dropdown is open, or if it is a native select, it is always open because there is no known way check its open state
Returns
Promise
<boolean
>
For native dropdown it is always true. For custom dropdown, it is true if the dropdown is open.
Defined in
packages/component-driver-mui-v5/src/components/SelectDriver.ts:175
isNative
▸ isNative(): Promise
<boolean
>
Returns
Promise
<boolean
>
Defined in
packages/component-driver-mui-v5/src/components/SelectDriver.ts:64
isReadonly
▸ isReadonly(): Promise
<boolean
>
Returns
Promise
<boolean
>
Defined in
packages/component-driver-mui-v5/src/components/SelectDriver.ts:211
isVisible
▸ isVisible(): Promise
<boolean
>
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 wether the component is within the viewport.
Returns
Promise
<boolean
>
true if the component is visible, false otherwise
Inherited from
ComponentDriver.isVisible
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:92
mouseDown
▸ mouseDown(option?
): Promise
<void
>
Parameters
Name | Type |
---|---|
option? | Partial <MouseDownOption > |
Returns
Promise
<void
>
Inherited from
ComponentDriver.mouseDown
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:77
mouseEnter
▸ mouseEnter(option?
): Promise
<void
>
Parameters
Name | Type |
---|---|
option? | Partial <MouseEnterOption > |
Returns
Promise
<void
>
Inherited from
ComponentDriver.mouseEnter
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:81
mouseLeave
▸ mouseLeave(option?
): Promise
<void
>
Parameters
Name | Type |
---|---|
option? | Partial <MouseLeaveOption > |
Returns
Promise
<void
>
Inherited from
ComponentDriver.mouseLeave
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:82
mouseMove
▸ mouseMove(option?
): Promise
<void
>
Parameters
Name | Type |
---|---|
option? | Partial <MouseMoveOption > |
Returns
Promise
<void
>
Inherited from
ComponentDriver.mouseMove
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:76
mouseOut
▸ mouseOut(option?
): Promise
<void
>
Parameters
Name | Type |
---|---|
option? | Partial <MouseOutOption > |
Returns
Promise
<void
>
Inherited from
ComponentDriver.mouseOut
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:80
mouseOver
▸ mouseOver(option?
): Promise
<void
>
Parameters
Name | Type |
---|---|
option? | Partial <HoverOption > |
Returns
Promise
<void
>
Inherited from
ComponentDriver.mouseOver
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:79
mouseUp
▸ mouseUp(option?
): Promise
<void
>
Parameters
Name | Type |
---|---|
option? | Partial <MouseUpOption > |
Returns
Promise
<void
>
Inherited from
ComponentDriver.mouseUp
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:78
openDropdown
▸ openDropdown(): Promise
<void
>
Returns
Promise
<void
>
Defined in
packages/component-driver-mui-v5/src/components/SelectDriver.ts:184
overriddenParentLocator
▸ overriddenParentLocator(): Optional
<PartLocator
>
Usually this should be undefined as the component driver corresponds to a component nested inside the parent DOM, thus the driver's locator would automatically chain with its parent's locator.
When the component is rendered outside the parent's DOM, which usually happens when the component is a modal or popup, supply the PartLocator on how to locate the component with the component's own locator.
Caution of usage: this function is called before the construction of the driver, so it should not use any instance properties
Returns
Optional
<PartLocator
>
Inherited from
ComponentDriver.overriddenParentLocator
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:30
overrideLocatorRelativePosition
▸ overrideLocatorRelativePosition(): Optional
<LocatorRelativePosition
>
Usually this should be undefined when the locator is defined by the ScenePart, thus it reflects the natural relative position of the component
However, in some implementation such as MUI v5 dialog, the actual dialog DOM is rendered outside the parent DOM, and the selector is "siblings", by defining this function, it allows the driver to have the knowledge of the actual relative position instead of offloading the knowledge to the consumer.
Caution of usage: this function is called before the construction of the driver, so it should not use any instance properties
Returns
Optional
<LocatorRelativePosition
>
Inherited from
ComponentDriver.overrideLocatorRelativePosition
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:42
selectByLabel
▸ selectByLabel(label
): Promise
<void
>
Selects an option by its label
Parameters
Name | Type |
---|---|
label | string |
Returns
Promise
<void
>
Defined in
packages/component-driver-mui-v5/src/components/SelectDriver.ts:130
setValue
▸ setValue(value
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
value | null | string |
Returns
Promise
<boolean
>
Implementation of
IInputDriver.setValue
Defined in
packages/component-driver-mui-v5/src/components/SelectDriver.ts:81
waitUntil
▸ waitUntil(option?
): Promise
<void
>
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
Name | Type | Description |
---|---|---|
option? | Partial <Readonly <WaitForOption >> | The option to configure the wait behavior |
Returns
Promise
<void
>
Inherited from
ComponentDriver.waitUntil
Defined in
packages/core/build/src/drivers/ComponentDriver.d.ts:104