1 |
|
2 | export declare type AsyncFactoryFn<T> = () => Promise<T>;
|
3 |
|
4 |
|
5 | export declare type AsyncOptionPredicate<T, O> = (item: T, option: O) => Promise<boolean>;
|
6 |
|
7 |
|
8 | export declare type AsyncPredicate<T> = (item: T) => Promise<boolean>;
|
9 |
|
10 |
|
11 |
|
12 | export declare interface AutoChangeDetectionStatus {
|
13 |
|
14 | isDisabled: boolean;
|
15 | |
16 |
|
17 |
|
18 |
|
19 |
|
20 | onDetectChangesNow?: () => void;
|
21 | }
|
22 |
|
23 |
|
24 | export declare interface BaseHarnessFilters {
|
25 |
|
26 | selector?: string;
|
27 |
|
28 | ancestor?: string;
|
29 | }
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | export declare abstract class ComponentHarness {
|
37 | protected readonly locatorFactory: LocatorFactory;
|
38 | constructor(locatorFactory: LocatorFactory);
|
39 | /** Gets a `Promise` for the `TestElement` representing the host element of the component. */
|
40 | host(): Promise<TestElement>;
|
41 | /**
|
42 | * Gets a `LocatorFactory` for the document root element. This factory can be used to create
|
43 | * locators for elements that a component creates outside of its own root element. (e.g. by
|
44 | * appending to document.body).
|
45 | */
|
46 | protected documentRootLocatorFactory(): LocatorFactory;
|
47 | /**
|
48 | * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance
|
49 | * or element under the host element of this `ComponentHarness`.
|
50 | * @param queries A list of queries specifying which harnesses and elements to search for:
|
51 | * - A `string` searches for elements matching the CSS selector specified by the string.
|
52 | * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the
|
53 | * given class.
|
54 | * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given
|
55 | * predicate.
|
56 | * @return An asynchronous locator function that searches for and returns a `Promise` for the
|
57 | * first element or harness matching the given search criteria. Matches are ordered first by
|
58 | * order in the DOM, and second by order in the queries list. If no matches are found, the
|
59 | * `Promise` rejects. The type that the `Promise` resolves to is a union of all result types for
|
60 | * each query.
|
61 | *
|
62 | * e.g. Given the following DOM: `<div id="d1" /><div id="d2" />`, and assuming
|
63 | * `DivHarness.hostSelector === 'div'`:
|
64 | * - `await ch.locatorFor(DivHarness, 'div')()` gets a `DivHarness` instance for `#d1`
|
65 | * - `await ch.locatorFor('div', DivHarness)()` gets a `TestElement` instance for `#d1`
|
66 | * - `await ch.locatorFor('span')()` throws because the `Promise` rejects.
|
67 | */
|
68 | protected locatorFor<T extends (HarnessQuery<any> | string)[]>(...queries: T): AsyncFactoryFn<LocatorFnResult<T>>;
|
69 | /**
|
70 | * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance
|
71 | * or element under the host element of this `ComponentHarness`.
|
72 | * @param queries A list of queries specifying which harnesses and elements to search for:
|
73 | * - A `string` searches for elements matching the CSS selector specified by the string.
|
74 | * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the
|
75 | * given class.
|
76 | * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given
|
77 | * predicate.
|
78 | * @return An asynchronous locator function that searches for and returns a `Promise` for the
|
79 | * first element or harness matching the given search criteria. Matches are ordered first by
|
80 | * order in the DOM, and second by order in the queries list. If no matches are found, the
|
81 | * `Promise` is resolved with `null`. The type that the `Promise` resolves to is a union of all
|
82 | * result types for each query or null.
|
83 | *
|
84 | * e.g. Given the following DOM: `<div id="d1" /><div id="d2" />`, and assuming
|
85 | * `DivHarness.hostSelector === 'div'`:
|
86 | * - `await ch.locatorForOptional(DivHarness, 'div')()` gets a `DivHarness` instance for `#d1`
|
87 | * - `await ch.locatorForOptional('div', DivHarness)()` gets a `TestElement` instance for `#d1`
|
88 | * - `await ch.locatorForOptional('span')()` gets `null`.
|
89 | */
|
90 | protected locatorForOptional<T extends (HarnessQuery<any> | string)[]>(...queries: T): AsyncFactoryFn<LocatorFnResult<T> | null>;
|
91 | /**
|
92 | * Creates an asynchronous locator function that can be used to find `ComponentHarness` instances
|
93 | * or elements under the host element of this `ComponentHarness`.
|
94 | * @param queries A list of queries specifying which harnesses and elements to search for:
|
95 | * - A `string` searches for elements matching the CSS selector specified by the string.
|
96 | * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the
|
97 | * given class.
|
98 | * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given
|
99 | * predicate.
|
100 | * @return An asynchronous locator function that searches for and returns a `Promise` for all
|
101 | * elements and harnesses matching the given search criteria. Matches are ordered first by
|
102 | * order in the DOM, and second by order in the queries list. If an element matches more than
|
103 | * one `ComponentHarness` class, the locator gets an instance of each for the same element. If
|
104 | * an element matches multiple `string` selectors, only one `TestElement` instance is returned
|
105 | * for that element. The type that the `Promise` resolves to is an array where each element is
|
106 | * the union of all result types for each query.
|
107 | *
|
108 | * e.g. Given the following DOM: `<div id="d1" /><div id="d2" />`, and assuming
|
109 | * `DivHarness.hostSelector === 'div'` and `IdIsD1Harness.hostSelector === '#d1'`:
|
110 | * - `await ch.locatorForAll(DivHarness, 'div')()` gets `[
|
111 | * DivHarness, // for #d1
|
112 | * TestElement, // for #d1
|
113 | * DivHarness, // for #d2
|
114 | * TestElement // for #d2
|
115 | * ]`
|
116 | * - `await ch.locatorForAll('div', '#d1')()` gets `[
|
117 | * TestElement, // for #d1
|
118 | * TestElement // for #d2
|
119 | * ]`
|
120 | * - `await ch.locatorForAll(DivHarness, IdIsD1Harness)()` gets `[
|
121 | * DivHarness, // for #d1
|
122 | * IdIsD1Harness, // for #d1
|
123 | * DivHarness // for #d2
|
124 | * ]`
|
125 | * - `await ch.locatorForAll('span')()` gets `[]`.
|
126 | */
|
127 | protected locatorForAll<T extends (HarnessQuery<any> | string)[]>(...queries: T): AsyncFactoryFn<LocatorFnResult<T>[]>;
|
128 | /**
|
129 | * Flushes change detection and async tasks in the Angular zone.
|
130 | * In most cases it should not be necessary to call this manually. However, there may be some edge
|
131 | * cases where it is needed to fully flush animation events.
|
132 | */
|
133 | protected forceStabilize(): Promise<void>;
|
134 | /**
|
135 | * Waits for all scheduled or running async tasks to complete. This allows harness
|
136 | * authors to wait for async tasks outside of the Angular zone.
|
137 | */
|
138 | protected waitForTasksOutsideAngular(): Promise<void>;
|
139 | }
|
140 |
|
141 | /** Constructor for a ComponentHarness subclass. */
|
142 | export declare interface ComponentHarnessConstructor<T extends ComponentHarness> {
|
143 | new (locatorFactory: LocatorFactory): T;
|
144 | /**
|
145 | * `ComponentHarness` subclasses must specify a static `hostSelector` property that is used to
|
146 | * find the host element for the corresponding component. This property should match the selector
|
147 | * for the Angular component.
|
148 | */
|
149 | hostSelector: string;
|
150 | }
|
151 |
|
152 | /**
|
153 | * Base class for component harnesses that authors should extend if they anticipate that consumers
|
154 | * of the harness may want to access other harnesses within the `<ng-content>` of the component.
|
155 | */
|
156 | export declare abstract class ContentContainerComponentHarness<S extends string = string> extends ComponentHarness implements HarnessLoader {
|
157 | getChildLoader(selector: S): Promise<HarnessLoader>;
|
158 | getAllChildLoaders(selector: S): Promise<HarnessLoader[]>;
|
159 | getHarness<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T>;
|
160 | getHarnessOrNull<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T | null>;
|
161 | getAllHarnesses<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T[]>;
|
162 | hasHarness<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<boolean>;
|
163 | /**
|
164 | * Gets the root harness loader from which to start
|
165 | * searching for content contained by this harness.
|
166 | */
|
167 | protected getRootHarnessLoader(): Promise<HarnessLoader>;
|
168 | }
|
169 |
|
170 |
|
171 | /**
|
172 | * Dimensions for element size and its position relative to the viewport.
|
173 | */
|
174 | export declare interface ElementDimensions {
|
175 | top: number;
|
176 | left: number;
|
177 | width: number;
|
178 | height: number;
|
179 | }
|
180 |
|
181 | /** Data that can be attached to a custom event dispatched from a `TestElement`. */
|
182 | export declare type EventData = string | number | boolean | Function | undefined | null | EventData[] | {
|
183 | [key: string]: EventData;
|
184 | };
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 | export declare function getNoKeysSpecifiedError(): Error;
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 | export declare function _getTextWithExcludedElements(element: Element, excludeSelector: string): string;
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 | export declare function handleAutoChangeDetectionStatus(handler: (status: AutoChangeDetectionStatus) => void): void;
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 | export declare abstract class HarnessEnvironment<E> implements HarnessLoader, LocatorFactory {
|
215 | protected rawRootElement: E;
|
216 | get rootElement(): TestElement;
|
217 | set rootElement(element: TestElement);
|
218 | private _rootElement;
|
219 | protected constructor(rawRootElement: E);
|
220 | documentRootLocatorFactory(): LocatorFactory;
|
221 | locatorFor<T extends (HarnessQuery<any> | string)[]>(...queries: T): AsyncFactoryFn<LocatorFnResult<T>>;
|
222 | locatorForOptional<T extends (HarnessQuery<any> | string)[]>(...queries: T): AsyncFactoryFn<LocatorFnResult<T> | null>;
|
223 | locatorForAll<T extends (HarnessQuery<any> | string)[]>(...queries: T): AsyncFactoryFn<LocatorFnResult<T>[]>;
|
224 | rootHarnessLoader(): Promise<HarnessLoader>;
|
225 | harnessLoaderFor(selector: string): Promise<HarnessLoader>;
|
226 | harnessLoaderForOptional(selector: string): Promise<HarnessLoader | null>;
|
227 | harnessLoaderForAll(selector: string): Promise<HarnessLoader[]>;
|
228 | getHarness<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T>;
|
229 | getHarnessOrNull<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T | null>;
|
230 | getAllHarnesses<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T[]>;
|
231 | hasHarness<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<boolean>;
|
232 | getChildLoader(selector: string): Promise<HarnessLoader>;
|
233 | getAllChildLoaders(selector: string): Promise<HarnessLoader[]>;
|
234 | /** Creates a `ComponentHarness` for the given harness type with the given raw host element. */
|
235 | protected createComponentHarness<T extends ComponentHarness>(harnessType: ComponentHarnessConstructor<T>, element: E): T;
|
236 | abstract forceStabilize(): Promise<void>;
|
237 | abstract waitForTasksOutsideAngular(): Promise<void>;
|
238 | /** Gets the root element for the document. */
|
239 | protected abstract getDocumentRoot(): E;
|
240 | /** Creates a `TestElement` from a raw element. */
|
241 | protected abstract createTestElement(element: E): TestElement;
|
242 | /** Creates a `HarnessLoader` rooted at the given raw element. */
|
243 | protected abstract createEnvironment(element: E): HarnessEnvironment<E>;
|
244 | /**
|
245 | * Gets a list of all elements matching the given selector under this environment's root element.
|
246 | */
|
247 | protected abstract getAllRawElements(selector: string): Promise<E[]>;
|
248 | /**
|
249 | * Matches the given raw elements with the given list of element and harness queries to produce a
|
250 | * list of matched harnesses and test elements.
|
251 | */
|
252 | private _getAllHarnessesAndTestElements;
|
253 | /**
|
254 | * Check whether the given query matches the given element, if it does return the matched
|
255 | * `TestElement` or `ComponentHarness`, if it does not, return null. In cases where the caller
|
256 | * knows for sure that the query matches the element's selector, `skipSelectorCheck` can be used
|
257 | * to skip verification and optimize performance.
|
258 | */
|
259 | private _getQueryResultForElement;
|
260 | }
|
261 |
|
262 | /**
|
263 | * Interface used to load ComponentHarness objects. This interface is used by test authors to
|
264 | * instantiate `ComponentHarness`es.
|
265 | */
|
266 | export declare interface HarnessLoader {
|
267 | |
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 | getChildLoader(selector: string): Promise<HarnessLoader>;
|
276 | |
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 | getAllChildLoaders(selector: string): Promise<HarnessLoader[]>;
|
284 | |
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 | getHarness<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T>;
|
294 | |
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 | getHarnessOrNull<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T | null>;
|
303 | |
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 | getAllHarnesses<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T[]>;
|
310 | |
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 | hasHarness<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<boolean>;
|
317 | }
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 | export declare class HarnessPredicate<T extends ComponentHarness> {
|
324 | harnessType: ComponentHarnessConstructor<T>;
|
325 | private _predicates;
|
326 | private _descriptions;
|
327 | private _ancestor;
|
328 | constructor(harnessType: ComponentHarnessConstructor<T>, options: BaseHarnessFilters);
|
329 | /**
|
330 | * Checks if the specified nullable string value matches the given pattern.
|
331 | * @param value The nullable string value to check, or a Promise resolving to the
|
332 | * nullable string value.
|
333 | * @param pattern The pattern the value is expected to match. If `pattern` is a string,
|
334 | * `value` is expected to match exactly. If `pattern` is a regex, a partial match is
|
335 | * allowed. If `pattern` is `null`, the value is expected to be `null`.
|
336 | * @return Whether the value matches the pattern.
|
337 | */
|
338 | static stringMatches(value: string | null | Promise<string | null>, pattern: string | RegExp | null): Promise<boolean>;
|
339 | /**
|
340 | * Adds a predicate function to be run against candidate harnesses.
|
341 | * @param description A description of this predicate that may be used in error messages.
|
342 | * @param predicate An async predicate function.
|
343 | * @return this (for method chaining).
|
344 | */
|
345 | add(description: string, predicate: AsyncPredicate<T>): this;
|
346 | /**
|
347 | * Adds a predicate function that depends on an option value to be run against candidate
|
348 | * harnesses. If the option value is undefined, the predicate will be ignored.
|
349 | * @param name The name of the option (may be used in error messages).
|
350 | * @param option The option value.
|
351 | * @param predicate The predicate function to run if the option value is not undefined.
|
352 | * @return this (for method chaining).
|
353 | */
|
354 | addOption<O>(name: string, option: O | undefined, predicate: AsyncOptionPredicate<T, O>): this;
|
355 | /**
|
356 | * Filters a list of harnesses on this predicate.
|
357 | * @param harnesses The list of harnesses to filter.
|
358 | * @return A list of harnesses that satisfy this predicate.
|
359 | */
|
360 | filter(harnesses: T[]): Promise<T[]>;
|
361 | /**
|
362 | * Evaluates whether the given harness satisfies this predicate.
|
363 | * @param harness The harness to check
|
364 | * @return A promise that resolves to true if the harness satisfies this predicate,
|
365 | * and resolves to false otherwise.
|
366 | */
|
367 | evaluate(harness: T): Promise<boolean>;
|
368 | /** Gets a description of this predicate for use in error messages. */
|
369 | getDescription(): string;
|
370 | /** Gets the selector used to find candidate elements. */
|
371 | getSelector(): string;
|
372 | /** Adds base options common to all harness types. */
|
373 | private _addBaseOptions;
|
374 | }
|
375 |
|
376 | /**
|
377 | * A query for a `ComponentHarness`, which is expressed as either a `ComponentHarnessConstructor` or
|
378 | * a `HarnessPredicate`.
|
379 | */
|
380 | export declare type HarnessQuery<T extends ComponentHarness> = ComponentHarnessConstructor<T> | HarnessPredicate<T>;
|
381 |
|
382 | /**
|
383 | * Interface used to create asynchronous locator functions used find elements and component
|
384 | * harnesses. This interface is used by `ComponentHarness` authors to create locator functions for
|
385 | * their `ComponentHarness` subclass.
|
386 | */
|
387 | export declare interface LocatorFactory {
|
388 |
|
389 | documentRootLocatorFactory(): LocatorFactory;
|
390 |
|
391 | rootElement: TestElement;
|
392 | |
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 | locatorFor<T extends (HarnessQuery<any> | string)[]>(...queries: T): AsyncFactoryFn<LocatorFnResult<T>>;
|
414 | |
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 |
|
435 | locatorForOptional<T extends (HarnessQuery<any> | string)[]>(...queries: T): AsyncFactoryFn<LocatorFnResult<T> | null>;
|
436 | |
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 | locatorForAll<T extends (HarnessQuery<any> | string)[]>(...queries: T): AsyncFactoryFn<LocatorFnResult<T>[]>;
|
473 |
|
474 | rootHarnessLoader(): Promise<HarnessLoader>;
|
475 | |
476 |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 | harnessLoaderFor(selector: string): Promise<HarnessLoader>;
|
482 | |
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 | harnessLoaderForOptional(selector: string): Promise<HarnessLoader | null>;
|
489 | |
490 |
|
491 |
|
492 |
|
493 |
|
494 | harnessLoaderForAll(selector: string): Promise<HarnessLoader[]>;
|
495 | |
496 |
|
497 |
|
498 |
|
499 |
|
500 | forceStabilize(): Promise<void>;
|
501 | |
502 |
|
503 |
|
504 |
|
505 | waitForTasksOutsideAngular(): Promise<void>;
|
506 | }
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 | export declare type LocatorFnResult<T extends (HarnessQuery<any> | string)[]> = {
|
531 | [I in keyof T]: T[I] extends new (...args: any[]) => infer C ? C : T[I] extends {
|
532 | harnessType: new (...args: any[]) => infer C;
|
533 | } ? C : T[I] extends string ? TestElement : never;
|
534 | }[number];
|
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 | export declare function manualChangeDetection<T>(fn: () => Promise<T>): Promise<T>;
|
542 |
|
543 |
|
544 | export declare interface ModifierKeys {
|
545 | control?: boolean;
|
546 | alt?: boolean;
|
547 | shift?: boolean;
|
548 | meta?: boolean;
|
549 | }
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 | export declare function parallel<T1, T2, T3, T4, T5>(values: () => [
|
559 | T1 | PromiseLike<T1>,
|
560 | T2 | PromiseLike<T2>,
|
561 | T3 | PromiseLike<T3>,
|
562 | T4 | PromiseLike<T4>,
|
563 | T5 | PromiseLike<T5>
|
564 | ]): Promise<[T1, T2, T3, T4, T5]>;
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 | export declare function parallel<T1, T2, T3, T4>(values: () => [
|
574 | T1 | PromiseLike<T1>,
|
575 | T2 | PromiseLike<T2>,
|
576 | T3 | PromiseLike<T3>,
|
577 | T4 | PromiseLike<T4>
|
578 | ]): Promise<[T1, T2, T3, T4]>;
|
579 |
|
580 |
|
581 |
|
582 |
|
583 |
|
584 |
|
585 |
|
586 |
|
587 | export declare function parallel<T1, T2, T3>(values: () => [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
588 |
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 | export declare function parallel<T1, T2>(values: () => [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 | export declare function parallel<T>(values: () => (T | PromiseLike<T>)[]): Promise<T[]>;
|
606 |
|
607 |
|
608 | export declare function stopHandlingAutoChangeDetectionStatus(): void;
|
609 |
|
610 |
|
611 |
|
612 |
|
613 |
|
614 | export declare interface TestElement {
|
615 |
|
616 | blur(): Promise<void>;
|
617 |
|
618 | clear(): Promise<void>;
|
619 | |
620 |
|
621 |
|
622 |
|
623 |
|
624 | click(modifiers?: ModifierKeys): Promise<void>;
|
625 |
|
626 | click(location: 'center', modifiers?: ModifierKeys): Promise<void>;
|
627 | |
628 |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 | click(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;
|
634 | |
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 | rightClick(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;
|
641 |
|
642 | focus(): Promise<void>;
|
643 |
|
644 | getCssValue(property: string): Promise<string>;
|
645 |
|
646 | hover(): Promise<void>;
|
647 |
|
648 | mouseAway(): Promise<void>;
|
649 | |
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 | sendKeys(...keys: (string | TestKey)[]): Promise<void>;
|
656 | |
657 |
|
658 |
|
659 |
|
660 |
|
661 | sendKeys(modifiers: ModifierKeys, ...keys: (string | TestKey)[]): Promise<void>;
|
662 | |
663 |
|
664 |
|
665 |
|
666 | text(options?: TextOptions): Promise<string>;
|
667 | |
668 |
|
669 |
|
670 |
|
671 |
|
672 | setContenteditableValue?(value: string): Promise<void>;
|
673 |
|
674 | getAttribute(name: string): Promise<string | null>;
|
675 |
|
676 | hasClass(name: string): Promise<boolean>;
|
677 |
|
678 | getDimensions(): Promise<ElementDimensions>;
|
679 |
|
680 | getProperty<T = any>(name: string): Promise<T>;
|
681 |
|
682 | matchesSelector(selector: string): Promise<boolean>;
|
683 |
|
684 | isFocused(): Promise<boolean>;
|
685 |
|
686 | setInputValue(value: string): Promise<void>;
|
687 |
|
688 | selectOptions(...optionIndexes: number[]): Promise<void>;
|
689 | |
690 |
|
691 |
|
692 |
|
693 | dispatchEvent(name: string, data?: Record<string, EventData>): Promise<void>;
|
694 | }
|
695 |
|
696 |
|
697 | export declare enum TestKey {
|
698 | BACKSPACE = 0,
|
699 | TAB = 1,
|
700 | ENTER = 2,
|
701 | SHIFT = 3,
|
702 | CONTROL = 4,
|
703 | ALT = 5,
|
704 | ESCAPE = 6,
|
705 | PAGE_UP = 7,
|
706 | PAGE_DOWN = 8,
|
707 | END = 9,
|
708 | HOME = 10,
|
709 | LEFT_ARROW = 11,
|
710 | UP_ARROW = 12,
|
711 | RIGHT_ARROW = 13,
|
712 | DOWN_ARROW = 14,
|
713 | INSERT = 15,
|
714 | DELETE = 16,
|
715 | F1 = 17,
|
716 | F2 = 18,
|
717 | F3 = 19,
|
718 | F4 = 20,
|
719 | F5 = 21,
|
720 | F6 = 22,
|
721 | F7 = 23,
|
722 | F8 = 24,
|
723 | F9 = 25,
|
724 | F10 = 26,
|
725 | F11 = 27,
|
726 | F12 = 28,
|
727 | META = 29
|
728 | }
|
729 |
|
730 | export declare interface TextOptions {
|
731 |
|
732 | exclude?: string;
|
733 | }
|
734 |
|
735 | export { }
|