UNPKG

2.54 kBTypeScriptView Raw
1import type { ElementReference } from '@wdio/protocols';
2import type { BaseActionParams } from './base.js';
3import BaseAction from './base.js';
4import type { ChainablePromiseElement } from '../../types.js';
5export declare const buttonValue: readonly [0, 1, 2, "left", "middle", "right"];
6export type ButtonNames = 'left' | 'middle' | 'right';
7export type Button = 0 | 1 | 2;
8export type Origin = 'pointer' | 'viewport';
9interface PointerActionUpParams {
10 /**
11 * The button to press (e.g. 0 for left, 1 for middle or 2 for right)
12 * @default 0
13 */
14 button: Button | ButtonNames;
15}
16declare const PARAM_DEFAULTS: {
17 width: number;
18 height: number;
19 pressure: number;
20 tangentialPressure: number;
21 tiltX: number;
22 tiltY: number;
23 twist: number;
24 altitudeAngle: number;
25 azimuthAngle: number;
26 /**
27 * The button to press (e.g. 0 for left, 1 for middle or 2 for right)
28 * @default 0
29 */
30 button: Button | ButtonNames;
31};
32declare const MOVE_PARAM_DEFAULTS: {
33 x: number;
34 y: number;
35 duration: number;
36 origin: (Origin | ElementReference | ChainablePromiseElement | WebdriverIO.Element);
37};
38type PointerActionParams = Partial<typeof PARAM_DEFAULTS> & Partial<PointerActionUpParams>;
39type PointerActionMoveParams = Partial<typeof MOVE_PARAM_DEFAULTS> & PointerActionParams;
40export default class PointerAction extends BaseAction {
41 constructor(instance: WebdriverIO.Browser, params?: BaseActionParams);
42 /**
43 * Creates an action for moving the pointer `x` and `y` pixels from the specified
44 * `origin`. The `origin` may be defined as the pointers current position (e.g. "pointer"),
45 * the viewport (e.g. "viewport") or the center of a specific element.
46 * @param params PointerActionMoveParams
47 */
48 move(params: PointerActionMoveParams): PointerAction;
49 move(x: number, y: number): PointerAction;
50 /**
51 * Creates an action to release a single key.
52 * @param params PointerActionUpParams
53 */
54 up(button?: Button): PointerAction;
55 up(button?: ButtonNames): PointerAction;
56 up(params?: PointerActionUpParams): PointerAction;
57 /**
58 * Creates an action to press a single key
59 * @param params PointerActionParams
60 */
61 down(button?: Button): PointerAction;
62 down(button?: ButtonNames): PointerAction;
63 down(params?: PointerActionParams): PointerAction;
64 /**
65 * An action that cancels this pointer's current input.
66 */
67 cancel(): this;
68}
69export {};
70//# sourceMappingURL=pointer.d.ts.map
\No newline at end of file