Interface IZCircusDriver

Represents a driver that manages search and action criteria on a page object model.

interface IZCircusDriver {
    attribute<T extends string>(attribute: string): Promise<null | T>;
    attribute<T extends string>(attribute: string, fallback: T): Promise<T>;
    body(): Promise<IZCircusDriver>;
    classes(filter?: string[]): Promise<string[]>;
    destroy(): Promise<void>;
    disabled(): Promise<boolean>;
    focused(): Promise<null | IZCircusDriver>;
    peek(selector: string): Promise<boolean>;
    perform(act: IZCircusAct): Promise<void>;
    query(selector: string): Promise<IZCircusDriver[]>;
    select(selector: string): Promise<IZCircusDriver>;
    selected(): Promise<boolean>;
    tag(): Promise<string>;
    text(): Promise<string>;
    value(fallback: string): Promise<string>;
    value(): Promise<null | string>;
    wait(
        predicate: () => boolean | Promise<boolean>,
        options?: IZCircusWaitOptions,
    ): Promise<void>;
}

Implemented by

Methods

  • Returns an attribute of the driver.

    Type Parameters

    • T extends string

    Parameters

    • attribute: string

      The attribute to retrieve.

    Returns Promise<null | T>

    The attribute value, or null if no such value exists.

  • Returns an attribute of the driver.

    Type Parameters

    • T extends string

    Parameters

    • attribute: string

      The attribute to retrieve.

    • fallback: T

      The fallback value in case the attribute is not set.

    Returns Promise<T>

    The attribute value, or null if no such value exists.

  • Jumps to the body element.

    This is useful if you are opening modals and popups that don't exist from withing the driver context.

    Returns Promise<IZCircusDriver>

    A new driver that contains the document body as the context.

  • Returns a list of classes on the driver context that match a given filter.

    Parameters

    • Optionalfilter: string[]

      The filter of classes you want to check for. If you just want to get all classes, then just use undefined here.

    Returns Promise<string[]>

    The list of classes that match the filter.

  • Destroys the driver session.

    This releases all memory and items used by the driver. If nothing is used, then this may do nothing.

    Returns Promise<void>

  • Gets whether the context described by this driver is disabled.

    Returns Promise<boolean>

    True if the driver context is disabled. False if enabled.

  • Looks at the app structure to see if a css selector will produce any results.

    Parameters

    • selector: string

      The selector to check.

    Returns Promise<boolean>

    True if the selector will result in one or more results. False otherwise.

  • Selects all items under this driver that matches the css selector.

    Parameters

    • selector: string

      The selector to query.

    Returns Promise<IZCircusDriver[]>

    A promise that resolves with all items found from the selector. If no items are found, then an empty array is returned.

  • Selects a single item under the driver that matches the css selector.

    Parameters

    • selector: string

      The selector to query.

    Returns Promise<IZCircusDriver>

    A resolved promise with the first item found if the selector produces one or more results. Returns a rejected promise if the selector returns no items.

  • Gets whether the value of the driver context is selected.

    Returns Promise<boolean>

    True if the context is in a selected state. False otherwise.

  • Gets the tag (node name) of the driver context.

    Returns Promise<string>

    The tag of the driver context.

  • Gets the underlying text of the driver context.

    Returns Promise<string>

    The underlying text of the driver context. Returns the empty string if no text exists.

  • Gets the underlying value of the driver context.

    Parameters

    • fallback: string

      The fallback value in the case that the driver does not support a value.

    Returns Promise<string>

    The underlying value of the driver context, or fallback if the driver does not support a value.

  • Gets the underlying value of the driver context if there is one.

    Returns Promise<null | string>

    The underlying value of the driver context if there is one. Returns null if the driver does not support a value.

  • Waits for a certain condition to be met before continuing.

    Parameters

    • predicate: () => boolean | Promise<boolean>

      The predicate to wait for.

    • Optionaloptions: IZCircusWaitOptions

      The options for the wait.

    Returns Promise<void>