Interface used to load ComponentHarness objects. This interface is used by test authors to instantiate ComponentHarnesses.
API
interface HarnessLoader {
getChildLoader(selector: string): Promise<HarnessLoader>;
getAllChildLoaders(selector: string): Promise<HarnessLoader[]>;
getHarness<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T>;
getHarnessOrNull<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T | null>;
getHarnessAtIndex<T extends ComponentHarness>(query: HarnessQuery<T>, index: number): Promise<T>;
getAllHarnesses<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T[]>;
countHarnesses<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<number>;
hasHarness<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<boolean>;
}
getChildLoader
Promise<HarnessLoader>Searches for an element with the given selector under the current instances's root element, and returns a HarnessLoader rooted at the matching element. If multiple elements match the selector, the first is used. If no elements match, an error is thrown.
Promise<HarnessLoader>
getAllChildLoaders
Promise<HarnessLoader[]>Searches for all elements with the given selector under the current instances's root element, and returns an array of HarnessLoaders, one for each matching element, rooted at that element.
Promise<HarnessLoader[]>
getHarness
Promise<T>Searches for an instance of the component corresponding to the given harness type under the HarnessLoader's root element, and returns a ComponentHarness for that instance. If multiple matching components are found, a harness for the first one is returned. If no matching component is found, an error is thrown.
Promise<T>
getHarnessOrNull
Promise<T | null>Searches for an instance of the component corresponding to the given harness type under the HarnessLoader's root element, and returns a ComponentHarness for that instance. If multiple matching components are found, a harness for the first one is returned. If no matching component is found, null is returned.
Promise<T | null>
getHarnessAtIndex
Promise<T>Searches for an instance of the component corresponding to the given harness type under the HarnessLoader's root element, and returns a ComponentHarness for the instance on the page at the given index. If no matching component exists at that index, an error is thrown.
numberThe zero-indexed offset of the matching component instance to return
Promise<T>
getAllHarnesses
Promise<T[]>Searches for all instances of the component corresponding to the given harness type under the HarnessLoader's root element, and returns a list ComponentHarness for each instance.
Promise<T[]>
countHarnesses
Promise<number>Searches for all instances of the component corresponding to the given harness type under the HarnessLoader's root element, and returns the total count of all matching components.
Promise<number>
hasHarness
Promise<boolean>Searches for an instance of the component corresponding to the given harness type under the HarnessLoader's root element, and returns a boolean indicating if any were found.
Promise<boolean>