1 | import { ElementDimensions } from '@angular/cdk/testing';
|
2 | import { EventData } from '@angular/cdk/testing';
|
3 | import { HarnessEnvironment } from '@angular/cdk/testing';
|
4 | import { HarnessLoader } from '@angular/cdk/testing';
|
5 | import { ModifierKeys } from '@angular/cdk/testing';
|
6 | import { TestElement } from '@angular/cdk/testing';
|
7 | import { TestKey } from '@angular/cdk/testing';
|
8 | import { TextOptions } from '@angular/cdk/testing';
|
9 | import * as webdriver from 'selenium-webdriver';
|
10 |
|
11 |
|
12 | export declare class SeleniumWebDriverElement implements TestElement {
|
13 | readonly element: () => webdriver.WebElement;
|
14 | private _stabilize;
|
15 | constructor(element: () => webdriver.WebElement, _stabilize: () => Promise<void>);
|
16 | /** Blur the element. */
|
17 | blur(): Promise<void>;
|
18 | /** Clear the element's input (for input and textarea elements only). */
|
19 | clear(): Promise<void>;
|
20 | /**
|
21 | * Click the element at the default location for the current environment. If you need to guarantee
|
22 | * the element is clicked at a specific location, consider using `click('center')` or
|
23 | * `click(x, y)` instead.
|
24 | */
|
25 | click(modifiers?: ModifierKeys): Promise<void>;
|
26 | /** Click the element at the element's center. */
|
27 | click(location: 'center', modifiers?: ModifierKeys): Promise<void>;
|
28 | /**
|
29 | * Click the element at the specified coordinates relative to the top-left of the element.
|
30 | * @param relativeX Coordinate within the element, along the X-axis at which to click.
|
31 | * @param relativeY Coordinate within the element, along the Y-axis at which to click.
|
32 | * @param modifiers Modifier keys held while clicking
|
33 | */
|
34 | click(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;
|
35 | /**
|
36 | * Right clicks on the element at the specified coordinates relative to the top-left of it.
|
37 | * @param relativeX Coordinate within the element, along the X-axis at which to click.
|
38 | * @param relativeY Coordinate within the element, along the Y-axis at which to click.
|
39 | * @param modifiers Modifier keys held while clicking
|
40 | */
|
41 | rightClick(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;
|
42 | /** Focus the element. */
|
43 | focus(): Promise<void>;
|
44 | /** Get the computed value of the given CSS property for the element. */
|
45 | getCssValue(property: string): Promise<string>;
|
46 | /** Hovers the mouse over the element. */
|
47 | hover(): Promise<void>;
|
48 | /** Moves the mouse away from the element. */
|
49 | mouseAway(): Promise<void>;
|
50 | /**
|
51 | * Sends the given string to the input as a series of key presses. Also fires input events
|
52 | * and attempts to add the string to the Element's value.
|
53 | */
|
54 | sendKeys(...keys: (string | TestKey)[]): Promise<void>;
|
55 | /**
|
56 | * Sends the given string to the input as a series of key presses. Also fires input events
|
57 | * and attempts to add the string to the Element's value.
|
58 | */
|
59 | sendKeys(modifiers: ModifierKeys, ...keys: (string | TestKey)[]): Promise<void>;
|
60 | /**
|
61 | * Gets the text from the element.
|
62 | * @param options Options that affect what text is included.
|
63 | */
|
64 | text(options?: TextOptions): Promise<string>;
|
65 | /**
|
66 | * Sets the value of a `contenteditable` element.
|
67 | * @param value Value to be set on the element.
|
68 | */
|
69 | setContenteditableValue(value: string): Promise<void>;
|
70 | /** Gets the value for the given attribute from the element. */
|
71 | getAttribute(name: string): Promise<string | null>;
|
72 | /** Checks whether the element has the given class. */
|
73 | hasClass(name: string): Promise<boolean>;
|
74 | /** Gets the dimensions of the element. */
|
75 | getDimensions(): Promise<ElementDimensions>;
|
76 | /** Gets the value of a property of an element. */
|
77 | getProperty<T = any>(name: string): Promise<T>;
|
78 | /** Sets the value of a property of an input. */
|
79 | setInputValue(newValue: string): Promise<void>;
|
80 | /** Selects the options at the specified indexes inside of a native `select` element. */
|
81 | selectOptions(...optionIndexes: number[]): Promise<void>;
|
82 | /** Checks whether this element matches the given selector. */
|
83 | matchesSelector(selector: string): Promise<boolean>;
|
84 | /** Checks whether the element is focused. */
|
85 | isFocused(): Promise<boolean>;
|
86 | /**
|
87 | * Dispatches an event with a particular name.
|
88 | * @param name Name of the event to be dispatched.
|
89 | */
|
90 | dispatchEvent(name: string, data?: Record<string, EventData>): Promise<void>;
|
91 | /** Gets the webdriver action sequence. */
|
92 | private _actions;
|
93 | /** Executes a function in the browser. */
|
94 | private _executeScript;
|
95 | /** Dispatches all the events that are part of a click event sequence. */
|
96 | private _dispatchClickEventSequence;
|
97 | }
|
98 |
|
99 | /** A `HarnessEnvironment` implementation for WebDriver. */
|
100 | export declare class SeleniumWebDriverHarnessEnvironment extends HarnessEnvironment<() => webdriver.WebElement> {
|
101 |
|
102 | private _options;
|
103 |
|
104 | private _stabilizeCallback;
|
105 | protected constructor(rawRootElement: () => webdriver.WebElement, options?: WebDriverHarnessEnvironmentOptions);
|
106 | /** Gets the ElementFinder corresponding to the given TestElement. */
|
107 | static getNativeElement(el: TestElement): webdriver.WebElement;
|
108 | /** Creates a `HarnessLoader` rooted at the document root. */
|
109 | static loader(driver: webdriver.WebDriver, options?: WebDriverHarnessEnvironmentOptions): HarnessLoader;
|
110 | /**
|
111 | * Flushes change detection and async tasks captured in the Angular zone.
|
112 | * In most cases it should not be necessary to call this manually. However, there may be some edge
|
113 | * cases where it is needed to fully flush animation events.
|
114 | */
|
115 | forceStabilize(): Promise<void>;
|
116 | /** @docs-private */
|
117 | waitForTasksOutsideAngular(): Promise<void>;
|
118 | /** Gets the root element for the document. */
|
119 | protected getDocumentRoot(): () => webdriver.WebElement;
|
120 | /** Creates a `TestElement` from a raw element. */
|
121 | protected createTestElement(element: () => webdriver.WebElement): TestElement;
|
122 | /** Creates a `HarnessLoader` rooted at the given raw element. */
|
123 | protected createEnvironment(element: () => webdriver.WebElement): HarnessEnvironment<() => webdriver.WebElement>;
|
124 | /**
|
125 | * Gets a list of all elements matching the given selector under this environment's root element.
|
126 | */
|
127 | protected getAllRawElements(selector: string): Promise<(() => webdriver.WebElement)[]>;
|
128 | }
|
129 |
|
130 | /** Waits for angular to be ready after the page load. */
|
131 | export declare function waitForAngularReady(wd: webdriver.WebDriver): Promise<void>;
|
132 |
|
133 | /** Options to configure the environment. */
|
134 | export declare interface WebDriverHarnessEnvironmentOptions {
|
135 |
|
136 | queryFn: (selector: string, root: () => webdriver.WebElement) => Promise<webdriver.WebElement[]>;
|
137 | }
|
138 |
|
139 | export { }
|