Class: abstract
ContainerDriver<ContentT, T>
Defined in: packages/core/src/drivers/ContainerDriver.ts:8
Base class for all component drivers. It provides the basic functionality to interact with the component
Extends
Type Parameters
ContentT
ContentT
extends ScenePart
T
T
extends ScenePart
= { }
Implements
IComponentDriver
<T
>
Constructors
Constructor
new ContainerDriver<
ContentT
,T
>(locator
,interactor
,option
?):ContainerDriver
<ContentT
,T
>
Defined in: packages/core/src/drivers/ContainerDriver.ts:14
Parameters
locator
interactor
option?
Partial
<IContainerDriverOption
<ContentT
, T
>>
Returns
ContainerDriver
<ContentT
, T
>
Overrides
Properties
commutableOption
readonly
commutableOption:IComponentDriverOption
<T
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:37
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
interactor
readonly
interactor:Interactor
Defined in: packages/core/src/drivers/ComponentDriver.ts:41
Inherited from
Accessors
content
Get Signature
get content():
ScenePartDriver
<ContentT
>
Defined in: packages/core/src/drivers/ContainerDriver.ts:29
Returns
ScenePartDriver
<ContentT
>
driverName
Get Signature
get
abstract
driverName():string
Defined in: packages/core/src/drivers/ComponentDriver.ts:256
Returns
string
Inherited from
locator
Get Signature
get locator():
PartLocator
Defined in: packages/core/src/drivers/ComponentDriver.ts:90
Return the locator of the component
Returns
Implementation of
IComponentDriver.locator
Inherited from
parts
Get Signature
get parts():
ScenePartDriver
<T
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:83
Return driver instance of all the named parts
Returns
Implementation of
IComponentDriver.parts
Inherited from
Methods
click()
click(
option
?):Promise
<void
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:157
Parameters
option?
Partial
<ClickOption
>
Returns
Promise
<void
>
Inherited from
enforcePartExistence()
protected
enforcePartExistence(partName
):Promise
<void
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:99
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
partName
Single or array of the names of the parts to be enforced
keyof T
| readonly keyof T
[]
Returns
Promise
<void
>
Inherited from
ComponentDriver
.enforcePartExistence
exists()
exists():
Promise
<boolean
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:153
Whether the component exists/attached to the DOM
Returns
Promise
<boolean
>
true if the component is attached to the DOM, false otherwise
Implementation of
IComponentDriver.exists
Inherited from
focus()
focus(
option
?):Promise
<void
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:193
Parameters
option?
Partial
<FocusOption
>
Returns
Promise
<void
>
Inherited from
getAttribute()
getAttribute(
attributeName
):Promise
<Optional
<string
>>
Defined in: packages/core/src/drivers/ComponentDriver.ts:145
Parameters
attributeName
string
Returns
Promise
<Optional
<string
>>
Inherited from
getMissingPartNames()
protected
getMissingPartNames(partName
):Promise
<readonly keyofT
[]>
Defined in: packages/core/src/drivers/ComponentDriver.ts:112
Get the names of parts not in the DOM
Parameters
partName
Single or array of the names of the parts to be examined
keyof T
| readonly keyof T
[]
Returns
Promise
<readonly keyof T
[]>
Inherited from
ComponentDriver
.getMissingPartNames
getText()
getText():
Promise
<Optional
<string
>>
Defined in: packages/core/src/drivers/ComponentDriver.ts:141
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
Implementation of
IComponentDriver.getText
Inherited from
hover()
hover(
option
?):Promise
<void
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:161
Parameters
option?
Partial
<HoverOption
>
Returns
Promise
<void
>
Inherited from
innerHTML()
innerHTML():
Promise
<string
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:243
Get the inner HTML of the component
Returns
Promise
<string
>
The inner HTML of the component
Inherited from
isVisible()
isVisible():
Promise
<boolean
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:205
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
Implementation of
IComponentDriver.isVisible
Inherited from
mouseDown()
mouseDown(
option
?):Promise
<void
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:169
Parameters
option?
Partial
<MouseDownOption
>
Returns
Promise
<void
>
Inherited from
mouseEnter()
mouseEnter(
option
?):Promise
<void
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:185
Parameters
option?
Partial
<MouseEnterOption
>
Returns
Promise
<void
>
Inherited from
mouseLeave()
mouseLeave(
option
?):Promise
<void
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:189
Parameters
option?
Partial
<MouseLeaveOption
>
Returns
Promise
<void
>
Inherited from
mouseMove()
mouseMove(
option
?):Promise
<void
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:165
Parameters
option?
Partial
<MouseMoveOption
>
Returns
Promise
<void
>
Inherited from
mouseOut()
mouseOut(
option
?):Promise
<void
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:181
Parameters
option?
Partial
<MouseOutOption
>
Returns
Promise
<void
>
Inherited from
mouseOver()
mouseOver(
option
?):Promise
<void
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:177
Parameters
option?
Partial
<HoverOption
>
Returns
Promise
<void
>
Inherited from
mouseUp()
mouseUp(
option
?):Promise
<void
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:173
Parameters
option?
Partial
<MouseUpOption
>
Returns
Promise
<void
>
Inherited from
overriddenParentLocator()
overriddenParentLocator():
Optional
<PartLocator
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:61
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
Inherited from
ComponentDriver
.overriddenParentLocator
overrideLocatorRelativePosition()
overrideLocatorRelativePosition():
Optional
<LocatorRelativePosition
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:76
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
runtimeCssSelector()
runtimeCssSelector():
Promise
<string
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:252
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
waitUntil()
waitUntil<
T
>(option
):Promise
<T
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:235
Type Parameters
T
T
Parameters
option
Returns
Promise
<T
>
Inherited from
waitUntilComponentState()
waitUntilComponentState(
option
):Promise
<void
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:231
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
>> = defaultWaitForOption
The option to configure the wait behavior
Returns
Promise
<void
>
Implementation of
IComponentDriver.waitUntilComponentState
Inherited from
ComponentDriver
.waitUntilComponentState
waitUntilVisible()
waitUntilVisible(
timeoutMs
):Promise
<void
>
Defined in: packages/core/src/drivers/ComponentDriver.ts:213
Wait until the component is attached and becomes visible to the DOM.
Parameters
timeoutMs
number
= 10000
The number of milliseconds to wait before timing out
Returns
Promise
<void
>