Options
All
  • Public
  • Public/Protected
  • All
Menu

Instances of an interactor returned by an InteractorConstructor, use this class as its base. They are also extended with any additional actions defined in their InteractorSpecification.

Type parameters

  • E: Element

  • F: FilterParams<any, any>

Hierarchy

  • BaseInteractor<E, F>
  • ExistsAssertionsImplementation
    • Interactor

Index

Properties

description

description: string
returns

a human readable description of this interactor

Methods

absent

  • An assertion which checks that an element matching the interactor does not exist. Throws an error if the element exists.

    Example

    await Link('Next').absent();
    

    Returns ReadonlyInteraction<void> & FilterObject<boolean, Element>

assert

  • Perform a one-off assertion on the given interactor. Takes a function which receives an element. This function converges, which means that it is rerun in a loop until it does not throw an error or times out.

    We recommend using this function for debugging only. You should normally define a filter in an InteractorSpecification.

    Example

    await Link('Next').assert((e) => assert(e.tagName === 'A'));
    

    Parameters

    • fn: (element: E) => void
        • (element: E): void
        • Parameters

          • element: E

          Returns void

    Returns ReadonlyInteraction<void>

exists

  • An assertion which checks that an element matching the interactor exists. Throws an error if the element does not exist.

    Example

    await Link('Next').exists();
    

    Returns ReadonlyInteraction<void> & FilterObject<boolean, Element>

find

  • find<T>(interactor: T): T
  • Returns a copy of the given interactor which is scoped to this interactor. When there are multiple matches for an interactor, this makes it possible to make them more specific by limiting the interactor to a section of the page.

    Example

    await Fieldset('Owner').find(TextField('Name')).fillIn('Jonas');
    await Fieldset('Brand').find(TextField('Name')).fillIn('Volkswagen');

    Type parameters

    • T: Interactor<any, any, T>

      the type of the interactor that we are going to scope

    Parameters

    • interactor: T

      the interactor which should be scoped

    Returns T

    a scoped copy of the initial interactor

has

  • Checks that there is one element matching the interactor, and that this element matches the given filters. The available filters are defined by the InteractorSpecification.

    Example

    await Link('Home').has({ href: '/' })
    

    Parameters

    • filters: F

    Returns ReadonlyInteraction<void>

is

  • Identical to has, but reads better with some filters.

    Example

    await CheckBox('Accept conditions').is({ checked: true })
    

    Parameters

    • filters: F

    Returns ReadonlyInteraction<void>

perform

  • Perform a one-off action on the given interactor. Takes a function which receives an element. This function converges, which means that it is rerun in a loop until it does not throw an error or times out.

    We recommend using this function for debugging only. You should normally define an action in an InteractorSpecification.

    Example

    await Link('Next').perform((e) => e.click());
    

    Parameters

    • fn: (element: E) => void
        • (element: E): void
        • Parameters

          • element: E

          Returns void

    Returns Interaction<void>

Generated using TypeDoc