tomation 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +81 -0
- package/dist/.vite/manifest.json +8 -0
- package/dist/actions.d.ts +396 -0
- package/dist/automation.d.ts +116 -0
- package/dist/date-utils.d.ts +11 -0
- package/dist/main.cjs +1 -0
- package/dist/main.d.ts +4 -0
- package/dist/main.js +1350 -0
- package/dist/ui-element-builder.d.ts +286 -0
- package/dist/ui-utils.d.ts +27 -0
- package/package.json +43 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
declare class UIElement {
|
|
2
|
+
name: string;
|
|
3
|
+
selector: (parent?: HTMLElement | null, postProcessFn?: (elem: HTMLElement) => (HTMLElement | null)) => HTMLElement | null;
|
|
4
|
+
parent: UIElement | null;
|
|
5
|
+
postProcess?: ((elem: HTMLElement) => (HTMLElement | null));
|
|
6
|
+
constructor(name: string, selector: () => HTMLElement | null, parent?: UIElement | null, postProcessFn?: (elem: HTMLElement) => (HTMLElement | null));
|
|
7
|
+
getElementName(): string;
|
|
8
|
+
}
|
|
9
|
+
declare const setDocument: (doc: Document) => void;
|
|
10
|
+
declare const SelectorBuilder: (query: string, filterFn?: ((value: HTMLElement, index: number, array: readonly HTMLElement[]) => Boolean) | undefined) => (root?: Document, postProcess?: ((elem: HTMLElement) => HTMLElement) | undefined) => HTMLElement;
|
|
11
|
+
declare const setFilterLogs: (enabled: boolean) => void;
|
|
12
|
+
declare const classIs: (className: string) => (elem: HTMLElement) => boolean;
|
|
13
|
+
declare const classIncludes: (className: string) => (elem: HTMLElement) => boolean;
|
|
14
|
+
declare const innerTextIs: (text: string) => (elem: HTMLElement) => boolean;
|
|
15
|
+
declare const innerTextContains: (text: string) => (elem: HTMLElement) => boolean;
|
|
16
|
+
declare const titleIs: (text: string) => (elem: HTMLElement) => boolean;
|
|
17
|
+
declare const placeholderIs: (text: string) => (elem: HTMLElement) => boolean;
|
|
18
|
+
declare const isFirstElement: () => (elem: HTMLElement, index: number) => boolean;
|
|
19
|
+
declare const elementIndexIs: (index: number) => (elem: HTMLElement, elemIndex: number) => boolean;
|
|
20
|
+
declare const firstChildTextIs: (text: string) => (elem: HTMLElement) => boolean;
|
|
21
|
+
declare const and: (conditions: any[]) => (elem: HTMLElement, elemIndex: number) => boolean;
|
|
22
|
+
declare const is: {
|
|
23
|
+
DIV: {
|
|
24
|
+
where: (filterFn?: ((value: HTMLElement, index: number, array: readonly HTMLElement[]) => Boolean) | undefined) => {
|
|
25
|
+
childOf: (parent: UIElement) => {
|
|
26
|
+
/**
|
|
27
|
+
* Tansform the UI element that will be returned
|
|
28
|
+
* @param postProcessFn
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
postProcess: (postProcessFn: (elem: HTMLElement) => (HTMLElement | null)) => {
|
|
32
|
+
/**
|
|
33
|
+
* Sets the UI element identifier
|
|
34
|
+
* @param uiElementId
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
as: (uiElementId: string) => UIElement;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Sets the UI element identifier
|
|
41
|
+
* @param uiElementId
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
as: (uiElementId: string) => UIElement;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Tansform the UI element that will be returned
|
|
48
|
+
* @param postProcessFn
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
postProcess: (postProcessFn: (elem: HTMLElement) => (HTMLElement | null)) => {
|
|
52
|
+
/**
|
|
53
|
+
* Sets the UI element identifier
|
|
54
|
+
* @param uiElementId
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
as: (uiElementId: string) => UIElement;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Sets the UI element identifier
|
|
61
|
+
* @param uiElementId
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
as: (uiElementId: string) => UIElement;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
BUTTON: {
|
|
68
|
+
where: (filterFn?: ((value: HTMLElement, index: number, array: readonly HTMLElement[]) => Boolean) | undefined) => {
|
|
69
|
+
childOf: (parent: UIElement) => {
|
|
70
|
+
/**
|
|
71
|
+
* Tansform the UI element that will be returned
|
|
72
|
+
* @param postProcessFn
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
75
|
+
postProcess: (postProcessFn: (elem: HTMLElement) => (HTMLElement | null)) => {
|
|
76
|
+
/**
|
|
77
|
+
* Sets the UI element identifier
|
|
78
|
+
* @param uiElementId
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
81
|
+
as: (uiElementId: string) => UIElement;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Sets the UI element identifier
|
|
85
|
+
* @param uiElementId
|
|
86
|
+
* @returns
|
|
87
|
+
*/
|
|
88
|
+
as: (uiElementId: string) => UIElement;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Tansform the UI element that will be returned
|
|
92
|
+
* @param postProcessFn
|
|
93
|
+
* @returns
|
|
94
|
+
*/
|
|
95
|
+
postProcess: (postProcessFn: (elem: HTMLElement) => (HTMLElement | null)) => {
|
|
96
|
+
/**
|
|
97
|
+
* Sets the UI element identifier
|
|
98
|
+
* @param uiElementId
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
as: (uiElementId: string) => UIElement;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Sets the UI element identifier
|
|
105
|
+
* @param uiElementId
|
|
106
|
+
* @returns
|
|
107
|
+
*/
|
|
108
|
+
as: (uiElementId: string) => UIElement;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
INPUT: {
|
|
112
|
+
where: (filterFn?: ((value: HTMLElement, index: number, array: readonly HTMLElement[]) => Boolean) | undefined) => {
|
|
113
|
+
childOf: (parent: UIElement) => {
|
|
114
|
+
/**
|
|
115
|
+
* Tansform the UI element that will be returned
|
|
116
|
+
* @param postProcessFn
|
|
117
|
+
* @returns
|
|
118
|
+
*/
|
|
119
|
+
postProcess: (postProcessFn: (elem: HTMLElement) => (HTMLElement | null)) => {
|
|
120
|
+
/**
|
|
121
|
+
* Sets the UI element identifier
|
|
122
|
+
* @param uiElementId
|
|
123
|
+
* @returns
|
|
124
|
+
*/
|
|
125
|
+
as: (uiElementId: string) => UIElement;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Sets the UI element identifier
|
|
129
|
+
* @param uiElementId
|
|
130
|
+
* @returns
|
|
131
|
+
*/
|
|
132
|
+
as: (uiElementId: string) => UIElement;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Tansform the UI element that will be returned
|
|
136
|
+
* @param postProcessFn
|
|
137
|
+
* @returns
|
|
138
|
+
*/
|
|
139
|
+
postProcess: (postProcessFn: (elem: HTMLElement) => (HTMLElement | null)) => {
|
|
140
|
+
/**
|
|
141
|
+
* Sets the UI element identifier
|
|
142
|
+
* @param uiElementId
|
|
143
|
+
* @returns
|
|
144
|
+
*/
|
|
145
|
+
as: (uiElementId: string) => UIElement;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Sets the UI element identifier
|
|
149
|
+
* @param uiElementId
|
|
150
|
+
* @returns
|
|
151
|
+
*/
|
|
152
|
+
as: (uiElementId: string) => UIElement;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
TEXTAREA: {
|
|
156
|
+
where: (filterFn?: ((value: HTMLElement, index: number, array: readonly HTMLElement[]) => Boolean) | undefined) => {
|
|
157
|
+
childOf: (parent: UIElement) => {
|
|
158
|
+
/**
|
|
159
|
+
* Tansform the UI element that will be returned
|
|
160
|
+
* @param postProcessFn
|
|
161
|
+
* @returns
|
|
162
|
+
*/
|
|
163
|
+
postProcess: (postProcessFn: (elem: HTMLElement) => (HTMLElement | null)) => {
|
|
164
|
+
/**
|
|
165
|
+
* Sets the UI element identifier
|
|
166
|
+
* @param uiElementId
|
|
167
|
+
* @returns
|
|
168
|
+
*/
|
|
169
|
+
as: (uiElementId: string) => UIElement;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Sets the UI element identifier
|
|
173
|
+
* @param uiElementId
|
|
174
|
+
* @returns
|
|
175
|
+
*/
|
|
176
|
+
as: (uiElementId: string) => UIElement;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Tansform the UI element that will be returned
|
|
180
|
+
* @param postProcessFn
|
|
181
|
+
* @returns
|
|
182
|
+
*/
|
|
183
|
+
postProcess: (postProcessFn: (elem: HTMLElement) => (HTMLElement | null)) => {
|
|
184
|
+
/**
|
|
185
|
+
* Sets the UI element identifier
|
|
186
|
+
* @param uiElementId
|
|
187
|
+
* @returns
|
|
188
|
+
*/
|
|
189
|
+
as: (uiElementId: string) => UIElement;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Sets the UI element identifier
|
|
193
|
+
* @param uiElementId
|
|
194
|
+
* @returns
|
|
195
|
+
*/
|
|
196
|
+
as: (uiElementId: string) => UIElement;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
ELEMENT: (htmlTag: string) => {
|
|
200
|
+
where: (filterFn?: ((value: HTMLElement, index: number, array: readonly HTMLElement[]) => Boolean) | undefined) => {
|
|
201
|
+
childOf: (parent: UIElement) => {
|
|
202
|
+
/**
|
|
203
|
+
* Tansform the UI element that will be returned
|
|
204
|
+
* @param postProcessFn
|
|
205
|
+
* @returns
|
|
206
|
+
*/
|
|
207
|
+
postProcess: (postProcessFn: (elem: HTMLElement) => (HTMLElement | null)) => {
|
|
208
|
+
/**
|
|
209
|
+
* Sets the UI element identifier
|
|
210
|
+
* @param uiElementId
|
|
211
|
+
* @returns
|
|
212
|
+
*/
|
|
213
|
+
as: (uiElementId: string) => UIElement;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Sets the UI element identifier
|
|
217
|
+
* @param uiElementId
|
|
218
|
+
* @returns
|
|
219
|
+
*/
|
|
220
|
+
as: (uiElementId: string) => UIElement;
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Tansform the UI element that will be returned
|
|
224
|
+
* @param postProcessFn
|
|
225
|
+
* @returns
|
|
226
|
+
*/
|
|
227
|
+
postProcess: (postProcessFn: (elem: HTMLElement) => (HTMLElement | null)) => {
|
|
228
|
+
/**
|
|
229
|
+
* Sets the UI element identifier
|
|
230
|
+
* @param uiElementId
|
|
231
|
+
* @returns
|
|
232
|
+
*/
|
|
233
|
+
as: (uiElementId: string) => UIElement;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Sets the UI element identifier
|
|
237
|
+
* @param uiElementId
|
|
238
|
+
* @returns
|
|
239
|
+
*/
|
|
240
|
+
as: (uiElementId: string) => UIElement;
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
identifiedBy: (id: string) => {
|
|
244
|
+
childOf: (parent: UIElement) => {
|
|
245
|
+
/**
|
|
246
|
+
* Tansform the UI element that will be returned
|
|
247
|
+
* @param postProcessFn
|
|
248
|
+
* @returns
|
|
249
|
+
*/
|
|
250
|
+
postProcess: (postProcessFn: (elem: HTMLElement) => (HTMLElement | null)) => {
|
|
251
|
+
/**
|
|
252
|
+
* Sets the UI element identifier
|
|
253
|
+
* @param uiElementId
|
|
254
|
+
* @returns
|
|
255
|
+
*/
|
|
256
|
+
as: (uiElementId: string) => UIElement;
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* Sets the UI element identifier
|
|
260
|
+
* @param uiElementId
|
|
261
|
+
* @returns
|
|
262
|
+
*/
|
|
263
|
+
as: (uiElementId: string) => UIElement;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* Tansform the UI element that will be returned
|
|
267
|
+
* @param postProcessFn
|
|
268
|
+
* @returns
|
|
269
|
+
*/
|
|
270
|
+
postProcess: (postProcessFn: (elem: HTMLElement) => (HTMLElement | null)) => {
|
|
271
|
+
/**
|
|
272
|
+
* Sets the UI element identifier
|
|
273
|
+
* @param uiElementId
|
|
274
|
+
* @returns
|
|
275
|
+
*/
|
|
276
|
+
as: (uiElementId: string) => UIElement;
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Sets the UI element identifier
|
|
280
|
+
* @param uiElementId
|
|
281
|
+
* @returns
|
|
282
|
+
*/
|
|
283
|
+
as: (uiElementId: string) => UIElement;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
export { setDocument, UIElement, SelectorBuilder, is, classIs, classIncludes, innerTextIs, innerTextContains, titleIs, placeholderIs, isFirstElement, elementIndexIs, firstChildTextIs, and, setFilterLogs };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare const wait: (timeout?: number) => Promise<unknown>;
|
|
2
|
+
declare class UIUtils {
|
|
3
|
+
window: Window;
|
|
4
|
+
document: Document;
|
|
5
|
+
devToolsMessageContainer: HTMLElement;
|
|
6
|
+
devToolsCheckElementContainer: HTMLElement;
|
|
7
|
+
darkLayerLeft: HTMLElement;
|
|
8
|
+
darkLayerTop: HTMLElement;
|
|
9
|
+
darkLayerRight: HTMLElement;
|
|
10
|
+
darkLayerBottom: HTMLElement;
|
|
11
|
+
currentCheckElem: HTMLElement;
|
|
12
|
+
contextViewerContainer: HTMLElement;
|
|
13
|
+
devToolsAlertContainer: HTMLElement;
|
|
14
|
+
constructor(window: Window);
|
|
15
|
+
private createElement;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param message @deprecated
|
|
19
|
+
*/
|
|
20
|
+
logAction(message: string): Promise<void>;
|
|
21
|
+
checkElement(elem: HTMLElement, name: string): Promise<void>;
|
|
22
|
+
showAlert(message: string): Promise<void>;
|
|
23
|
+
hideAlert(): Promise<void>;
|
|
24
|
+
hideCheckElementContainer(): Promise<void>;
|
|
25
|
+
displayContext(context: any): void;
|
|
26
|
+
}
|
|
27
|
+
export { wait, UIUtils };
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tomation",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"import": "./dist/main.js",
|
|
8
|
+
"require": "./dist/main.js"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"main": "./dist/main.js",
|
|
12
|
+
"module": "./dist/main.js",
|
|
13
|
+
"types": "./dist/main.d.ts",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc && vite build",
|
|
19
|
+
"build:watch": "tsc && vite build --watch",
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"test": "vitest",
|
|
22
|
+
"coverage": "vitest run --coverage"
|
|
23
|
+
},
|
|
24
|
+
"resolutions": {
|
|
25
|
+
"rollup": "2.74.1"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"uuid": "^9.0.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^17.0.35",
|
|
32
|
+
"@types/uuid": "^9.0.2",
|
|
33
|
+
"@vitest/coverage-v8": "^1.5.0",
|
|
34
|
+
"@vitest/ui": "^1.5.0",
|
|
35
|
+
"jsdom": "^22.1.0",
|
|
36
|
+
"prettier": "2.6.2",
|
|
37
|
+
"tslib": "^2.4.0",
|
|
38
|
+
"typescript": "^4.7.2",
|
|
39
|
+
"vite": "^5.2.9",
|
|
40
|
+
"vite-plugin-dts": "^3.5.2",
|
|
41
|
+
"vitest": "^1.5.0"
|
|
42
|
+
}
|
|
43
|
+
}
|