tomation 0.0.11 → 0.0.13
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/dist/main.cjs +1 -1
- package/dist/main.js +1279 -1477
- package/dist/{dom → src/dom}/actions.d.ts +1 -1
- package/dist/{dsl → src/dsl}/actions.d.ts +1 -1
- package/dist/{dsl → src/dsl}/task.d.ts +1 -1
- package/dist/{dsl → src/dsl}/ui-element-filters.d.ts +1 -1
- package/dist/{dsl → src/dsl}/ui-element.d.ts +5 -5
- package/dist/{engine → src/engine}/compiler.d.ts +1 -1
- package/dist/{engine → src/engine}/runner.d.ts +2 -2
- package/dist/{main.d.ts → src/main.d.ts} +2 -3
- package/package.json +14 -18
- /package/dist/{dsl → src/dsl}/test.d.ts +0 -0
- /package/dist/{engine → src/engine}/events.d.ts +0 -0
- /package/dist/{feedback → src/feedback}/logger.d.ts +0 -0
- /package/dist/{feedback → src/feedback}/ui-utils.d.ts +0 -0
- /package/dist/{tomation.d.ts → src/tomation.d.ts} +0 -0
- /package/dist/{utils → src/utils}/date-utils.d.ts +0 -0
package/dist/main.js
CHANGED
|
@@ -1,1486 +1,1288 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}, A = (e = 2e3) => new Promise((t) => {
|
|
116
|
-
setTimeout(() => {
|
|
117
|
-
t(null);
|
|
118
|
-
}, e);
|
|
1
|
+
//#region src/dsl/ui-element-filters.ts
|
|
2
|
+
var e = !1, t = (...t) => {
|
|
3
|
+
e && console.log("[UIElement Filter]", ...t);
|
|
4
|
+
}, n = (e) => (n) => {
|
|
5
|
+
let r = n.className == e;
|
|
6
|
+
return t(`classIs('${e}') on`, n, "=>", r), r;
|
|
7
|
+
}, r = (e) => (n) => {
|
|
8
|
+
let r = n.className.split(" ").includes(e);
|
|
9
|
+
return t(`classIncludes('${e}') on`, n, "=>", r), r;
|
|
10
|
+
}, i = (e) => (n) => {
|
|
11
|
+
let r = n.textContent?.trim() == e;
|
|
12
|
+
return t(`innerTextIs('${e}') on`, n, "=>", r), r;
|
|
13
|
+
}, a = (e) => (n) => {
|
|
14
|
+
let r = n.innerText.trim().includes(e);
|
|
15
|
+
return t(`innerTextContains('${e}') on`, n, "=>", r), r;
|
|
16
|
+
}, o = (e) => (n) => {
|
|
17
|
+
let r = n.title == e;
|
|
18
|
+
return t(`titleIs('${e}') on`, n, "=>", r), r;
|
|
19
|
+
}, s = (e) => (n) => {
|
|
20
|
+
let r = n.placeholder === e;
|
|
21
|
+
return t(`placeholderIs('${e}') on`, n, "=>", r), r;
|
|
22
|
+
}, c = () => (e, n) => {
|
|
23
|
+
let r = n === 0;
|
|
24
|
+
return t("isFirstElement on", e, "index", n, "=>", r), r;
|
|
25
|
+
}, l = (e) => (n, r) => {
|
|
26
|
+
let i = r === e;
|
|
27
|
+
return t(`elementIndexIs(${e}) on`, n, "elemIndex", r, "=>", i), i;
|
|
28
|
+
}, u = (e) => (n) => {
|
|
29
|
+
let r = (n?.firstChild).innerText.trim() === e;
|
|
30
|
+
return t(`firstChildTextIs('${e}') on`, n, "=>", r), r;
|
|
31
|
+
}, d = (e) => (n, r) => {
|
|
32
|
+
let i = e.every((e, i) => {
|
|
33
|
+
let a = e(n, r);
|
|
34
|
+
return t(`and condition[${i}] on`, n, "elemIndex", r, "=>", a), a;
|
|
35
|
+
});
|
|
36
|
+
return t("and final result on", n, "elemIndex", r, "=>", i), i;
|
|
37
|
+
}, f = class {
|
|
38
|
+
name;
|
|
39
|
+
selector;
|
|
40
|
+
parent;
|
|
41
|
+
postProcess;
|
|
42
|
+
constructor(e, t, n, r) {
|
|
43
|
+
this.name = e, this.selector = t, this.parent = n || null, this.postProcess = r;
|
|
44
|
+
}
|
|
45
|
+
getElementName() {
|
|
46
|
+
let e = "";
|
|
47
|
+
return this.parent && (e = " in " + this.parent.getElementName()), `${this.name}${e}`;
|
|
48
|
+
}
|
|
49
|
+
}, p, ee = (e) => {
|
|
50
|
+
p = e;
|
|
51
|
+
}, m = (e, t) => (n = p, r) => {
|
|
52
|
+
n ||= p, console.log("Searching elem from Root = ", n);
|
|
53
|
+
let i = [];
|
|
54
|
+
n.querySelectorAll(e).forEach((e) => {
|
|
55
|
+
e.style.display !== "none" && i.push(e);
|
|
56
|
+
});
|
|
57
|
+
let a;
|
|
58
|
+
return t ? (console.log("Applying filter ", t), console.log(" -- to " + i.length + "elements: ", i), a = i.filter((e, n, r) => {
|
|
59
|
+
console.log("Apply filter to item " + n + ": ", e);
|
|
60
|
+
let i = t(e, n, r);
|
|
61
|
+
return console.log(` -> Item ${n} ${i ? "Match" : "Discarded"}`), i;
|
|
62
|
+
})[0]) : a = i[0], a && r && (console.log("Apply post process to = ", a), a = r(a)), console.log("Return elem = ", a), a;
|
|
63
|
+
}, h = (e, t, n) => ({ as: (r) => new f(r, e, t, n) }), te = (e, t) => ({
|
|
64
|
+
...h(e, t),
|
|
65
|
+
postProcess: (n) => ({ ...h(e, t, n) })
|
|
66
|
+
}), g = (e) => ({
|
|
67
|
+
...h(e, null),
|
|
68
|
+
childOf: (t) => ({ ...te(e, t) }),
|
|
69
|
+
postProcess: (t) => ({ ...h(e, null, t) })
|
|
70
|
+
}), _ = (e) => ({ where: (t) => g(m(e, t)) }), ne = {
|
|
71
|
+
DIV: _("div"),
|
|
72
|
+
BUTTON: _("button"),
|
|
73
|
+
INPUT: _("input"),
|
|
74
|
+
TEXTAREA: _("textarea"),
|
|
75
|
+
ELEMENT: (e) => _(e),
|
|
76
|
+
identifiedBy: (e) => g(m("#" + e))
|
|
77
|
+
}, v = /* @__PURE__ */ function(e) {
|
|
78
|
+
return e.ACTION_UPDATE = "tomation-action-update", e.SAVE_VALUE = "tomation-save-value", e.REGISTER_TEST = "tomation-register-test", e.TEST_STARTED = "tomation-test-started", e.TEST_PASSED = "tomation-test-passed", e.TEST_FAILED = "tomation-test-failed", e.TEST_END = "tomation-test-end", e.TEST_STOP = "tomation-test-stop", e.TEST_PAUSE = "tomation-test-pause", e.TEST_PLAY = "tomation-test-play", e.USER_ACCEPT = "tomation-user-accept", e.USER_REJECT = "tomation-user-reject", e.SESSION_INIT = "tomation-session-init", e.URL_MISMATCH = "tomation-url-mismatch", e.SESSION_CONNECTED = "tomation-session-connected", e;
|
|
79
|
+
}(v || {}), y = new class {
|
|
80
|
+
events;
|
|
81
|
+
constructor() {
|
|
82
|
+
this.events = /* @__PURE__ */ new Map();
|
|
83
|
+
}
|
|
84
|
+
on(e, t) {
|
|
85
|
+
this.events.has(e) || this.events.set(e, []), this.events.get(e)?.push(t);
|
|
86
|
+
}
|
|
87
|
+
off(e, t) {
|
|
88
|
+
this.events.has(e) && this.events.set(e, this.events.get(e)?.filter((e) => e !== t) || []);
|
|
89
|
+
}
|
|
90
|
+
dispatch(e, t) {
|
|
91
|
+
this.events.has(e) && this.events.get(e)?.forEach((n) => {
|
|
92
|
+
console.log(`Dispatch Event ${e}:`, t), n(t);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}(), b = !1, x = {
|
|
96
|
+
setEnabled(e) {
|
|
97
|
+
b = e;
|
|
98
|
+
},
|
|
99
|
+
log(...e) {
|
|
100
|
+
b && console.log("[tomation]", ...e);
|
|
101
|
+
},
|
|
102
|
+
groupCollapsed(...e) {
|
|
103
|
+
b && console.groupCollapsed("[tomation]", ...e);
|
|
104
|
+
},
|
|
105
|
+
groupEnd() {
|
|
106
|
+
b && console.groupEnd();
|
|
107
|
+
},
|
|
108
|
+
error(...e) {
|
|
109
|
+
b && console.error("[tomation]", ...e);
|
|
110
|
+
}
|
|
111
|
+
}, S = (e = 2e3) => new Promise((t) => {
|
|
112
|
+
setTimeout(() => {
|
|
113
|
+
t(null);
|
|
114
|
+
}, e);
|
|
119
115
|
}), C = (e, t) => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
let a;
|
|
362
|
-
const _ = (e, t) => (a = new ye(e), re(a.document), t == null || t.forEach((n) => n()), a);
|
|
363
|
-
let P = !1;
|
|
364
|
-
async function Ee(e) {
|
|
365
|
-
if (P)
|
|
366
|
-
throw u.error("Not able to run test while other test is running."), new Error("Not able to run test while other test is running.");
|
|
367
|
-
P = !0, a.status = "Playing", a.runMode = "Normal", u.groupCollapsed("Start Action: ", e.getDescription()), g.dispatch(d.TEST_STARTED, {
|
|
368
|
-
action: e == null ? void 0 : e.getJSON()
|
|
369
|
-
});
|
|
370
|
-
try {
|
|
371
|
-
await (e == null ? void 0 : e.execute()), g.dispatch(d.TEST_PASSED, { id: e.name });
|
|
372
|
-
} catch (t) {
|
|
373
|
-
throw g.dispatch(d.TEST_FAILED, { id: e.name }), a.uiUtils.hideCheckElementContainer(), u.error(`🤖 Error running task ${e.getDescription()}. Reason: ${t.message}`), t;
|
|
374
|
-
} finally {
|
|
375
|
-
u.groupEnd(), P = !1, g.dispatch(d.TEST_END, {
|
|
376
|
-
action: e == null ? void 0 : e.getJSON()
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
const W = {
|
|
381
|
-
start: Ee,
|
|
382
|
-
get running() {
|
|
383
|
-
return P;
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
let I;
|
|
387
|
-
const we = new Uint8Array(16);
|
|
388
|
-
function fe() {
|
|
389
|
-
if (!I && (I = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !I))
|
|
390
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
391
|
-
return I(we);
|
|
392
|
-
}
|
|
393
|
-
const m = [];
|
|
394
|
-
for (let e = 0; e < 256; ++e)
|
|
395
|
-
m.push((e + 256).toString(16).slice(1));
|
|
396
|
-
function xe(e, t = 0) {
|
|
397
|
-
return (m[e[t + 0]] + m[e[t + 1]] + m[e[t + 2]] + m[e[t + 3]] + "-" + m[e[t + 4]] + m[e[t + 5]] + "-" + m[e[t + 6]] + m[e[t + 7]] + "-" + m[e[t + 8]] + m[e[t + 9]] + "-" + m[e[t + 10]] + m[e[t + 11]] + m[e[t + 12]] + m[e[t + 13]] + m[e[t + 14]] + m[e[t + 15]]).toLowerCase();
|
|
398
|
-
}
|
|
399
|
-
const Ae = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), j = {
|
|
400
|
-
randomUUID: Ae
|
|
401
|
-
};
|
|
402
|
-
function Z(e, t, n) {
|
|
403
|
-
if (j.randomUUID && !t && !e)
|
|
404
|
-
return j.randomUUID();
|
|
405
|
-
e = e || {};
|
|
406
|
-
const s = e.random || (e.rng || fe)();
|
|
407
|
-
if (s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, t) {
|
|
408
|
-
n = n || 0;
|
|
409
|
-
for (let o = 0; o < 16; ++o)
|
|
410
|
-
t[n + o] = s[o];
|
|
411
|
-
return t;
|
|
412
|
-
}
|
|
413
|
-
return xe(s);
|
|
414
|
-
}
|
|
415
|
-
const q = null, L = async (e, t, n, s = 1e3, o = 0, i = 10, c = !1) => {
|
|
416
|
-
if (console.log("Automation Status: ", a.status), a.isPaused)
|
|
417
|
-
return new Promise((l, y) => {
|
|
418
|
-
a.saveCurrentAction(async (w) => {
|
|
419
|
-
if (w.status == "skipped")
|
|
420
|
-
return l(null);
|
|
421
|
-
try {
|
|
422
|
-
const f = await L(w, t, n, s, o, i, c);
|
|
423
|
-
l(f);
|
|
424
|
-
} catch (f) {
|
|
425
|
-
y(f);
|
|
426
|
-
}
|
|
427
|
-
}, e);
|
|
428
|
-
});
|
|
429
|
-
if (a.isStopped)
|
|
430
|
-
throw new Error("Test stopped manually");
|
|
431
|
-
if (console.groupCollapsed(`tries ${o}/${i}`), e && (e.updateTries(o), await E.notifyActionUpdated(e)), o === i)
|
|
432
|
-
throw console.groupEnd(), c ? new Error(`UI Element ${t.getElementName() || "UNKNOWN"} still present after 10 tries`) : new Error(`UI Element ${t.getElementName() || "UNKNOWN"} not found after 10 tries`);
|
|
433
|
-
{
|
|
434
|
-
const l = t.selector(n, t.postProcess);
|
|
435
|
-
return console.groupEnd(), l ? c ? (await A(s), await L(e, t, n, s, ++o, i, c)) : (console.log("Element found = ", l), l) : c ? (console.log("Element removed."), q) : (await A(s), await L(e, t, n, s, ++o, i, c));
|
|
436
|
-
}
|
|
437
|
-
}, J = async (e, t, n = 1e3, s = 10, o = !1) => {
|
|
438
|
-
const i = t == null ? void 0 : t.getElementName();
|
|
439
|
-
console.group("Looking for Element: " + i);
|
|
440
|
-
let c = null;
|
|
441
|
-
if (t.parent)
|
|
442
|
-
try {
|
|
443
|
-
console.groupCollapsed("Look for Parent ", t.parent.getElementName()), c = await J(e, t.parent, n, s, o), console.groupEnd();
|
|
444
|
-
} catch (l) {
|
|
445
|
-
if (console.groupEnd(), o && l.message.includes("not found"))
|
|
446
|
-
return console.log("Parent not found, so element was removed"), console.groupEnd(), q;
|
|
447
|
-
throw console.groupEnd(), l;
|
|
448
|
-
}
|
|
449
|
-
try {
|
|
450
|
-
console.log("Using parent element: ", c);
|
|
451
|
-
const l = await L(e, t, c, n, 0, s, o);
|
|
452
|
-
return console.groupEnd(), l;
|
|
453
|
-
} catch (l) {
|
|
454
|
-
if (o && l.message.includes("not found"))
|
|
455
|
-
return console.log("Parent not found, so element was removed"), console.groupEnd(), q;
|
|
456
|
-
throw console.groupEnd(), l;
|
|
457
|
-
}
|
|
458
|
-
};
|
|
459
|
-
var Y = /* @__PURE__ */ ((e) => (e.WAITING = "waiting", e.RUNNING = "running", e.STOPPED = "stopped", e.PAUSED = "paused", e.SUCCESS = "success", e.ERROR = "error", e.SKIPPED = "skipped", e))(Y || {});
|
|
460
|
-
class E {
|
|
461
|
-
constructor() {
|
|
462
|
-
r(this, "status");
|
|
463
|
-
r(this, "error");
|
|
464
|
-
r(this, "id");
|
|
465
|
-
r(this, "context");
|
|
466
|
-
this.status = "waiting", this.error = "", this.id = Z(), this.context = {
|
|
467
|
-
beforeHTML: "",
|
|
468
|
-
beforeInputValues: {},
|
|
469
|
-
afterInputValues: {},
|
|
470
|
-
afterHTML: "",
|
|
471
|
-
url: "",
|
|
472
|
-
startTimestamp: "",
|
|
473
|
-
endTimestamp: ""
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
getJSON() {
|
|
477
|
-
return {
|
|
478
|
-
id: this.id,
|
|
479
|
-
description: this.getDescription(),
|
|
480
|
-
context: this.context,
|
|
481
|
-
status: this.status,
|
|
482
|
-
error: this.error
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
reset() {
|
|
486
|
-
this.status = "waiting", this.error = "", this.resetAction();
|
|
487
|
-
}
|
|
488
|
-
getInputValuesFromPage() {
|
|
489
|
-
const t = {};
|
|
490
|
-
return a.document.querySelectorAll("input").forEach((s, o) => {
|
|
491
|
-
const i = `value-id-${o}`;
|
|
492
|
-
s.setAttribute("input-id", i), t[i] = s.value;
|
|
493
|
-
}), t;
|
|
494
|
-
}
|
|
495
|
-
async execute() {
|
|
496
|
-
try {
|
|
497
|
-
this.status = "running", this.context.beforeInputValues = this.getInputValuesFromPage(), this.context.beforeHTML = a.document.body.innerHTML, await E.notifyActionUpdated(this), console.log("Action: ", this.getDescription()), await this.executeAction(), this.status = "success", this.error = "", a.isStepByStepMode && a.pause();
|
|
498
|
-
} catch (t) {
|
|
499
|
-
if (this.status = "error", this.error = t.message, t.message == "Test stopped manually")
|
|
500
|
-
throw Error("Error in Action " + this.getDescription() + ". Message: " + t.message);
|
|
501
|
-
this.status = "paused", a.pause();
|
|
502
|
-
} finally {
|
|
503
|
-
this.context.afterInputValues = this.getInputValuesFromPage(), this.context.afterHTML = a.document.body.innerHTML, await E.notifyActionUpdated(this);
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
static async notifyActionUpdated(t) {
|
|
507
|
-
g.dispatch(d.ACTION_UPDATE, {
|
|
508
|
-
action: t.getJSON()
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
class ee extends E {
|
|
513
|
-
constructor(n, s) {
|
|
514
|
-
super();
|
|
515
|
-
r(this, "name");
|
|
516
|
-
r(this, "stepsFn");
|
|
517
|
-
r(this, "steps");
|
|
518
|
-
r(this, "params");
|
|
519
|
-
r(this, "index");
|
|
520
|
-
this.name = n, this.stepsFn = s, this.steps = [], this.index = 0;
|
|
521
|
-
}
|
|
522
|
-
getDescription() {
|
|
523
|
-
return this.name;
|
|
524
|
-
}
|
|
525
|
-
compileSteps() {
|
|
526
|
-
super.reset(), this.stepsFn(this.params);
|
|
527
|
-
}
|
|
528
|
-
stepsToJSON() {
|
|
529
|
-
return this.steps.reduce((n, s) => (n.push(s.getJSON()), n), []);
|
|
530
|
-
}
|
|
531
|
-
getJSON() {
|
|
532
|
-
return {
|
|
533
|
-
...super.getJSON(),
|
|
534
|
-
type: "Action",
|
|
535
|
-
params: this.params,
|
|
536
|
-
steps: this.stepsToJSON()
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
resetAction() {
|
|
540
|
-
this.steps.length = 0, this.index = 0;
|
|
541
|
-
}
|
|
542
|
-
async continue() {
|
|
543
|
-
if (a.isPaused)
|
|
544
|
-
return new Promise((n, s) => {
|
|
545
|
-
a.saveCurrentAction(async (o) => {
|
|
546
|
-
if (o.status == "skipped")
|
|
547
|
-
return n();
|
|
548
|
-
try {
|
|
549
|
-
await o.continue(), n();
|
|
550
|
-
} catch (i) {
|
|
551
|
-
s(i);
|
|
552
|
-
}
|
|
553
|
-
}, this);
|
|
554
|
-
});
|
|
555
|
-
if (a.isStopped)
|
|
556
|
-
throw new Error("Test stopped manually");
|
|
557
|
-
if (this.index < this.steps.length) {
|
|
558
|
-
const n = this.steps[this.index];
|
|
559
|
-
try {
|
|
560
|
-
if (await A(a.speed), await n.execute(), !a.isPaused)
|
|
561
|
-
this.index++, await this.continue();
|
|
562
|
-
else
|
|
563
|
-
return new Promise((s, o) => {
|
|
564
|
-
a.saveCurrentAction(async (i) => {
|
|
565
|
-
if (i.status == "skipped")
|
|
566
|
-
return this.index++, await E.notifyActionUpdated(n), await this.continue(), s();
|
|
567
|
-
try {
|
|
568
|
-
await i.continue(), s();
|
|
569
|
-
} catch (c) {
|
|
570
|
-
o(c);
|
|
571
|
-
}
|
|
572
|
-
}, n);
|
|
573
|
-
});
|
|
574
|
-
} catch (s) {
|
|
575
|
-
throw s;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
async executeAction() {
|
|
580
|
-
this.index = 0, await this.continue();
|
|
581
|
-
}
|
|
582
|
-
setParams(n) {
|
|
583
|
-
this.params = n;
|
|
584
|
-
}
|
|
585
|
-
addStep(n) {
|
|
586
|
-
this.steps.push(n);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
class p extends E {
|
|
590
|
-
constructor(n) {
|
|
591
|
-
super();
|
|
592
|
-
r(this, "uiElement");
|
|
593
|
-
r(this, "element");
|
|
594
|
-
r(this, "tries");
|
|
595
|
-
this.uiElement = n, this.element = null, this.tries = 0;
|
|
596
|
-
}
|
|
597
|
-
getElementName() {
|
|
598
|
-
var n;
|
|
599
|
-
return (n = this.uiElement) == null ? void 0 : n.getElementName();
|
|
600
|
-
}
|
|
601
|
-
updateTries(n) {
|
|
602
|
-
this.tries = n;
|
|
603
|
-
}
|
|
604
|
-
resetTries() {
|
|
605
|
-
this.tries = 0;
|
|
606
|
-
}
|
|
607
|
-
getJSON() {
|
|
608
|
-
return {
|
|
609
|
-
id: this.id,
|
|
610
|
-
element: this.getElementName(),
|
|
611
|
-
description: this.getDescription(),
|
|
612
|
-
status: this.status,
|
|
613
|
-
error: this.error,
|
|
614
|
-
context: this.context,
|
|
615
|
-
tries: this.tries
|
|
616
|
-
};
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
*
|
|
620
|
-
* @param uiElement
|
|
621
|
-
* @param delay of each try. Defaults to 1 second
|
|
622
|
-
*/
|
|
623
|
-
static waitForElement(n, s, o = 1e3, i = 10, c = !1) {
|
|
624
|
-
const l = s.getElementName();
|
|
625
|
-
return new Promise(async (y, w) => {
|
|
626
|
-
var V;
|
|
627
|
-
const f = async (x, O = 1e3, N = 0, v = !1) => {
|
|
628
|
-
if (console.groupCollapsed(`tries ${N}/${i}`), n.updateTries(N), await E.notifyActionUpdated(n), N === i)
|
|
629
|
-
throw console.groupEnd(), v ? new Error(`UI Element ${l || "UNKNOWN"} still present after 10 tries`) : new Error(`UI Element ${l || "UNKNOWN"} not found after 10 tries`);
|
|
630
|
-
{
|
|
631
|
-
const M = s.selector(x, s.postProcess);
|
|
632
|
-
return console.groupEnd(), M ? v ? (await A(O), await f(x, O, ++N, v)) : (console.log("Element found = ", M), M) : v ? (console.log("Element removed."), null) : (await A(O), await f(x, O, ++N, v));
|
|
633
|
-
}
|
|
634
|
-
};
|
|
635
|
-
console.group("[Action On Element] Looking for Element: " + l);
|
|
636
|
-
let S = null, T = !0;
|
|
637
|
-
if (s.parent) {
|
|
638
|
-
console.groupCollapsed("Look for Parent ", s.parent.getElementName());
|
|
639
|
-
try {
|
|
640
|
-
S = await p.waitForElement(n, s.parent, o, i, c);
|
|
641
|
-
} catch {
|
|
642
|
-
T = !1;
|
|
643
|
-
} finally {
|
|
644
|
-
console.groupEnd();
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
if (T) {
|
|
648
|
-
console.log("using parent element: ", S);
|
|
649
|
-
try {
|
|
650
|
-
const x = await f(S, o, 0, c);
|
|
651
|
-
console.groupEnd(), y(x);
|
|
652
|
-
} catch (x) {
|
|
653
|
-
console.groupEnd(), w(new Error(x.message));
|
|
654
|
-
}
|
|
655
|
-
} else
|
|
656
|
-
console.groupEnd(), w(new Error(`Parent ${(V = s.parent) == null ? void 0 : V.getElementName()} of UI Element ${s.name || "UNKNOWN"} not found`));
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
async executeAction() {
|
|
660
|
-
var n;
|
|
661
|
-
try {
|
|
662
|
-
this.element = await J(this, this.uiElement), (n = this.element) == null || n.setAttribute("test-id", this.getElementName()), await a.uiUtils.checkElement(this.element, this.getElementName()), this.executeActionOnElement(), await a.uiUtils.hideCheckElementContainer();
|
|
663
|
-
} catch (s) {
|
|
664
|
-
throw Error(s.message);
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
resetAction() {
|
|
668
|
-
this.element = null, this.resetTries();
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
class Ce extends p {
|
|
672
|
-
constructor(t) {
|
|
673
|
-
super(t);
|
|
674
|
-
}
|
|
675
|
-
executeActionOnElement() {
|
|
676
|
-
var t;
|
|
677
|
-
return (t = this.element) == null ? void 0 : t.click();
|
|
678
|
-
}
|
|
679
|
-
getDescription() {
|
|
680
|
-
return "Click in " + this.getElementName();
|
|
681
|
-
}
|
|
682
|
-
getJSON() {
|
|
683
|
-
return {
|
|
684
|
-
...super.getJSON(),
|
|
685
|
-
type: "Click"
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
class Se extends p {
|
|
690
|
-
constructor(n, s) {
|
|
691
|
-
super(n);
|
|
692
|
-
r(this, "text");
|
|
693
|
-
this.text = s;
|
|
694
|
-
}
|
|
695
|
-
executeActionOnElement() {
|
|
696
|
-
var s;
|
|
697
|
-
if (!(((s = this.element) == null ? void 0 : s.innerText) === this.text))
|
|
698
|
-
throw new Error(`Text in element ${this.getElementName()} is not '${this.text}'`);
|
|
699
|
-
}
|
|
700
|
-
getDescription() {
|
|
701
|
-
return `Assert that text in ${this.getElementName()} is '${this.text}'`;
|
|
702
|
-
}
|
|
703
|
-
getJSON() {
|
|
704
|
-
return {
|
|
705
|
-
...super.getJSON(),
|
|
706
|
-
type: "AssertTextIsAction",
|
|
707
|
-
value: this.text
|
|
708
|
-
};
|
|
709
|
-
}
|
|
116
|
+
Object.entries(t).map(([e, t]) => ({
|
|
117
|
+
key: e,
|
|
118
|
+
value: t
|
|
119
|
+
})).forEach((t) => {
|
|
120
|
+
let { key: n, value: r } = t;
|
|
121
|
+
e.style[n] = r;
|
|
122
|
+
});
|
|
123
|
+
}, re = class {
|
|
124
|
+
window;
|
|
125
|
+
document;
|
|
126
|
+
devToolsMessageContainer;
|
|
127
|
+
devToolsCheckElementContainer;
|
|
128
|
+
darkLayerLeft;
|
|
129
|
+
darkLayerTop;
|
|
130
|
+
darkLayerRight;
|
|
131
|
+
darkLayerBottom;
|
|
132
|
+
currentCheckElem;
|
|
133
|
+
contextViewerContainer;
|
|
134
|
+
devToolsAlertContainer;
|
|
135
|
+
constructor(e) {
|
|
136
|
+
this.document = e.document, this.window = e, this.devToolsMessageContainer = this.createElement("DIV", {
|
|
137
|
+
id: "dev-tools-message-container",
|
|
138
|
+
styles: {
|
|
139
|
+
width: "500px",
|
|
140
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
141
|
+
color: "white",
|
|
142
|
+
position: "fixed",
|
|
143
|
+
bottom: "10px",
|
|
144
|
+
right: "10px",
|
|
145
|
+
fontFamily: "monospace",
|
|
146
|
+
zIndex: "9999"
|
|
147
|
+
},
|
|
148
|
+
parent: this.document.body
|
|
149
|
+
}), this.devToolsAlertContainer = this.createElement("DIV", {
|
|
150
|
+
id: "dev-tools-alert-container",
|
|
151
|
+
styles: {
|
|
152
|
+
width: "100%",
|
|
153
|
+
height: "30px",
|
|
154
|
+
backgroundColor: "#b00",
|
|
155
|
+
color: "white",
|
|
156
|
+
position: "absolute ",
|
|
157
|
+
top: 0,
|
|
158
|
+
fontFamily: "monospace",
|
|
159
|
+
zIndex: "9999",
|
|
160
|
+
display: "none",
|
|
161
|
+
alignItems: "center",
|
|
162
|
+
justifyContent: "center",
|
|
163
|
+
padding: "5px"
|
|
164
|
+
},
|
|
165
|
+
parent: this.document.body
|
|
166
|
+
}), this.devToolsCheckElementContainer = this.createElement("DIV", {
|
|
167
|
+
id: "dev-tools-check-element-container",
|
|
168
|
+
styles: {
|
|
169
|
+
width: "100%",
|
|
170
|
+
height: this.document.body.clientHeight + "px",
|
|
171
|
+
position: "absolute",
|
|
172
|
+
top: "0px",
|
|
173
|
+
left: "0px",
|
|
174
|
+
zIndex: "9990",
|
|
175
|
+
display: "none",
|
|
176
|
+
opacity: "0",
|
|
177
|
+
transition: "opacity .2s"
|
|
178
|
+
},
|
|
179
|
+
parent: this.document.body
|
|
180
|
+
});
|
|
181
|
+
let t = {
|
|
182
|
+
zIndex: "9991",
|
|
183
|
+
backgroundColor: "rgba(0,0,0,0.3)",
|
|
184
|
+
position: "absolute"
|
|
185
|
+
};
|
|
186
|
+
this.darkLayerLeft = this.createElement("DIV", {
|
|
187
|
+
id: "dark-layer-left",
|
|
188
|
+
styles: t,
|
|
189
|
+
parent: this.devToolsCheckElementContainer
|
|
190
|
+
}), this.darkLayerTop = this.createElement("DIV", {
|
|
191
|
+
id: "dark-layer-top",
|
|
192
|
+
styles: t,
|
|
193
|
+
parent: this.devToolsCheckElementContainer
|
|
194
|
+
}), this.darkLayerRight = this.createElement("DIV", {
|
|
195
|
+
id: "dark-layer-right",
|
|
196
|
+
styles: t,
|
|
197
|
+
parent: this.devToolsCheckElementContainer
|
|
198
|
+
}), this.darkLayerBottom = this.createElement("DIV", {
|
|
199
|
+
id: "dark-layer-bottom",
|
|
200
|
+
styles: t,
|
|
201
|
+
parent: this.devToolsCheckElementContainer
|
|
202
|
+
}), this.currentCheckElem = this.createElement("DIV", {
|
|
203
|
+
id: "current-check-elem",
|
|
204
|
+
parent: this.devToolsCheckElementContainer
|
|
205
|
+
}), this.contextViewerContainer = this.createElement("DIV", {
|
|
206
|
+
id: "context-viewer-container",
|
|
207
|
+
styles: {
|
|
208
|
+
width: "100%",
|
|
209
|
+
height: this.document.body.clientHeight + "px",
|
|
210
|
+
position: "absolute",
|
|
211
|
+
top: "0px",
|
|
212
|
+
left: "0px",
|
|
213
|
+
zIndex: "10000",
|
|
214
|
+
display: "none"
|
|
215
|
+
},
|
|
216
|
+
parent: this.document.body
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
createElement(e, t) {
|
|
220
|
+
let n = this.document.createElement(e);
|
|
221
|
+
return t && (t.id && (n.id = t?.id), t.styles && C(n, t.styles), t.parent && t.parent.appendChild(n)), n;
|
|
222
|
+
}
|
|
223
|
+
async logAction(e) {
|
|
224
|
+
let t = O.document.createElement("DIV");
|
|
225
|
+
t.innerText = e, C(t, {
|
|
226
|
+
padding: "3px 10px",
|
|
227
|
+
opacity: "1",
|
|
228
|
+
transition: "opacity 1s"
|
|
229
|
+
}), this.devToolsMessageContainer.appendChild(t), await S(4e3), t.style.opacity = "0", await S(4e3), this.devToolsMessageContainer.removeChild(t), await S(1e3);
|
|
230
|
+
}
|
|
231
|
+
async checkElement(e, t) {
|
|
232
|
+
if (!e) return;
|
|
233
|
+
let n = e.getBoundingClientRect(), r = this.document.body.getBoundingClientRect();
|
|
234
|
+
this.darkLayerLeft.style.left = "0px", this.darkLayerLeft.style.top = n.top + "px", this.darkLayerLeft.style.width = this.window.scrollX + n.left + "px", this.darkLayerLeft.style.height = n.height + "px", this.darkLayerTop.style.left = this.window.scrollX + "px", this.darkLayerTop.style.top = "0px", this.darkLayerTop.style.width = "100%", this.darkLayerTop.style.height = n.top + "px", this.darkLayerRight.style.left = this.window.scrollX + n.left + n.width + "px", this.darkLayerRight.style.top = n.top + "px", this.darkLayerRight.style.width = r.width - (n.left + n.width) + "px", this.darkLayerRight.style.height = n.height + "px", this.darkLayerBottom.style.left = this.window.scrollX + "px", this.darkLayerBottom.style.top = n.top + n.height + "px", this.darkLayerBottom.style.width = "100%", this.darkLayerBottom.style.height = r.height - (n.top + n.height) + "px", this.currentCheckElem.id = `dev-tools-current-check-elem-${t}`, this.currentCheckElem.style.top = n.top + "px", this.currentCheckElem.style.left = this.window.scrollX + n.left + "px", this.currentCheckElem.style.height = n.height + "px", this.currentCheckElem.style.width = n.width + "px", this.currentCheckElem.style.boxShadow = "0px 0px 5px 2px lightgreen", this.currentCheckElem.style.position = "absolute", this.currentCheckElem.style.zIndex = "9992", this.devToolsCheckElementContainer.style.display = "block", this.devToolsCheckElementContainer.style.opacity = "1", await S(200);
|
|
235
|
+
}
|
|
236
|
+
async showAlert(e) {
|
|
237
|
+
let t = O.document.createElement("DIV"), n = O.document.body;
|
|
238
|
+
t.innerText = e, C(n, { paddingTop: "30px" }), C(this.devToolsAlertContainer, { display: "flex" }), this.devToolsAlertContainer.appendChild(t);
|
|
239
|
+
}
|
|
240
|
+
async hideAlert() {
|
|
241
|
+
C(this.devToolsAlertContainer, { display: "none" });
|
|
242
|
+
let e = O.document.body;
|
|
243
|
+
C(e, { paddingTop: "0" }), this.devToolsAlertContainer.firstChild && this.devToolsAlertContainer.removeChild(this.devToolsAlertContainer.firstChild);
|
|
244
|
+
}
|
|
245
|
+
async hideCheckElementContainer() {
|
|
246
|
+
this.devToolsCheckElementContainer.style.opacity = "0", await S(200), this.devToolsCheckElementContainer.style.display = "none";
|
|
247
|
+
}
|
|
248
|
+
displayContext(e) {
|
|
249
|
+
C(this.contextViewerContainer, {
|
|
250
|
+
display: "flex",
|
|
251
|
+
"background-color": "white",
|
|
252
|
+
position: "absolute",
|
|
253
|
+
top: "0px",
|
|
254
|
+
left: "0px",
|
|
255
|
+
"z-index": "9999"
|
|
256
|
+
});
|
|
257
|
+
let t = this.document.createElement("DIV");
|
|
258
|
+
t.id = "context-viewer-before", C(t, {
|
|
259
|
+
flex: "50%",
|
|
260
|
+
width: "100%",
|
|
261
|
+
height: "auto",
|
|
262
|
+
border: "2px solid orange"
|
|
263
|
+
});
|
|
264
|
+
let n = this.document.createElement("DIV");
|
|
265
|
+
n.id = "context-viewer-after", C(n, {
|
|
266
|
+
flex: "50%",
|
|
267
|
+
width: "100%",
|
|
268
|
+
height: "auto",
|
|
269
|
+
border: "2px solid green"
|
|
270
|
+
});
|
|
271
|
+
let r = this.document.createElement("DIV");
|
|
272
|
+
r.innerHTML = e.beforeHTML, w(r, e.beforeInputValues);
|
|
273
|
+
let i = this.document.createElement("DIV");
|
|
274
|
+
i.innerHTML = e.afterHTML, w(i, e.afterInputValues), this.contextViewerContainer.appendChild(t), t.appendChild(r), setTimeout(() => {
|
|
275
|
+
this.contextViewerContainer.removeChild(t), this.contextViewerContainer.appendChild(n), n.appendChild(i), setTimeout(() => {
|
|
276
|
+
this.contextViewerContainer.removeChild(n), C(this.contextViewerContainer, { display: "none" });
|
|
277
|
+
}, 2e3);
|
|
278
|
+
}, 2e3);
|
|
279
|
+
}
|
|
280
|
+
}, w = (e, t) => {
|
|
281
|
+
e.querySelectorAll("input").forEach((e) => {
|
|
282
|
+
e.value = t[e.getAttribute("input-id") || ""];
|
|
283
|
+
});
|
|
284
|
+
}, T = /* @__PURE__ */ function(e) {
|
|
285
|
+
return e[e.SLOW = 2e3] = "SLOW", e[e.NORMAL = 1e3] = "NORMAL", e[e.FAST = 200] = "FAST", e;
|
|
286
|
+
}(T || {}), E = /* @__PURE__ */ function(e) {
|
|
287
|
+
return e.PLAYING = "Playing", e.STOPPED = "Stopped", e.PAUSED = "Paused", e;
|
|
288
|
+
}(E || {}), D = /* @__PURE__ */ function(e) {
|
|
289
|
+
return e.NORMAL = "Normal", e.STEPBYSTEP = "Step By Step", e;
|
|
290
|
+
}(D || {}), ie = class {
|
|
291
|
+
_document;
|
|
292
|
+
debug;
|
|
293
|
+
_uiUtils;
|
|
294
|
+
speed;
|
|
295
|
+
status;
|
|
296
|
+
runMode;
|
|
297
|
+
currentActionCallback;
|
|
298
|
+
currentAction;
|
|
299
|
+
constructor(e) {
|
|
300
|
+
this._document = e.document, this.debug = !0, this._uiUtils = new re(e), this.speed = T.NORMAL, this.status = E.STOPPED, this.runMode = D.NORMAL;
|
|
301
|
+
}
|
|
302
|
+
get document() {
|
|
303
|
+
return this._document;
|
|
304
|
+
}
|
|
305
|
+
get uiUtils() {
|
|
306
|
+
return this._uiUtils;
|
|
307
|
+
}
|
|
308
|
+
get isStepByStepMode() {
|
|
309
|
+
return this.runMode == D.STEPBYSTEP;
|
|
310
|
+
}
|
|
311
|
+
get isStopped() {
|
|
312
|
+
return this.status == E.STOPPED;
|
|
313
|
+
}
|
|
314
|
+
get isPlaying() {
|
|
315
|
+
return this.status == E.PLAYING;
|
|
316
|
+
}
|
|
317
|
+
get isPaused() {
|
|
318
|
+
return this.status == E.PAUSED;
|
|
319
|
+
}
|
|
320
|
+
pause() {
|
|
321
|
+
x.log("Pause Test"), this.status = E.PAUSED, y.dispatch(v.TEST_PAUSE);
|
|
322
|
+
}
|
|
323
|
+
continue() {
|
|
324
|
+
x.log("Continue Test"), this.status = E.PLAYING, this.runMode = D.NORMAL, y.dispatch(v.TEST_PLAY), this.currentActionCallback && this.currentAction && (x.log("Continue: Executing current action callback"), this.currentActionCallback(this.currentAction), this.currentActionCallback = void 0);
|
|
325
|
+
}
|
|
326
|
+
next() {
|
|
327
|
+
x.log("Continue Test to Next Step..."), this.status = E.PLAYING, this.runMode = D.STEPBYSTEP, y.dispatch(v.TEST_PLAY), this.currentActionCallback && this.currentAction && (x.log("Next: Executing current action callback"), this.currentActionCallback(this.currentAction), this.currentActionCallback = void 0);
|
|
328
|
+
}
|
|
329
|
+
stop() {
|
|
330
|
+
x.log("Stop Test"), this.status = E.STOPPED, this.currentActionCallback && this.currentAction && (x.log("Stop: Executing current action callback"), this.currentActionCallback(this.currentAction), this.currentActionCallback = void 0), y.dispatch(v.TEST_STOP);
|
|
331
|
+
}
|
|
332
|
+
retryAction() {
|
|
333
|
+
x.log("Retry current step"), this.status = E.PLAYING, y.dispatch(v.TEST_PLAY), this.currentActionCallback && this.currentAction && (this.currentAction.resetTries && (x.log("Retry: Resetting tries for current action"), this.currentAction.resetTries()), x.log("Retry: Executing current action callback"), this.currentActionCallback(this.currentAction), this.currentActionCallback = void 0);
|
|
334
|
+
}
|
|
335
|
+
skipAction() {
|
|
336
|
+
x.log("Skip current step"), this.status = E.PLAYING, this.currentActionCallback && this.currentAction && (this.currentAction.status = L.SKIPPED, x.log("Skip: Marked current action as SKIPPED"), R.notifyActionUpdated(this.currentAction), x.log("Skip: Executing current action callback"), this.currentActionCallback(this.currentAction), this.currentActionCallback = void 0);
|
|
337
|
+
}
|
|
338
|
+
saveCurrentAction(e, t) {
|
|
339
|
+
x.log("Save current action"), this.currentActionCallback = e, this.currentAction = t;
|
|
340
|
+
}
|
|
341
|
+
setDebug(e) {
|
|
342
|
+
x.setEnabled(e);
|
|
343
|
+
}
|
|
344
|
+
}, O, k = (e, t) => (O = new ie(e), ee(O.document), t?.forEach((e) => e()), O), A = !1;
|
|
345
|
+
async function ae(e) {
|
|
346
|
+
if (A) throw x.error("Not able to run test while other test is running."), Error("Not able to run test while other test is running.");
|
|
347
|
+
A = !0, O.status = E.PLAYING, O.runMode = D.NORMAL, x.groupCollapsed("Start Action: ", e.getDescription()), y.dispatch(v.TEST_STARTED, { action: e?.getJSON() });
|
|
348
|
+
try {
|
|
349
|
+
await e?.execute(), y.dispatch(v.TEST_PASSED, { id: e.name });
|
|
350
|
+
} catch (t) {
|
|
351
|
+
throw y.dispatch(v.TEST_FAILED, { id: e.name }), O.uiUtils.hideCheckElementContainer(), x.error(`🤖 Error running task ${e.getDescription()}. Reason: ${t.message}`), t;
|
|
352
|
+
} finally {
|
|
353
|
+
x.groupEnd(), A = !1, y.dispatch(v.TEST_END, { action: e?.getJSON() });
|
|
354
|
+
}
|
|
710
355
|
}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
throw new Error(`Text in element ${this.getElementName()} doesn't contain '${this.text}'`);
|
|
721
|
-
}
|
|
722
|
-
getDescription() {
|
|
723
|
-
return `Assert that ${this.getElementName()} contains '${this.text}'`;
|
|
724
|
-
}
|
|
725
|
-
getJSON() {
|
|
726
|
-
return {
|
|
727
|
-
...super.getJSON(),
|
|
728
|
-
type: "AssertContainsText",
|
|
729
|
-
value: this.text
|
|
730
|
-
};
|
|
731
|
-
}
|
|
356
|
+
var j = {
|
|
357
|
+
start: ae,
|
|
358
|
+
get running() {
|
|
359
|
+
return A;
|
|
360
|
+
}
|
|
361
|
+
}, M = [];
|
|
362
|
+
for (let e = 0; e < 256; ++e) M.push((e + 256).toString(16).slice(1));
|
|
363
|
+
function oe(e, t = 0) {
|
|
364
|
+
return (M[e[t + 0]] + M[e[t + 1]] + M[e[t + 2]] + M[e[t + 3]] + "-" + M[e[t + 4]] + M[e[t + 5]] + "-" + M[e[t + 6]] + M[e[t + 7]] + "-" + M[e[t + 8]] + M[e[t + 9]] + "-" + M[e[t + 10]] + M[e[t + 11]] + M[e[t + 12]] + M[e[t + 13]] + M[e[t + 14]] + M[e[t + 15]]).toLowerCase();
|
|
732
365
|
}
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
}
|
|
739
|
-
executeActionOnElement() {
|
|
740
|
-
if (!(this.element.value === this.value))
|
|
741
|
-
throw new Error(`Value in element ${this.getElementName()} is not '${this.value}'`);
|
|
742
|
-
}
|
|
743
|
-
getDescription() {
|
|
744
|
-
return `Assert that value in ${this.getElementName()} is '${this.value}'`;
|
|
745
|
-
}
|
|
746
|
-
getJSON() {
|
|
747
|
-
return {
|
|
748
|
-
...super.getJSON(),
|
|
749
|
-
type: "AssertValueIsAction",
|
|
750
|
-
value: this.value
|
|
751
|
-
};
|
|
752
|
-
}
|
|
366
|
+
//#endregion
|
|
367
|
+
//#region node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/rng.js
|
|
368
|
+
var se = new Uint8Array(16);
|
|
369
|
+
function ce() {
|
|
370
|
+
return crypto.getRandomValues(se);
|
|
753
371
|
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
executeActionOnElement() {
|
|
759
|
-
if (!!!this.element)
|
|
760
|
-
throw new Error(`Element ${this.getElementName()} doesn't exist`);
|
|
761
|
-
}
|
|
762
|
-
getDescription() {
|
|
763
|
-
return `Assert that ${this.getElementName()} exists`;
|
|
764
|
-
}
|
|
765
|
-
getJSON() {
|
|
766
|
-
return {
|
|
767
|
-
...super.getJSON(),
|
|
768
|
-
type: "AssertExistsAction"
|
|
769
|
-
};
|
|
770
|
-
}
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/v4.js
|
|
374
|
+
function N(e, t, n) {
|
|
375
|
+
return !t && !e && crypto.randomUUID ? crypto.randomUUID() : le(e, t, n);
|
|
771
376
|
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
executeActionOnElement() {
|
|
785
|
-
if (!!this.element)
|
|
786
|
-
throw new Error(`Element ${this.getElementName()} was not expected to exist`);
|
|
787
|
-
}
|
|
788
|
-
getDescription() {
|
|
789
|
-
return `Assert that ${this.getElementName()} doesn't exist`;
|
|
790
|
-
}
|
|
791
|
-
getJSON() {
|
|
792
|
-
return {
|
|
793
|
-
...super.getJSON(),
|
|
794
|
-
type: "AssertNotExistsAction"
|
|
795
|
-
};
|
|
796
|
-
}
|
|
377
|
+
function le(e, t, n) {
|
|
378
|
+
e ||= {};
|
|
379
|
+
let r = e.random ?? e.rng?.() ?? ce();
|
|
380
|
+
if (r.length < 16) throw Error("Random bytes length must be >= 16");
|
|
381
|
+
if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) {
|
|
382
|
+
if (n ||= 0, n < 0 || n + 16 > t.length) throw RangeError(`UUID byte range ${n}:${n + 15} is out of buffer bounds`);
|
|
383
|
+
for (let e = 0; e < 16; ++e) t[n + e] = r[e];
|
|
384
|
+
return t;
|
|
385
|
+
}
|
|
386
|
+
return oe(r);
|
|
797
387
|
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/dom/actions.ts
|
|
390
|
+
var P = null, F = async (e, t, n, r = 1e3, i = 0, a = 10, o = !1) => {
|
|
391
|
+
if (console.log("Automation Status: ", O.status), O.isPaused) return new Promise((s, c) => {
|
|
392
|
+
O.saveCurrentAction(async (e) => {
|
|
393
|
+
if (e.status == L.SKIPPED) return s(null);
|
|
394
|
+
try {
|
|
395
|
+
s(await F(e, t, n, r, i, a, o));
|
|
396
|
+
} catch (e) {
|
|
397
|
+
c(e);
|
|
398
|
+
}
|
|
399
|
+
}, e);
|
|
400
|
+
});
|
|
401
|
+
if (O.isStopped) throw Error("Test stopped manually");
|
|
402
|
+
if (console.groupCollapsed(`tries ${i}/${a}`), e && (e.updateTries(i), await R.notifyActionUpdated(e)), i === a) throw console.groupEnd(), Error(o ? `UI Element ${t.getElementName() || "UNKNOWN"} still present after 10 tries` : `UI Element ${t.getElementName() || "UNKNOWN"} not found after 10 tries`);
|
|
403
|
+
{
|
|
404
|
+
let s = t.selector(n, t.postProcess);
|
|
405
|
+
return console.groupEnd(), s ? o ? (await S(r), await F(e, t, n, r, ++i, a, o)) : (console.log("Element found = ", s), s) : o ? (console.log("Element removed."), P) : (await S(r), await F(e, t, n, r, ++i, a, o));
|
|
406
|
+
}
|
|
407
|
+
}, I = async (e, t, n = 1e3, r = 10, i = !1) => {
|
|
408
|
+
let a = t?.getElementName();
|
|
409
|
+
console.group("Looking for Element: " + a);
|
|
410
|
+
let o = null;
|
|
411
|
+
if (t.parent) try {
|
|
412
|
+
console.groupCollapsed("Look for Parent ", t.parent.getElementName()), o = await I(e, t.parent, n, r, i), console.groupEnd();
|
|
413
|
+
} catch (e) {
|
|
414
|
+
if (console.groupEnd(), i && e.message.includes("not found")) return console.log("Parent not found, so element was removed"), console.groupEnd(), P;
|
|
415
|
+
throw console.groupEnd(), e;
|
|
416
|
+
}
|
|
417
|
+
try {
|
|
418
|
+
console.log("Using parent element: ", o);
|
|
419
|
+
let a = await F(e, t, o, n, 0, r, i);
|
|
420
|
+
return console.groupEnd(), a;
|
|
421
|
+
} catch (e) {
|
|
422
|
+
if (i && e.message.includes("not found")) return console.log("Parent not found, so element was removed"), console.groupEnd(), P;
|
|
423
|
+
throw console.groupEnd(), e;
|
|
424
|
+
}
|
|
425
|
+
}, L = /* @__PURE__ */ function(e) {
|
|
426
|
+
return e.WAITING = "waiting", e.RUNNING = "running", e.STOPPED = "stopped", e.PAUSED = "paused", e.SUCCESS = "success", e.ERROR = "error", e.SKIPPED = "skipped", e;
|
|
427
|
+
}(L || {}), R = class e {
|
|
428
|
+
status;
|
|
429
|
+
error;
|
|
430
|
+
id;
|
|
431
|
+
context;
|
|
432
|
+
constructor() {
|
|
433
|
+
this.status = L.WAITING, this.error = "", this.id = N(), this.context = {
|
|
434
|
+
beforeHTML: "",
|
|
435
|
+
beforeInputValues: {},
|
|
436
|
+
afterInputValues: {},
|
|
437
|
+
afterHTML: "",
|
|
438
|
+
url: "",
|
|
439
|
+
startTimestamp: "",
|
|
440
|
+
endTimestamp: ""
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
getJSON() {
|
|
444
|
+
return {
|
|
445
|
+
id: this.id,
|
|
446
|
+
description: this.getDescription(),
|
|
447
|
+
context: this.context,
|
|
448
|
+
status: this.status,
|
|
449
|
+
error: this.error
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
reset() {
|
|
453
|
+
this.status = L.WAITING, this.error = "", this.resetAction();
|
|
454
|
+
}
|
|
455
|
+
getInputValuesFromPage() {
|
|
456
|
+
let e = {};
|
|
457
|
+
return O.document.querySelectorAll("input").forEach((t, n) => {
|
|
458
|
+
let r = `value-id-${n}`;
|
|
459
|
+
t.setAttribute("input-id", r), e[r] = t.value;
|
|
460
|
+
}), e;
|
|
461
|
+
}
|
|
462
|
+
async execute() {
|
|
463
|
+
try {
|
|
464
|
+
this.status = L.RUNNING, this.context.beforeInputValues = this.getInputValuesFromPage(), this.context.beforeHTML = O.document.body.innerHTML, await e.notifyActionUpdated(this), console.log("Action: ", this.getDescription()), await this.executeAction(), this.status = L.SUCCESS, this.error = "", O.isStepByStepMode && O.pause();
|
|
465
|
+
} catch (e) {
|
|
466
|
+
if (this.status = L.ERROR, this.error = e.message, e.message == "Test stopped manually") throw Error("Error in Action " + this.getDescription() + ". Message: " + e.message);
|
|
467
|
+
this.status = L.PAUSED, O.pause();
|
|
468
|
+
} finally {
|
|
469
|
+
this.context.afterInputValues = this.getInputValuesFromPage(), this.context.afterHTML = O.document.body.innerHTML, await e.notifyActionUpdated(this);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
static async notifyActionUpdated(e) {
|
|
473
|
+
y.dispatch(v.ACTION_UPDATE, { action: e.getJSON() });
|
|
474
|
+
}
|
|
475
|
+
}, z = class extends R {
|
|
476
|
+
name;
|
|
477
|
+
stepsFn;
|
|
478
|
+
steps;
|
|
479
|
+
params;
|
|
480
|
+
index;
|
|
481
|
+
constructor(e, t) {
|
|
482
|
+
super(), this.name = e, this.stepsFn = t, this.steps = [], this.index = 0;
|
|
483
|
+
}
|
|
484
|
+
getDescription() {
|
|
485
|
+
return this.name;
|
|
486
|
+
}
|
|
487
|
+
compileSteps() {
|
|
488
|
+
super.reset(), this.stepsFn(this.params);
|
|
489
|
+
}
|
|
490
|
+
stepsToJSON() {
|
|
491
|
+
return this.steps.reduce((e, t) => (e.push(t.getJSON()), e), []);
|
|
492
|
+
}
|
|
493
|
+
getJSON() {
|
|
494
|
+
return {
|
|
495
|
+
...super.getJSON(),
|
|
496
|
+
type: "Action",
|
|
497
|
+
params: this.params,
|
|
498
|
+
steps: this.stepsToJSON()
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
resetAction() {
|
|
502
|
+
this.steps.length = 0, this.index = 0;
|
|
503
|
+
}
|
|
504
|
+
async continue() {
|
|
505
|
+
if (O.isPaused) return new Promise((e, t) => {
|
|
506
|
+
O.saveCurrentAction(async (n) => {
|
|
507
|
+
if (n.status == L.SKIPPED) return e();
|
|
508
|
+
try {
|
|
509
|
+
await n.continue(), e();
|
|
510
|
+
} catch (e) {
|
|
511
|
+
t(e);
|
|
512
|
+
}
|
|
513
|
+
}, this);
|
|
514
|
+
});
|
|
515
|
+
if (O.isStopped) throw Error("Test stopped manually");
|
|
516
|
+
if (this.index < this.steps.length) {
|
|
517
|
+
let e = this.steps[this.index];
|
|
518
|
+
try {
|
|
519
|
+
if (await S(O.speed), await e.execute(), !O.isPaused) this.index++, await this.continue();
|
|
520
|
+
else return new Promise((t, n) => {
|
|
521
|
+
O.saveCurrentAction(async (r) => {
|
|
522
|
+
if (r.status == L.SKIPPED) return this.index++, await R.notifyActionUpdated(e), await this.continue(), t();
|
|
523
|
+
try {
|
|
524
|
+
await r.continue(), t();
|
|
525
|
+
} catch (e) {
|
|
526
|
+
n(e);
|
|
527
|
+
}
|
|
528
|
+
}, e);
|
|
529
|
+
});
|
|
530
|
+
} catch (e) {
|
|
531
|
+
throw e;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
async executeAction() {
|
|
536
|
+
this.index = 0, await this.continue();
|
|
537
|
+
}
|
|
538
|
+
setParams(e) {
|
|
539
|
+
this.params = e;
|
|
540
|
+
}
|
|
541
|
+
addStep(e) {
|
|
542
|
+
this.steps.push(e);
|
|
543
|
+
}
|
|
544
|
+
}, B = class e extends R {
|
|
545
|
+
uiElement;
|
|
546
|
+
element;
|
|
547
|
+
tries;
|
|
548
|
+
constructor(e) {
|
|
549
|
+
super(), this.uiElement = e, this.element = null, this.tries = 0;
|
|
550
|
+
}
|
|
551
|
+
getElementName() {
|
|
552
|
+
return this.uiElement?.getElementName();
|
|
553
|
+
}
|
|
554
|
+
updateTries(e) {
|
|
555
|
+
this.tries = e;
|
|
556
|
+
}
|
|
557
|
+
resetTries() {
|
|
558
|
+
this.tries = 0;
|
|
559
|
+
}
|
|
560
|
+
getJSON() {
|
|
561
|
+
return {
|
|
562
|
+
id: this.id,
|
|
563
|
+
element: this.getElementName(),
|
|
564
|
+
description: this.getDescription(),
|
|
565
|
+
status: this.status,
|
|
566
|
+
error: this.error,
|
|
567
|
+
context: this.context,
|
|
568
|
+
tries: this.tries
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
static waitForElement(t, n, r = 1e3, i = 10, a = !1) {
|
|
572
|
+
let o = n.getElementName();
|
|
573
|
+
return new Promise(async (s, c) => {
|
|
574
|
+
let l = async (e, r = 1e3, a = 0, s = !1) => {
|
|
575
|
+
if (console.groupCollapsed(`tries ${a}/${i}`), t.updateTries(a), await R.notifyActionUpdated(t), a === i) throw console.groupEnd(), Error(s ? `UI Element ${o || "UNKNOWN"} still present after 10 tries` : `UI Element ${o || "UNKNOWN"} not found after 10 tries`);
|
|
576
|
+
{
|
|
577
|
+
let t = n.selector(e, n.postProcess);
|
|
578
|
+
return console.groupEnd(), t ? s ? (await S(r), await l(e, r, ++a, s)) : (console.log("Element found = ", t), t) : s ? (console.log("Element removed."), null) : (await S(r), await l(e, r, ++a, s));
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
console.group("[Action On Element] Looking for Element: " + o);
|
|
582
|
+
let u = null, d = !0;
|
|
583
|
+
if (n.parent) {
|
|
584
|
+
console.groupCollapsed("Look for Parent ", n.parent.getElementName());
|
|
585
|
+
try {
|
|
586
|
+
u = await e.waitForElement(t, n.parent, r, i, a);
|
|
587
|
+
} catch {
|
|
588
|
+
d = !1;
|
|
589
|
+
} finally {
|
|
590
|
+
console.groupEnd();
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
if (d) {
|
|
594
|
+
console.log("using parent element: ", u);
|
|
595
|
+
try {
|
|
596
|
+
let e = await l(u, r, 0, a);
|
|
597
|
+
console.groupEnd(), s(e);
|
|
598
|
+
} catch (e) {
|
|
599
|
+
console.groupEnd(), c(Error(e.message));
|
|
600
|
+
}
|
|
601
|
+
} else console.groupEnd(), c(/* @__PURE__ */ Error(`Parent ${n.parent?.getElementName()} of UI Element ${n.name || "UNKNOWN"} not found`));
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
async executeAction() {
|
|
605
|
+
try {
|
|
606
|
+
this.element = await I(this, this.uiElement), this.element?.setAttribute("test-id", this.getElementName()), await O.uiUtils.checkElement(this.element, this.getElementName()), this.executeActionOnElement(), await O.uiUtils.hideCheckElementContainer();
|
|
607
|
+
} catch (e) {
|
|
608
|
+
throw Error(e.message);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
resetAction() {
|
|
612
|
+
this.element = null, this.resetTries();
|
|
613
|
+
}
|
|
614
|
+
}, ue = class extends B {
|
|
615
|
+
constructor(e) {
|
|
616
|
+
super(e);
|
|
617
|
+
}
|
|
618
|
+
executeActionOnElement() {
|
|
619
|
+
return this.element?.click();
|
|
620
|
+
}
|
|
621
|
+
getDescription() {
|
|
622
|
+
return "Click in " + this.getElementName();
|
|
623
|
+
}
|
|
624
|
+
getJSON() {
|
|
625
|
+
return {
|
|
626
|
+
...super.getJSON(),
|
|
627
|
+
type: "Click"
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
}, de = class extends B {
|
|
631
|
+
text;
|
|
632
|
+
constructor(e, t) {
|
|
633
|
+
super(e), this.text = t;
|
|
634
|
+
}
|
|
635
|
+
executeActionOnElement() {
|
|
636
|
+
if (this.element?.innerText !== this.text) throw Error(`Text in element ${this.getElementName()} is not '${this.text}'`);
|
|
637
|
+
}
|
|
638
|
+
getDescription() {
|
|
639
|
+
return `Assert that text in ${this.getElementName()} is '${this.text}'`;
|
|
640
|
+
}
|
|
641
|
+
getJSON() {
|
|
642
|
+
return {
|
|
643
|
+
...super.getJSON(),
|
|
644
|
+
type: "AssertTextIsAction",
|
|
645
|
+
value: this.text
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
}, fe = class extends B {
|
|
649
|
+
text;
|
|
650
|
+
constructor(e, t) {
|
|
651
|
+
super(e), this.text = t;
|
|
652
|
+
}
|
|
653
|
+
executeActionOnElement() {
|
|
654
|
+
if (!this.element?.innerText.includes(this.text)) throw Error(`Text in element ${this.getElementName()} doesn't contain '${this.text}'`);
|
|
655
|
+
}
|
|
656
|
+
getDescription() {
|
|
657
|
+
return `Assert that ${this.getElementName()} contains '${this.text}'`;
|
|
658
|
+
}
|
|
659
|
+
getJSON() {
|
|
660
|
+
return {
|
|
661
|
+
...super.getJSON(),
|
|
662
|
+
type: "AssertContainsText",
|
|
663
|
+
value: this.text
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
}, pe = class extends B {
|
|
667
|
+
value;
|
|
668
|
+
constructor(e, t) {
|
|
669
|
+
super(e), this.value = t;
|
|
670
|
+
}
|
|
671
|
+
executeActionOnElement() {
|
|
672
|
+
if (this.element.value !== this.value) throw Error(`Value in element ${this.getElementName()} is not '${this.value}'`);
|
|
673
|
+
}
|
|
674
|
+
getDescription() {
|
|
675
|
+
return `Assert that value in ${this.getElementName()} is '${this.value}'`;
|
|
676
|
+
}
|
|
677
|
+
getJSON() {
|
|
678
|
+
return {
|
|
679
|
+
...super.getJSON(),
|
|
680
|
+
type: "AssertValueIsAction",
|
|
681
|
+
value: this.value
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
}, me = class extends B {
|
|
685
|
+
constructor(e) {
|
|
686
|
+
super(e);
|
|
687
|
+
}
|
|
688
|
+
executeActionOnElement() {
|
|
689
|
+
if (!this.element) throw Error(`Element ${this.getElementName()} doesn't exist`);
|
|
690
|
+
}
|
|
691
|
+
getDescription() {
|
|
692
|
+
return `Assert that ${this.getElementName()} exists`;
|
|
693
|
+
}
|
|
694
|
+
getJSON() {
|
|
695
|
+
return {
|
|
696
|
+
...super.getJSON(),
|
|
697
|
+
type: "AssertExistsAction"
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
}, he = class extends B {
|
|
701
|
+
constructor(e) {
|
|
702
|
+
super(e);
|
|
703
|
+
}
|
|
704
|
+
async executeAction() {
|
|
705
|
+
try {
|
|
706
|
+
this.element = await I(this, this.uiElement, 1e3, 5, !0), this.element?.setAttribute("test-id", this.getElementName()), await O.uiUtils.checkElement(this.element, this.getElementName()), this.executeActionOnElement(), await O.uiUtils.hideCheckElementContainer();
|
|
707
|
+
} catch (e) {
|
|
708
|
+
throw Error(e.message);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
executeActionOnElement() {
|
|
712
|
+
if (this.element) throw Error(`Element ${this.getElementName()} was not expected to exist`);
|
|
713
|
+
}
|
|
714
|
+
getDescription() {
|
|
715
|
+
return `Assert that ${this.getElementName()} doesn't exist`;
|
|
716
|
+
}
|
|
717
|
+
getJSON() {
|
|
718
|
+
return {
|
|
719
|
+
...super.getJSON(),
|
|
720
|
+
type: "AssertNotExistsAction"
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
}, ge = class extends B {
|
|
724
|
+
value;
|
|
725
|
+
constructor(e, t) {
|
|
726
|
+
super(e), this.value = t;
|
|
727
|
+
}
|
|
728
|
+
executeActionOnElement() {
|
|
729
|
+
let e = this.element;
|
|
730
|
+
if (this.element?.tagName !== "INPUT" && this.element?.tagName !== "SELECT" && this.element?.tagName !== "TEXTAREA" && (e = this.element?.querySelectorAll("input")[0], !e)) throw Error("Input element not found. Not able to type value in element " + this.getElementName());
|
|
731
|
+
e.value = this.value, e.dispatchEvent(new Event("change"));
|
|
732
|
+
}
|
|
733
|
+
getDescription() {
|
|
734
|
+
return `Select value '${this.value}' in ${this.getElementName()}`;
|
|
735
|
+
}
|
|
736
|
+
getJSON() {
|
|
737
|
+
return {
|
|
738
|
+
...super.getJSON(),
|
|
739
|
+
type: "Select",
|
|
740
|
+
value: this.value
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
}, V = class extends B {
|
|
744
|
+
value;
|
|
745
|
+
constructor(e, t) {
|
|
746
|
+
super(e), this.value = t;
|
|
747
|
+
}
|
|
748
|
+
executeActionOnElement() {
|
|
749
|
+
let e = this.element;
|
|
750
|
+
if (this.element?.tagName !== "INPUT" && this.element?.tagName !== "SELECT" && this.element?.tagName !== "TEXTAREA" && (e = this.element?.querySelectorAll("input")[0], !e)) throw Error("Input element not found. Not able to type value in element " + this.getElementName());
|
|
751
|
+
e.value = this.value, e.dispatchEvent(new Event("change")), e.dispatchEvent(new Event("keyup", { bubbles: !0 })), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
752
|
+
}
|
|
753
|
+
getDescription() {
|
|
754
|
+
return `Type value '${this.value}' in ${this.getElementName()}`;
|
|
755
|
+
}
|
|
756
|
+
getJSON() {
|
|
757
|
+
return {
|
|
758
|
+
...super.getJSON(),
|
|
759
|
+
type: "Type",
|
|
760
|
+
value: this.value
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
}, _e = class extends B {
|
|
764
|
+
value;
|
|
765
|
+
constructor(e, t) {
|
|
766
|
+
super(e), this.value = t;
|
|
767
|
+
}
|
|
768
|
+
executeActionOnElement() {
|
|
769
|
+
let e = this.element;
|
|
770
|
+
if (this.element?.tagName !== "INPUT" && this.element?.tagName !== "SELECT" && this.element?.tagName !== "TEXTAREA" && (e = this.element?.querySelectorAll("input")[0], !e)) throw Error("Input element not found. Not able to type value in element " + this.getElementName());
|
|
771
|
+
e.value = this.value, e.dispatchEvent(new Event("change")), e.dispatchEvent(new Event("keyup", { bubbles: !0 })), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
772
|
+
}
|
|
773
|
+
getDescription() {
|
|
774
|
+
return `Type a password in ${this.getElementName()}`;
|
|
775
|
+
}
|
|
776
|
+
getJSON() {
|
|
777
|
+
return {
|
|
778
|
+
...super.getJSON(),
|
|
779
|
+
type: "TypePassword",
|
|
780
|
+
value: this.value
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
}, ve = class extends B {
|
|
784
|
+
constructor(e) {
|
|
785
|
+
super(e);
|
|
786
|
+
}
|
|
787
|
+
executeActionOnElement() {
|
|
788
|
+
this.element?.dispatchEvent(new KeyboardEvent("keydown", {
|
|
789
|
+
altKey: !1,
|
|
790
|
+
code: "Escape",
|
|
791
|
+
ctrlKey: !1,
|
|
792
|
+
isComposing: !1,
|
|
793
|
+
key: "Escape",
|
|
794
|
+
location: 0,
|
|
795
|
+
metaKey: !1,
|
|
796
|
+
repeat: !1,
|
|
797
|
+
shiftKey: !1,
|
|
798
|
+
which: 27,
|
|
799
|
+
charCode: 0,
|
|
800
|
+
keyCode: 27
|
|
801
|
+
}));
|
|
802
|
+
}
|
|
803
|
+
getDescription() {
|
|
804
|
+
return `Press Esc key in ${this.getElementName()}`;
|
|
805
|
+
}
|
|
806
|
+
getJSON() {
|
|
807
|
+
return {
|
|
808
|
+
...super.getJSON(),
|
|
809
|
+
type: "PressEscKey"
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
}, ye = class extends B {
|
|
813
|
+
constructor(e) {
|
|
814
|
+
super(e);
|
|
815
|
+
}
|
|
816
|
+
executeActionOnElement() {
|
|
817
|
+
this.element?.dispatchEvent(new KeyboardEvent("keyup", {
|
|
818
|
+
altKey: !1,
|
|
819
|
+
code: "Down",
|
|
820
|
+
ctrlKey: !1,
|
|
821
|
+
isComposing: !1,
|
|
822
|
+
key: "Down",
|
|
823
|
+
location: 0,
|
|
824
|
+
metaKey: !1,
|
|
825
|
+
repeat: !1,
|
|
826
|
+
shiftKey: !1,
|
|
827
|
+
which: 40,
|
|
828
|
+
charCode: 0,
|
|
829
|
+
keyCode: 40
|
|
830
|
+
}));
|
|
831
|
+
}
|
|
832
|
+
getDescription() {
|
|
833
|
+
return `Press Down key in ${this.getElementName()}`;
|
|
834
|
+
}
|
|
835
|
+
getJSON() {
|
|
836
|
+
return {
|
|
837
|
+
...super.getJSON(),
|
|
838
|
+
type: "PressDownKey"
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
}, be = class extends B {
|
|
842
|
+
constructor(e) {
|
|
843
|
+
super(e);
|
|
844
|
+
}
|
|
845
|
+
executeActionOnElement() {
|
|
846
|
+
this.element?.dispatchEvent(new KeyboardEvent("keydown", {
|
|
847
|
+
altKey: !1,
|
|
848
|
+
code: "Tab",
|
|
849
|
+
ctrlKey: !1,
|
|
850
|
+
isComposing: !1,
|
|
851
|
+
key: "Tab",
|
|
852
|
+
location: 0,
|
|
853
|
+
metaKey: !1,
|
|
854
|
+
repeat: !1,
|
|
855
|
+
shiftKey: !1,
|
|
856
|
+
which: 9,
|
|
857
|
+
charCode: 0,
|
|
858
|
+
keyCode: 9
|
|
859
|
+
}));
|
|
860
|
+
}
|
|
861
|
+
getDescription() {
|
|
862
|
+
return `Press Tab key in ${this.getElementName()}`;
|
|
863
|
+
}
|
|
864
|
+
getJSON() {
|
|
865
|
+
return {
|
|
866
|
+
...super.getJSON(),
|
|
867
|
+
type: "PressTabKey"
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
}, xe = class extends B {
|
|
871
|
+
constructor(e) {
|
|
872
|
+
super(e);
|
|
873
|
+
}
|
|
874
|
+
executeActionOnElement() {
|
|
875
|
+
this.element?.dispatchEvent(new KeyboardEvent("keydown", {
|
|
876
|
+
altKey: !1,
|
|
877
|
+
code: "Enter",
|
|
878
|
+
ctrlKey: !1,
|
|
879
|
+
isComposing: !1,
|
|
880
|
+
key: "Enter",
|
|
881
|
+
location: 0,
|
|
882
|
+
metaKey: !1,
|
|
883
|
+
repeat: !1,
|
|
884
|
+
shiftKey: !1,
|
|
885
|
+
which: 13,
|
|
886
|
+
charCode: 0,
|
|
887
|
+
keyCode: 13
|
|
888
|
+
}));
|
|
889
|
+
}
|
|
890
|
+
getDescription() {
|
|
891
|
+
return `Press Enter key in ${this.getElementName()}`;
|
|
892
|
+
}
|
|
893
|
+
getJSON() {
|
|
894
|
+
return {
|
|
895
|
+
...super.getJSON(),
|
|
896
|
+
type: "PressEnterKey"
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
}, H = /* @__PURE__ */ function(e) {
|
|
900
|
+
return e.ESCAPE = "Escape", e.ENTER = "Enter", e.TAB = "Tab", e.ARROW_DOWN = "ArrowDown", e.ARROW_UP = "ArrowUp", e.ARROW_LEFT = "ArrowLeft", e.ARROW_RIGHT = "ArrowRight", e.BACKSPACE = "Backspace", e.DELETE = "Delete", e.SHIFT = "Shift", e.CONTROL = "Control", e.ALT = "Alt", e.META = "Meta", e;
|
|
901
|
+
}(H || {}), U = {
|
|
902
|
+
[H.ESCAPE]: 27,
|
|
903
|
+
[H.ENTER]: 13,
|
|
904
|
+
[H.TAB]: 9,
|
|
905
|
+
[H.ARROW_DOWN]: 40,
|
|
906
|
+
[H.ARROW_UP]: 38,
|
|
907
|
+
[H.ARROW_LEFT]: 37,
|
|
908
|
+
[H.ARROW_RIGHT]: 39,
|
|
909
|
+
[H.BACKSPACE]: 8,
|
|
910
|
+
[H.DELETE]: 46,
|
|
911
|
+
[H.SHIFT]: 16,
|
|
912
|
+
[H.CONTROL]: 17,
|
|
913
|
+
[H.ALT]: 18,
|
|
914
|
+
[H.META]: 91
|
|
915
|
+
}, Se = class extends B {
|
|
916
|
+
key;
|
|
917
|
+
constructor(e, t) {
|
|
918
|
+
super(e), this.key = t;
|
|
919
|
+
}
|
|
920
|
+
executeActionOnElement() {
|
|
921
|
+
this.element?.dispatchEvent(new KeyboardEvent("keydown", {
|
|
922
|
+
key: this.key,
|
|
923
|
+
code: this.key,
|
|
924
|
+
keyCode: U[this.key],
|
|
925
|
+
charCode: 0,
|
|
926
|
+
which: U[this.key],
|
|
927
|
+
altKey: !1,
|
|
928
|
+
ctrlKey: !1,
|
|
929
|
+
metaKey: !1,
|
|
930
|
+
shiftKey: !1,
|
|
931
|
+
isComposing: !1,
|
|
932
|
+
location: 0,
|
|
933
|
+
repeat: !1
|
|
934
|
+
}));
|
|
935
|
+
}
|
|
936
|
+
getDescription() {
|
|
937
|
+
return `Press ${this.key} key in ${this.getElementName()}`;
|
|
938
|
+
}
|
|
939
|
+
getJSON() {
|
|
940
|
+
return {
|
|
941
|
+
...super.getJSON(),
|
|
942
|
+
type: "PressKey",
|
|
943
|
+
key: this.key
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
}, Ce = class extends B {
|
|
947
|
+
file;
|
|
948
|
+
constructor(e, t) {
|
|
949
|
+
super(e), this.file = t;
|
|
950
|
+
}
|
|
951
|
+
executeActionOnElement() {
|
|
952
|
+
let e = this.element, t = new DataTransfer();
|
|
953
|
+
t.items.add(this.file), e.files = t.files, e.dispatchEvent(new Event("change"));
|
|
954
|
+
function n(e) {
|
|
955
|
+
return e?.parentElement ? e.parentElement?.tagName.toLowerCase() === "form" ? e.parentElement : n(e.parentElement) : null;
|
|
956
|
+
}
|
|
957
|
+
let r = n(e);
|
|
958
|
+
r && r.dispatchEvent(new Event("change"));
|
|
959
|
+
}
|
|
960
|
+
getDescription() {
|
|
961
|
+
return `Upload file in ${this.getElementName()}`;
|
|
962
|
+
}
|
|
963
|
+
getJSON() {
|
|
964
|
+
return {
|
|
965
|
+
...super.getJSON(),
|
|
966
|
+
type: "UploadFile"
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
}, we = class extends B {
|
|
970
|
+
memorySlotName;
|
|
971
|
+
constructor(e, t) {
|
|
972
|
+
super(e), this.memorySlotName = t;
|
|
973
|
+
}
|
|
974
|
+
executeActionOnElement() {
|
|
975
|
+
let e = this.element;
|
|
976
|
+
if (this.element?.tagName !== "INPUT" && this.element?.tagName !== "SELECT" && this.element?.tagName !== "TEXTAREA" && (e = this.element?.querySelectorAll("input")[0], !e)) throw Error("Input element not found. Not able to save value from element " + this.getElementName());
|
|
977
|
+
y.dispatch(v.SAVE_VALUE, {
|
|
978
|
+
memorySlotName: this.memorySlotName,
|
|
979
|
+
value: e.value
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
getDescription() {
|
|
983
|
+
return `Save value of ${this.getElementName()} in ${this.memorySlotName}`;
|
|
984
|
+
}
|
|
985
|
+
getJSON() {
|
|
986
|
+
return {
|
|
987
|
+
...super.getJSON(),
|
|
988
|
+
type: "SaveValue",
|
|
989
|
+
memorySlotName: this.memorySlotName
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
}, Te = class extends R {
|
|
993
|
+
miliseconds;
|
|
994
|
+
constructor(e) {
|
|
995
|
+
super(), this.miliseconds = e;
|
|
996
|
+
}
|
|
997
|
+
getDescription() {
|
|
998
|
+
return "Wait " + this.miliseconds + " miliseconds";
|
|
999
|
+
}
|
|
1000
|
+
getJSON() {
|
|
1001
|
+
return {
|
|
1002
|
+
...super.getJSON(),
|
|
1003
|
+
type: "Wait"
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
async executeAction() {
|
|
1007
|
+
await S(this.miliseconds);
|
|
1008
|
+
}
|
|
1009
|
+
resetAction() {}
|
|
1010
|
+
}, Ee = class extends R {
|
|
1011
|
+
uiElement;
|
|
1012
|
+
tries;
|
|
1013
|
+
constructor(e) {
|
|
1014
|
+
super(), this.uiElement = e, this.tries = 0;
|
|
1015
|
+
}
|
|
1016
|
+
updateTries(e) {
|
|
1017
|
+
this.tries = e;
|
|
1018
|
+
}
|
|
1019
|
+
resetAction() {
|
|
1020
|
+
this.tries = 0;
|
|
1021
|
+
}
|
|
1022
|
+
getElementName() {
|
|
1023
|
+
return this.uiElement?.getElementName();
|
|
1024
|
+
}
|
|
1025
|
+
async executeAction() {
|
|
1026
|
+
await I(this, this.uiElement, 1e3, 10, !0);
|
|
1027
|
+
}
|
|
1028
|
+
getDescription() {
|
|
1029
|
+
return "Wait until " + this.getElementName() + " is removed";
|
|
1030
|
+
}
|
|
1031
|
+
getJSON() {
|
|
1032
|
+
return {
|
|
1033
|
+
...super.getJSON(),
|
|
1034
|
+
type: "WaitUntilElementRemoved"
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
}, De = class extends R {
|
|
1038
|
+
constructor() {
|
|
1039
|
+
super();
|
|
1040
|
+
}
|
|
1041
|
+
getDescription() {
|
|
1042
|
+
return "Paused";
|
|
1043
|
+
}
|
|
1044
|
+
getJSON() {
|
|
1045
|
+
return {
|
|
1046
|
+
...super.getJSON(),
|
|
1047
|
+
type: "Pause"
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
async executeAction() {
|
|
1051
|
+
await O.pause();
|
|
1052
|
+
}
|
|
1053
|
+
resetAction() {}
|
|
1054
|
+
}, Oe = class extends R {
|
|
1055
|
+
description;
|
|
1056
|
+
constructor(e) {
|
|
1057
|
+
super(), this.description = e;
|
|
1058
|
+
}
|
|
1059
|
+
getDescription() {
|
|
1060
|
+
return "Manual Step: " + this.description;
|
|
1061
|
+
}
|
|
1062
|
+
getJSON() {
|
|
1063
|
+
return {
|
|
1064
|
+
...super.getJSON(),
|
|
1065
|
+
type: "ManualStep"
|
|
1066
|
+
};
|
|
1067
|
+
}
|
|
1068
|
+
async executeAction() {
|
|
1069
|
+
return await O.uiUtils.showAlert("Waiting manual step..."), new Promise((e, t) => {
|
|
1070
|
+
y.on(v.USER_ACCEPT, async () => (await O.uiUtils.hideAlert(), e(!0))), y.on(v.USER_REJECT, async () => (await O.uiUtils.hideAlert(), t()));
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
resetAction() {}
|
|
1074
|
+
}, ke = class extends R {
|
|
1075
|
+
constructor() {
|
|
1076
|
+
super();
|
|
1077
|
+
}
|
|
1078
|
+
getDescription() {
|
|
1079
|
+
return "Reload page";
|
|
1080
|
+
}
|
|
1081
|
+
getJSON() {
|
|
1082
|
+
return {
|
|
1083
|
+
...super.getJSON(),
|
|
1084
|
+
type: "ReloadPage"
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
async executeAction() {
|
|
1088
|
+
await location.reload();
|
|
1089
|
+
}
|
|
1090
|
+
resetAction() {}
|
|
1091
|
+
}, W, G, K = {
|
|
1092
|
+
init: (e) => {
|
|
1093
|
+
W = e, G = !0, x.groupCollapsed("Compile: " + e.getDescription()), e.compileSteps(), G = !1, x.log("Compilation finished"), x.groupEnd();
|
|
1094
|
+
},
|
|
1095
|
+
addAction: (e) => {
|
|
1096
|
+
x.log("Add action: ", e.getDescription()), W.addStep(e);
|
|
1097
|
+
},
|
|
1098
|
+
compileAction: (e) => {
|
|
1099
|
+
let t = W;
|
|
1100
|
+
W = e, e.compileSteps(), W = t;
|
|
1101
|
+
},
|
|
1102
|
+
getCurrentAction: () => W,
|
|
1103
|
+
getIsCompiling: () => G
|
|
1104
|
+
}, q = {}, Ae = (e) => {
|
|
1105
|
+
if (q[e]) q[e]();
|
|
1106
|
+
else throw console.log("Available Tests:", Object.keys(q)), Error(`Test with id ${e} not found.`);
|
|
1107
|
+
}, je = (e, t) => {
|
|
1108
|
+
console.log(`Registering Test: ${e}...`);
|
|
1109
|
+
let n = new z(e, t);
|
|
1110
|
+
K.init(n), console.log(`Compiled Test: ${e}`), y.dispatch(v.REGISTER_TEST, {
|
|
1111
|
+
id: e,
|
|
1112
|
+
action: n.getJSON()
|
|
1113
|
+
}), console.log(`Registered Test: ${e} in TestsMap`), q[e] = () => {
|
|
1114
|
+
j.start(n);
|
|
1115
|
+
};
|
|
1246
1116
|
};
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
}), console.log("[tomation] Ready ✓");
|
|
1330
|
-
} catch (l) {
|
|
1331
|
-
console.error("[tomation] Initialization failed:", l);
|
|
1332
|
-
}
|
|
1117
|
+
//#endregion
|
|
1118
|
+
//#region src/tomation.ts
|
|
1119
|
+
function J(e) {
|
|
1120
|
+
let { matches: t, tests: n = [], speed: r = "NORMAL", debug: i = !1 } = e, a = N();
|
|
1121
|
+
if (console.log(`[tomation] Initializing on URL: ${document.location.href} with session ID: ${a}`), window.postMessage({
|
|
1122
|
+
message: "injectedScript-to-contentScript",
|
|
1123
|
+
sender: "tomation",
|
|
1124
|
+
payload: {
|
|
1125
|
+
cmd: v.SESSION_INIT,
|
|
1126
|
+
params: { sessionId: a }
|
|
1127
|
+
}
|
|
1128
|
+
}), !(typeof t == "string" ? document.location.href.includes(t) : document.location.href.match(t))) {
|
|
1129
|
+
console.log(`[tomation] URL "${document.location.href}" does not match "${t}"`), window.postMessage({
|
|
1130
|
+
message: "injectedScript-to-contentScript",
|
|
1131
|
+
sender: "tomation",
|
|
1132
|
+
payload: {
|
|
1133
|
+
cmd: v.URL_MISMATCH,
|
|
1134
|
+
params: {
|
|
1135
|
+
sessionId: a,
|
|
1136
|
+
matches: t,
|
|
1137
|
+
url: document.location.href
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
});
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
try {
|
|
1144
|
+
console.log("[tomation] Setting up messaging bridge with extension..."), Object.values(v).forEach((e) => {
|
|
1145
|
+
console.log(`[tomation] Setting up listener for event "${e}"`), y.on(e, (t) => {
|
|
1146
|
+
let n = {
|
|
1147
|
+
cmd: e,
|
|
1148
|
+
params: {
|
|
1149
|
+
...t,
|
|
1150
|
+
sessionId: a
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
console.log(`[tomation] Dispatching event "${e}" to extension: `, n), window.postMessage({
|
|
1154
|
+
message: "injectedScript-to-contentScript",
|
|
1155
|
+
sender: "tomation",
|
|
1156
|
+
payload: n
|
|
1157
|
+
});
|
|
1158
|
+
});
|
|
1159
|
+
}), window.addEventListener("message", (e) => {
|
|
1160
|
+
try {
|
|
1161
|
+
console.log("[tomation] Received message from extension:", e.data);
|
|
1162
|
+
let { message: t, sender: r, payload: i } = e.data || {}, { cmd: a, params: o } = i || {};
|
|
1163
|
+
if (r !== "web-extension") return;
|
|
1164
|
+
if (t === "contentScript-to-injectedScript") {
|
|
1165
|
+
let e = {
|
|
1166
|
+
"run-test-request": () => Ae(o?.testId),
|
|
1167
|
+
"reload-tests-request": () => k(window, n || []),
|
|
1168
|
+
"pause-test-request": () => O.pause(),
|
|
1169
|
+
"stop-test-request": () => O.stop(),
|
|
1170
|
+
"continue-test-request": () => O.continue(),
|
|
1171
|
+
"next-step-request": () => O.next(),
|
|
1172
|
+
"retry-action-request": () => O.retryAction(),
|
|
1173
|
+
"skip-action-request": () => O.skipAction(),
|
|
1174
|
+
"user-accept-request": () => y.dispatch(v.USER_ACCEPT),
|
|
1175
|
+
"user-reject-request": () => y.dispatch(v.USER_REJECT)
|
|
1176
|
+
}[a];
|
|
1177
|
+
e ? (console.log(`[tomation] Executing command "${a}" from extension`), e()) : console.warn(`[tomation] Unknown command "${a}" from extension`);
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
} catch (e) {
|
|
1181
|
+
console.error("[tomation] Error handling message from extension:", e);
|
|
1182
|
+
}
|
|
1183
|
+
}), k(window, n), O.setDebug(i), O.speed = T[r], window.postMessage({
|
|
1184
|
+
message: "injectedScript-to-contentScript",
|
|
1185
|
+
sender: "tomation",
|
|
1186
|
+
payload: {
|
|
1187
|
+
cmd: v.SESSION_CONNECTED,
|
|
1188
|
+
params: {
|
|
1189
|
+
speed: O.speed,
|
|
1190
|
+
sessionId: a
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
}), console.log("[tomation] Ready ✓");
|
|
1194
|
+
} catch (e) {
|
|
1195
|
+
console.error("[tomation] Initialization failed:", e);
|
|
1196
|
+
}
|
|
1333
1197
|
}
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
},
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
},
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
}),
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
}),
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
}),
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
}
|
|
1394
|
-
}), Nt = (e) => ({
|
|
1395
|
-
in: (t) => {
|
|
1396
|
-
h.addAction(new Re(t, e));
|
|
1397
|
-
}
|
|
1398
|
-
}), vt = (e) => ({
|
|
1399
|
-
in: (t) => {
|
|
1400
|
-
const n = new De(t, e);
|
|
1401
|
-
h.addAction(n);
|
|
1402
|
-
}
|
|
1403
|
-
}), bt = (e) => ({
|
|
1404
|
-
in: (t) => {
|
|
1405
|
-
const n = new $e(t, e);
|
|
1406
|
-
h.addAction(n);
|
|
1407
|
-
}
|
|
1408
|
-
}), Dt = (e) => ({
|
|
1409
|
-
in: (t) => {
|
|
1410
|
-
const n = new Je(e, t);
|
|
1411
|
-
h.addAction(n);
|
|
1412
|
-
}
|
|
1413
|
-
}), ze = (e) => {
|
|
1414
|
-
h.addAction(new Ke(e));
|
|
1415
|
-
};
|
|
1416
|
-
ze.untilElement = (e) => ({
|
|
1417
|
-
isRemoved: () => {
|
|
1418
|
-
h.addAction(new Ve(e));
|
|
1419
|
-
}
|
|
1420
|
-
});
|
|
1421
|
-
const Ot = () => {
|
|
1422
|
-
h.addAction(new Me());
|
|
1423
|
-
}, It = (e) => {
|
|
1424
|
-
h.addAction(new Fe(e));
|
|
1425
|
-
}, Pt = () => {
|
|
1426
|
-
h.addAction(new We());
|
|
1427
|
-
}, $ = (e) => e.toLocaleDateString("en-US", { year: "numeric", month: "2-digit", day: "2-digit" }), K = (e) => {
|
|
1428
|
-
const t = /* @__PURE__ */ new Date();
|
|
1429
|
-
return $(new Date(t.setDate(t.getDate() + e)));
|
|
1430
|
-
}, ne = (e) => {
|
|
1431
|
-
const t = /* @__PURE__ */ new Date();
|
|
1432
|
-
return $(new Date(t.setMonth(t.getMonth() + e)));
|
|
1433
|
-
}, Ge = K(1), Qe = K(-1), Ze = K(7), Ye = K(-7), et = ne(1), tt = ne(-1), Lt = {
|
|
1434
|
-
formatDate: $,
|
|
1435
|
-
today: $(/* @__PURE__ */ new Date()),
|
|
1436
|
-
tomorrow: Ge,
|
|
1437
|
-
nextWeek: Ze,
|
|
1438
|
-
nextMonth: et,
|
|
1439
|
-
yesterday: Qe,
|
|
1440
|
-
lastWeek: Ye,
|
|
1441
|
-
lastMonth: tt
|
|
1442
|
-
};
|
|
1443
|
-
export {
|
|
1444
|
-
Y as ACTION_STATUS,
|
|
1445
|
-
wt as Assert,
|
|
1446
|
-
g as AutomationEvents,
|
|
1447
|
-
a as AutomationInstance,
|
|
1448
|
-
At as ClearValue,
|
|
1449
|
-
Et as Click,
|
|
1450
|
-
Lt as DateUtils,
|
|
1451
|
-
d as EVENT_NAMES,
|
|
1452
|
-
Ue as KEY_MAP,
|
|
1453
|
-
It as ManualTask,
|
|
1454
|
-
Ot as Pause,
|
|
1455
|
-
St as PressDownKey,
|
|
1456
|
-
kt as PressEnterKey,
|
|
1457
|
-
Ct as PressEscKey,
|
|
1458
|
-
Nt as PressKey,
|
|
1459
|
-
Tt as PressTabKey,
|
|
1460
|
-
Pt as ReloadPage,
|
|
1461
|
-
Dt as SaveValue,
|
|
1462
|
-
ft as Select,
|
|
1463
|
-
_ as Setup,
|
|
1464
|
-
yt as Task,
|
|
1465
|
-
mt as Test,
|
|
1466
|
-
Q as TestSpeed,
|
|
1467
|
-
xt as Type,
|
|
1468
|
-
vt as TypePassword,
|
|
1469
|
-
ie as UIElement,
|
|
1470
|
-
bt as UploadFile,
|
|
1471
|
-
ze as Wait,
|
|
1472
|
-
dt as and,
|
|
1473
|
-
ot as classIncludes,
|
|
1474
|
-
st as classIs,
|
|
1475
|
-
gt as default,
|
|
1476
|
-
ut as elementIndexIs,
|
|
1477
|
-
ht as firstChildTextIs,
|
|
1478
|
-
rt as innerTextContains,
|
|
1479
|
-
it as innerTextIs,
|
|
1480
|
-
pt as is,
|
|
1481
|
-
lt as isFirstElement,
|
|
1482
|
-
ct as placeholderIs,
|
|
1483
|
-
at as titleIs,
|
|
1484
|
-
gt as tomation,
|
|
1485
|
-
A as wait
|
|
1198
|
+
//#endregion
|
|
1199
|
+
//#region src/dsl/task.ts
|
|
1200
|
+
var Me = (e, t) => async (n) => {
|
|
1201
|
+
let r = new z(e, t);
|
|
1202
|
+
if (r.setParams(n), !j.running && !K.getIsCompiling()) try {
|
|
1203
|
+
x.log(`Compilation of Task ${e} starts...`), K.init(r), x.log(`Compilation of Task ${e} Finished.`), x.log(`Start running Task ${e}...`), await j.start(r), x.log(`End of Task ${e}: SUCCESS`);
|
|
1204
|
+
} catch (t) {
|
|
1205
|
+
x.error("Error running task " + e + ". " + t.message);
|
|
1206
|
+
}
|
|
1207
|
+
else x.log(`Adding action ${e} to compilation stack`), K.addAction(r), K.compileAction(r);
|
|
1208
|
+
}, Ne = (e) => {
|
|
1209
|
+
let t = new ue(e);
|
|
1210
|
+
K.addAction(t);
|
|
1211
|
+
}, Pe = (e) => ({
|
|
1212
|
+
textIs: (t) => {
|
|
1213
|
+
K.addAction(new de(e, t));
|
|
1214
|
+
},
|
|
1215
|
+
containsText: (t) => {
|
|
1216
|
+
K.addAction(new fe(e, t));
|
|
1217
|
+
},
|
|
1218
|
+
valueIs: (t) => {
|
|
1219
|
+
K.addAction(new pe(e, t));
|
|
1220
|
+
},
|
|
1221
|
+
exists: () => {
|
|
1222
|
+
K.addAction(new me(e));
|
|
1223
|
+
},
|
|
1224
|
+
notExists: () => {
|
|
1225
|
+
K.addAction(new he(e));
|
|
1226
|
+
}
|
|
1227
|
+
}), Fe = (e) => ({ in: (t) => {
|
|
1228
|
+
let n = new ge(t, e);
|
|
1229
|
+
K.addAction(n);
|
|
1230
|
+
} }), Ie = (e) => ({ in: (t) => {
|
|
1231
|
+
let n = new V(t, e);
|
|
1232
|
+
K.addAction(n);
|
|
1233
|
+
} }), Le = () => ({ in: (e) => {
|
|
1234
|
+
let t = new V(e, "");
|
|
1235
|
+
K.addAction(t);
|
|
1236
|
+
} }), Re = () => ({ in: (e) => {
|
|
1237
|
+
K.addAction(new ve(e));
|
|
1238
|
+
} }), ze = () => ({ in: (e) => {
|
|
1239
|
+
K.addAction(new ye(e));
|
|
1240
|
+
} }), Be = () => ({ in: (e) => {
|
|
1241
|
+
K.addAction(new be(e));
|
|
1242
|
+
} }), Ve = () => ({ in: (e) => {
|
|
1243
|
+
K.addAction(new xe(e));
|
|
1244
|
+
} }), He = (e) => ({ in: (t) => {
|
|
1245
|
+
K.addAction(new Se(t, e));
|
|
1246
|
+
} }), Ue = (e) => ({ in: (t) => {
|
|
1247
|
+
let n = new _e(t, e);
|
|
1248
|
+
K.addAction(n);
|
|
1249
|
+
} }), We = (e) => ({ in: (t) => {
|
|
1250
|
+
let n = new Ce(t, e);
|
|
1251
|
+
K.addAction(n);
|
|
1252
|
+
} }), Ge = (e) => ({ in: (t) => {
|
|
1253
|
+
let n = new we(e, t);
|
|
1254
|
+
K.addAction(n);
|
|
1255
|
+
} }), Y = (e) => {
|
|
1256
|
+
K.addAction(new Te(e));
|
|
1486
1257
|
};
|
|
1258
|
+
Y.untilElement = (e) => ({ isRemoved: () => {
|
|
1259
|
+
K.addAction(new Ee(e));
|
|
1260
|
+
} });
|
|
1261
|
+
var Ke = () => {
|
|
1262
|
+
K.addAction(new De());
|
|
1263
|
+
}, qe = (e) => {
|
|
1264
|
+
K.addAction(new Oe(e));
|
|
1265
|
+
}, X = () => {
|
|
1266
|
+
K.addAction(new ke());
|
|
1267
|
+
}, Z = (e) => e.toLocaleDateString("en-US", {
|
|
1268
|
+
year: "numeric",
|
|
1269
|
+
month: "2-digit",
|
|
1270
|
+
day: "2-digit"
|
|
1271
|
+
}), Q = (e) => {
|
|
1272
|
+
let t = /* @__PURE__ */ new Date();
|
|
1273
|
+
return Z(new Date(t.setDate(t.getDate() + e)));
|
|
1274
|
+
}, $ = (e) => {
|
|
1275
|
+
let t = /* @__PURE__ */ new Date();
|
|
1276
|
+
return Z(new Date(t.setMonth(t.getMonth() + e)));
|
|
1277
|
+
}, Je = Q(1), Ye = Q(-1), Xe = Q(7), Ze = Q(-7), Qe = $(1), $e = $(-1), et = {
|
|
1278
|
+
formatDate: Z,
|
|
1279
|
+
today: Z(/* @__PURE__ */ new Date()),
|
|
1280
|
+
tomorrow: Je,
|
|
1281
|
+
nextWeek: Xe,
|
|
1282
|
+
nextMonth: Qe,
|
|
1283
|
+
yesterday: Ye,
|
|
1284
|
+
lastWeek: Ze,
|
|
1285
|
+
lastMonth: $e
|
|
1286
|
+
}, tt = J;
|
|
1287
|
+
//#endregion
|
|
1288
|
+
export { L as ACTION_STATUS, Pe as Assert, y as AutomationEvents, O as AutomationInstance, Le as ClearValue, Ne as Click, et as DateUtils, v as EVENT_NAMES, H as KEY_MAP, qe as ManualTask, Ke as Pause, ze as PressDownKey, Ve as PressEnterKey, Re as PressEscKey, He as PressKey, Be as PressTabKey, X as ReloadPage, Ge as SaveValue, Fe as Select, k as Setup, Me as Task, je as Test, T as TestSpeed, Ie as Type, Ue as TypePassword, f as UIElement, We as UploadFile, Y as Wait, d as and, r as classIncludes, n as classIs, tt as default, l as elementIndexIs, u as firstChildTextIs, a as innerTextContains, i as innerTextIs, ne as is, c as isFirstElement, s as placeholderIs, o as titleIs, J as tomation, S as wait };
|