1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { HarnessEnvironment, HarnessLoader, TestElement } from '@angular/cdk/testing';
|
---|
9 | import * as webdriver from 'selenium-webdriver';
|
---|
10 | /**
|
---|
11 | * An Angular framework stabilizer function that takes a callback and calls it when the application
|
---|
12 | * is stable, passing a boolean indicating if any work was done.
|
---|
13 | */
|
---|
14 | declare interface FrameworkStabilizer {
|
---|
15 | (callback: (didWork: boolean) => void): void;
|
---|
16 | }
|
---|
17 | declare global {
|
---|
18 | interface Window {
|
---|
19 | /**
|
---|
20 | * These hooks are exposed by Angular to register a callback for when the application is stable
|
---|
21 | * (no more pending tasks).
|
---|
22 | *
|
---|
23 | * For the implementation, see: https://github.com/
|
---|
24 | * angular/angular/blob/master/packages/platform-browser/src/browser/testability.ts#L30-L49
|
---|
25 | */
|
---|
26 | frameworkStabilizers: FrameworkStabilizer[];
|
---|
27 | }
|
---|
28 | }
|
---|
29 | /** Options to configure the environment. */
|
---|
30 | export interface WebDriverHarnessEnvironmentOptions {
|
---|
31 | /** The query function used to find DOM elements. */
|
---|
32 | queryFn: (selector: string, root: () => webdriver.WebElement) => Promise<webdriver.WebElement[]>;
|
---|
33 | }
|
---|
34 | /** Waits for angular to be ready after the page load. */
|
---|
35 | export declare function waitForAngularReady(wd: webdriver.WebDriver): Promise<void>;
|
---|
36 | /** A `HarnessEnvironment` implementation for WebDriver. */
|
---|
37 | export declare class SeleniumWebDriverHarnessEnvironment extends HarnessEnvironment<() => webdriver.WebElement> {
|
---|
38 | /** The options for this environment. */
|
---|
39 | private _options;
|
---|
40 | protected constructor(rawRootElement: () => webdriver.WebElement, options?: WebDriverHarnessEnvironmentOptions);
|
---|
41 | /** Gets the ElementFinder corresponding to the given TestElement. */
|
---|
42 | static getNativeElement(el: TestElement): webdriver.WebElement;
|
---|
43 | /** Creates a `HarnessLoader` rooted at the document root. */
|
---|
44 | static loader(driver: webdriver.WebDriver, options?: WebDriverHarnessEnvironmentOptions): HarnessLoader;
|
---|
45 | /**
|
---|
46 | * Flushes change detection and async tasks captured in the Angular zone.
|
---|
47 | * In most cases it should not be necessary to call this manually. However, there may be some edge
|
---|
48 | * cases where it is needed to fully flush animation events.
|
---|
49 | */
|
---|
50 | forceStabilize(): Promise<void>;
|
---|
51 | /** @docs-private */
|
---|
52 | waitForTasksOutsideAngular(): Promise<void>;
|
---|
53 | /** Gets the root element for the document. */
|
---|
54 | protected getDocumentRoot(): () => webdriver.WebElement;
|
---|
55 | /** Creates a `TestElement` from a raw element. */
|
---|
56 | protected createTestElement(element: () => webdriver.WebElement): TestElement;
|
---|
57 | /** Creates a `HarnessLoader` rooted at the given raw element. */
|
---|
58 | protected createEnvironment(element: () => webdriver.WebElement): HarnessEnvironment<() => webdriver.WebElement>;
|
---|
59 | /**
|
---|
60 | * Gets a list of all elements matching the given selector under this environment's root element.
|
---|
61 | */
|
---|
62 | protected getAllRawElements(selector: string): Promise<(() => webdriver.WebElement)[]>;
|
---|
63 | }
|
---|
64 | export {};
|
---|