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