Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ulixee
GitHub Repository: ulixee/secret-agent
Path: blob/main/interfaces/IInteractions.ts
1028 views
1
// eslint-disable-next-line import/no-extraneous-dependencies
2
import { IJsPath } from 'awaited-dom/base/AwaitedPath';
3
import { IKeyboardKeyCode } from './IKeyboardLayoutUS';
4
5
export type IInteractionGroups = IInteractionGroup[];
6
export type IInteractionGroup = IInteractionStep[];
7
8
// Interactions
9
10
export interface IInteractionStep {
11
command: IInteractionCommand;
12
mousePosition?: IMousePosition;
13
mouseButton?: IMouseButton;
14
keyboardCommands?: IKeyboardCommand[];
15
keyboardDelayBetween?: number;
16
keyboardKeyupDelay?: number;
17
delayNode?: IJsPath;
18
delayElement?: IJsPath;
19
delayMillis?: number;
20
}
21
22
export enum InteractionCommand {
23
move = 'move',
24
scroll = 'scroll',
25
26
willDismissDialog = 'willDismissDialog',
27
28
click = 'click',
29
clickDown = 'clickDown',
30
clickUp = 'clickUp',
31
32
doubleclick = 'doubleclick',
33
34
type = 'type',
35
36
waitForNode = 'waitForNode',
37
waitForElementVisible = 'waitForElementVisible',
38
waitForMillis = 'waitForMillis',
39
}
40
41
export type IInteractionCommand = keyof typeof InteractionCommand;
42
43
// Mouse-specific Types
44
45
export enum MouseButton {
46
left = 'left',
47
middle = 'middle',
48
right = 'right',
49
}
50
export type IMouseButton = keyof typeof MouseButton;
51
52
export type IMousePositionXY = [number, number];
53
54
export type IMousePosition = IMousePositionXY | IJsPath;
55
56
// Keyboard-specific Types
57
58
export type IKeyboardCommand = IKeyPress | IKeyboardObject;
59
export type IKeyboardObject = IKeyboardString | IKeyboardUp | IKeyboardDown;
60
export interface IKeyboardString {
61
string: string;
62
}
63
export interface IKeyPress {
64
keyCode: IKeyboardKeyCode;
65
}
66
export interface IKeyboardUp {
67
up: IKeyboardKeyCode;
68
}
69
export interface IKeyboardDown {
70
down: IKeyboardKeyCode;
71
}
72
73