used to encapsulate logical blocks of a UI providing the ability to chain element lookups back to a root ancestor meaning that individual locators only need to be concerned with elements that exist as a child of the parent of this UiFacet. this is especially useful when UI elements exist in multiple places on a page and you only wish to get one instance in a specific location

Hierarchy

  • UiComponent

Constructors

Properties

_driver: unknown
_locator: unknown
_parent: Func<void, Promise<unknown>>
aftCfg: AftConfig
reporter: ReportingManager

Accessors

  • get driver(): unknown
  • the top-level interface between the application DOM and the code. for operations within the scope of this UiComponent the getRoot function should be used instead

    Returns unknown

  • get parent(): Func<void, Promise<unknown>>
  • a function returning the view node object that encapsulates this UiComponent. the parent can be used to chain a scoped lookup refresh back to the root of the view preventing stale nodes

    Returns Func<void, Promise<unknown>>

Methods

  • creates a new UiComponent instance of the specified type passing in the driver, aftConfig, reporter and () => this.getRoot() as parent

    Type Parameters

    Parameters

    • componentType: Class<F>

      a class extending from UiComponent providing a Page Object Model interface with the DOM

    • Optional options: Partial<UiComponentOptions>

      an object allowing for overrides to the default driver, locator, parent, reporter and aftConfig objects

    Returns F

    an instance of the specified UiComponent class

  • returns the root view node object identified by this component's locator. the root node should be used to compartmentalise DOM lookups to a scope only within this UiComponent.

    NOTE:

    implementations should resemble the following:

    override async getRoot(): Promise<WebElement> {
    const searchContext = (this.parent != null) ? await this.parent() : this.driver;
    return searchContext.findElement(this.locator);
    }

    to ensure a fresh lookup of the root and child elements

    Returns Promise<unknown>

Generated using TypeDoc