tomation 0.0.3 → 0.0.5
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 +48 -1
- package/dist/automation.d.ts +12 -3
- package/dist/main.cjs +1 -1977
- package/dist/main.d.ts +2 -2
- package/dist/main.js +857 -1311
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -1,283 +1,170 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
__publicField(this, "parent");
|
|
12
|
-
__publicField(this, "postProcess");
|
|
13
|
-
this.name = name;
|
|
14
|
-
this.selector = selector;
|
|
15
|
-
this.parent = parent || null;
|
|
16
|
-
this.postProcess = postProcessFn;
|
|
1
|
+
var se = Object.defineProperty;
|
|
2
|
+
var oe = (t, e, n) => e in t ? se(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var i = (t, e, n) => (oe(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
+
class ie {
|
|
5
|
+
constructor(e, n, s, o) {
|
|
6
|
+
i(this, "name");
|
|
7
|
+
i(this, "selector");
|
|
8
|
+
i(this, "parent");
|
|
9
|
+
i(this, "postProcess");
|
|
10
|
+
this.name = e, this.selector = n, this.parent = s || null, this.postProcess = o;
|
|
17
11
|
}
|
|
18
12
|
getElementName() {
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
parent = " in " + this.parent.getElementName();
|
|
22
|
-
}
|
|
23
|
-
return `${this.name}${parent}`;
|
|
13
|
+
let e = "";
|
|
14
|
+
return this.parent && (e = " in " + this.parent.getElementName()), `${this.name}${e}`;
|
|
24
15
|
}
|
|
25
16
|
}
|
|
26
|
-
let
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
console.log("Applying filter ", filterFn);
|
|
43
|
-
console.log(" -- to " + elementsFound.length + "elements: ", elementsFound);
|
|
44
|
-
elemFound = elementsFound.filter((elem, index, array) => {
|
|
45
|
-
console.log("Apply filter to item " + index + ": ", elem);
|
|
46
|
-
const match = filterFn(elem, index, array);
|
|
47
|
-
console.log(` -> Item ${index} ${match ? "Match" : "Discarded"}`);
|
|
48
|
-
return match;
|
|
49
|
-
})[0];
|
|
50
|
-
} else {
|
|
51
|
-
elemFound = elementsFound[0];
|
|
52
|
-
}
|
|
53
|
-
if (elemFound && postProcess) {
|
|
54
|
-
console.log("Apply post process to = ", elemFound);
|
|
55
|
-
elemFound = postProcess(elemFound);
|
|
56
|
-
}
|
|
57
|
-
console.log("Return elem = ", elemFound);
|
|
58
|
-
return elemFound;
|
|
59
|
-
};
|
|
60
|
-
return selector;
|
|
61
|
-
};
|
|
62
|
-
const selectorIdentifier = (selector, parent, postProcessFn) => ({
|
|
17
|
+
let W;
|
|
18
|
+
const re = (t) => {
|
|
19
|
+
W = t;
|
|
20
|
+
}, z = (t, e) => (s = W, o) => {
|
|
21
|
+
s = s || W, console.log("Searching elem from Root = ", s);
|
|
22
|
+
const a = [];
|
|
23
|
+
s.querySelectorAll(t).forEach((l) => {
|
|
24
|
+
l.style.display !== "none" && a.push(l);
|
|
25
|
+
});
|
|
26
|
+
let r;
|
|
27
|
+
return e ? (console.log("Applying filter ", e), console.log(" -- to " + a.length + "elements: ", a), r = a.filter((l, E, C) => {
|
|
28
|
+
console.log("Apply filter to item " + E + ": ", l);
|
|
29
|
+
const g = e(l, E, C);
|
|
30
|
+
return console.log(` -> Item ${E} ${g ? "Match" : "Discarded"}`), g;
|
|
31
|
+
})[0]) : r = a[0], r && o && (console.log("Apply post process to = ", r), r = o(r)), console.log("Return elem = ", r), r;
|
|
32
|
+
}, R = (t, e, n) => ({
|
|
63
33
|
/**
|
|
64
34
|
* Sets the UI element identifier
|
|
65
35
|
* @param uiElementId
|
|
66
36
|
* @returns
|
|
67
37
|
*/
|
|
68
|
-
as: (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
});
|
|
72
|
-
const postProcessResponse = (selector, parent) => ({
|
|
73
|
-
...selectorIdentifier(selector, parent),
|
|
38
|
+
as: (s) => new ie(s, t, e, n)
|
|
39
|
+
}), ae = (t, e) => ({
|
|
40
|
+
...R(t, e),
|
|
74
41
|
/**
|
|
75
42
|
* Tansform the UI element that will be returned
|
|
76
43
|
* @param postProcessFn
|
|
77
44
|
* @returns
|
|
78
45
|
*/
|
|
79
|
-
postProcess: (
|
|
80
|
-
...
|
|
46
|
+
postProcess: (n) => ({
|
|
47
|
+
...R(t, e, n)
|
|
81
48
|
})
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
...postProcessResponse(selector, parent)
|
|
49
|
+
}), G = (t) => ({
|
|
50
|
+
...R(t, null),
|
|
51
|
+
childOf: (e) => ({
|
|
52
|
+
...ae(t, e)
|
|
87
53
|
}),
|
|
88
54
|
/**
|
|
89
55
|
* Tansform the UI element that will be returned
|
|
90
56
|
* @param postProcessFn
|
|
91
57
|
* @returns
|
|
92
58
|
*/
|
|
93
|
-
postProcess: (
|
|
94
|
-
...
|
|
59
|
+
postProcess: (e) => ({
|
|
60
|
+
...R(t, null, e)
|
|
95
61
|
})
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
return
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
const
|
|
131
|
-
return (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const innerTextContains = (text) => {
|
|
146
|
-
return (elem) => {
|
|
147
|
-
const result = elem.innerText.trim().includes(text);
|
|
148
|
-
filterLog(`innerTextContains('${text}') on`, elem, "=>", result);
|
|
149
|
-
return result;
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
const titleIs = (text) => {
|
|
153
|
-
return (elem) => {
|
|
154
|
-
const result = elem.title == text;
|
|
155
|
-
filterLog(`titleIs('${text}') on`, elem, "=>", result);
|
|
156
|
-
return result;
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
const placeholderIs = (text) => {
|
|
160
|
-
return (elem) => {
|
|
161
|
-
const result = elem.placeholder === text;
|
|
162
|
-
filterLog(`placeholderIs('${text}') on`, elem, "=>", result);
|
|
163
|
-
return result;
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
const isFirstElement = () => {
|
|
167
|
-
return (elem, index) => {
|
|
168
|
-
const result = index === 0;
|
|
169
|
-
filterLog("isFirstElement on", elem, "index", index, "=>", result);
|
|
170
|
-
return result;
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
const elementIndexIs = (index) => {
|
|
174
|
-
return (elem, elemIndex) => {
|
|
175
|
-
const result = elemIndex === index;
|
|
176
|
-
filterLog(`elementIndexIs(${index}) on`, elem, "elemIndex", elemIndex, "=>", result);
|
|
177
|
-
return result;
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
const firstChildTextIs = (text) => {
|
|
181
|
-
return (elem) => {
|
|
182
|
-
const result = (elem == null ? void 0 : elem.firstChild).innerText.trim() === text;
|
|
183
|
-
filterLog(`firstChildTextIs('${text}') on`, elem, "=>", result);
|
|
184
|
-
return result;
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
const and = (conditions) => {
|
|
188
|
-
return (elem, elemIndex) => {
|
|
189
|
-
let response = true;
|
|
190
|
-
let i = 0;
|
|
191
|
-
while (response && i < conditions.length) {
|
|
192
|
-
const condResult = conditions[i](elem, elemIndex);
|
|
193
|
-
filterLog(`and condition[${i}] on`, elem, "elemIndex", elemIndex, "=>", condResult);
|
|
194
|
-
response = response && condResult;
|
|
195
|
-
i++;
|
|
196
|
-
}
|
|
197
|
-
filterLog("and final result on", elem, "elemIndex", elemIndex, "=>", response);
|
|
198
|
-
return response;
|
|
199
|
-
};
|
|
200
|
-
};
|
|
201
|
-
const is = {
|
|
202
|
-
DIV,
|
|
203
|
-
BUTTON,
|
|
204
|
-
INPUT,
|
|
205
|
-
TEXTAREA,
|
|
206
|
-
ELEMENT,
|
|
207
|
-
identifiedBy
|
|
62
|
+
}), D = (t) => ({
|
|
63
|
+
where: (e) => G(z(t, e))
|
|
64
|
+
}), ce = D("div"), le = D("button"), ue = D("input"), he = D("textarea"), de = (t) => G(z("#" + t)), pe = (t) => D(t);
|
|
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 = {
|
|
105
|
+
DIV: ce,
|
|
106
|
+
BUTTON: le,
|
|
107
|
+
INPUT: ue,
|
|
108
|
+
TEXTAREA: he,
|
|
109
|
+
ELEMENT: pe,
|
|
110
|
+
identifiedBy: de
|
|
208
111
|
};
|
|
209
|
-
let
|
|
210
|
-
const
|
|
211
|
-
function
|
|
212
|
-
if (!getRandomValues)
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return getRandomValues(rnds8);
|
|
219
|
-
}
|
|
220
|
-
const byteToHex = [];
|
|
221
|
-
for (let i = 0; i < 256; ++i) {
|
|
222
|
-
byteToHex.push((i + 256).toString(16).slice(1));
|
|
112
|
+
let P;
|
|
113
|
+
const me = new Uint8Array(16);
|
|
114
|
+
function ge() {
|
|
115
|
+
if (!P && (P = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !P))
|
|
116
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
117
|
+
return P(me);
|
|
223
118
|
}
|
|
224
|
-
|
|
225
|
-
|
|
119
|
+
const p = [];
|
|
120
|
+
for (let t = 0; t < 256; ++t)
|
|
121
|
+
p.push((t + 256).toString(16).slice(1));
|
|
122
|
+
function ye(t, e = 0) {
|
|
123
|
+
return (p[t[e + 0]] + p[t[e + 1]] + p[t[e + 2]] + p[t[e + 3]] + "-" + p[t[e + 4]] + p[t[e + 5]] + "-" + p[t[e + 6]] + p[t[e + 7]] + "-" + p[t[e + 8]] + p[t[e + 9]] + "-" + p[t[e + 10]] + p[t[e + 11]] + p[t[e + 12]] + p[t[e + 13]] + p[t[e + 14]] + p[t[e + 15]]).toLowerCase();
|
|
226
124
|
}
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
randomUUID
|
|
125
|
+
const Ee = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), B = {
|
|
126
|
+
randomUUID: Ee
|
|
230
127
|
};
|
|
231
|
-
function
|
|
232
|
-
if (
|
|
233
|
-
return
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
return buf;
|
|
245
|
-
}
|
|
246
|
-
return unsafeStringify(rnds);
|
|
128
|
+
function Z(t, e, n) {
|
|
129
|
+
if (B.randomUUID && !e && !t)
|
|
130
|
+
return B.randomUUID();
|
|
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;
|
|
138
|
+
}
|
|
139
|
+
return ye(s);
|
|
247
140
|
}
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
key,
|
|
258
|
-
|
|
259
|
-
}));
|
|
260
|
-
propsList.forEach((styleItem) => {
|
|
261
|
-
const { key, value } = styleItem;
|
|
262
|
-
elem.style[key] = value;
|
|
141
|
+
const f = (t = 2e3) => new Promise((e) => {
|
|
142
|
+
setTimeout(() => {
|
|
143
|
+
e(null);
|
|
144
|
+
}, t);
|
|
145
|
+
}), A = (t, e) => {
|
|
146
|
+
Object.entries(e).map(([s, o]) => ({
|
|
147
|
+
key: s,
|
|
148
|
+
value: o
|
|
149
|
+
})).forEach((s) => {
|
|
150
|
+
const { key: o, value: a } = s;
|
|
151
|
+
t.style[o] = a;
|
|
263
152
|
});
|
|
264
153
|
};
|
|
265
|
-
class
|
|
266
|
-
constructor(
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
this.document =
|
|
279
|
-
this.window = window2;
|
|
280
|
-
this.devToolsMessageContainer = this.createElement("DIV", {
|
|
154
|
+
class we {
|
|
155
|
+
constructor(e) {
|
|
156
|
+
i(this, "window");
|
|
157
|
+
i(this, "document");
|
|
158
|
+
i(this, "devToolsMessageContainer");
|
|
159
|
+
i(this, "devToolsCheckElementContainer");
|
|
160
|
+
i(this, "darkLayerLeft");
|
|
161
|
+
i(this, "darkLayerTop");
|
|
162
|
+
i(this, "darkLayerRight");
|
|
163
|
+
i(this, "darkLayerBottom");
|
|
164
|
+
i(this, "currentCheckElem");
|
|
165
|
+
i(this, "contextViewerContainer");
|
|
166
|
+
i(this, "devToolsAlertContainer");
|
|
167
|
+
this.document = e.document, this.window = e, this.devToolsMessageContainer = this.createElement("DIV", {
|
|
281
168
|
id: "dev-tools-message-container",
|
|
282
169
|
styles: {
|
|
283
170
|
width: "500px",
|
|
@@ -290,8 +177,7 @@ class UIUtils {
|
|
|
290
177
|
zIndex: "9999"
|
|
291
178
|
},
|
|
292
179
|
parent: this.document.body
|
|
293
|
-
})
|
|
294
|
-
this.devToolsAlertContainer = this.createElement("DIV", {
|
|
180
|
+
}), this.devToolsAlertContainer = this.createElement("DIV", {
|
|
295
181
|
id: "dev-tools-alert-container",
|
|
296
182
|
styles: {
|
|
297
183
|
width: "100%",
|
|
@@ -308,8 +194,7 @@ class UIUtils {
|
|
|
308
194
|
padding: "5px"
|
|
309
195
|
},
|
|
310
196
|
parent: this.document.body
|
|
311
|
-
})
|
|
312
|
-
this.devToolsCheckElementContainer = this.createElement("DIV", {
|
|
197
|
+
}), this.devToolsCheckElementContainer = this.createElement("DIV", {
|
|
313
198
|
id: "dev-tools-check-element-container",
|
|
314
199
|
styles: {
|
|
315
200
|
width: "100%",
|
|
@@ -324,36 +209,31 @@ class UIUtils {
|
|
|
324
209
|
},
|
|
325
210
|
parent: this.document.body
|
|
326
211
|
});
|
|
327
|
-
const
|
|
212
|
+
const n = {
|
|
328
213
|
zIndex: "9991",
|
|
329
214
|
backgroundColor: "rgba(0,0,0,0.3)",
|
|
330
215
|
position: "absolute"
|
|
331
216
|
};
|
|
332
217
|
this.darkLayerLeft = this.createElement("DIV", {
|
|
333
218
|
id: "dark-layer-left",
|
|
334
|
-
styles:
|
|
219
|
+
styles: n,
|
|
335
220
|
parent: this.devToolsCheckElementContainer
|
|
336
|
-
})
|
|
337
|
-
this.darkLayerTop = this.createElement("DIV", {
|
|
221
|
+
}), this.darkLayerTop = this.createElement("DIV", {
|
|
338
222
|
id: "dark-layer-top",
|
|
339
|
-
styles:
|
|
223
|
+
styles: n,
|
|
340
224
|
parent: this.devToolsCheckElementContainer
|
|
341
|
-
})
|
|
342
|
-
this.darkLayerRight = this.createElement("DIV", {
|
|
225
|
+
}), this.darkLayerRight = this.createElement("DIV", {
|
|
343
226
|
id: "dark-layer-right",
|
|
344
|
-
styles:
|
|
227
|
+
styles: n,
|
|
345
228
|
parent: this.devToolsCheckElementContainer
|
|
346
|
-
})
|
|
347
|
-
this.darkLayerBottom = this.createElement("DIV", {
|
|
229
|
+
}), this.darkLayerBottom = this.createElement("DIV", {
|
|
348
230
|
id: "dark-layer-bottom",
|
|
349
|
-
styles:
|
|
231
|
+
styles: n,
|
|
350
232
|
parent: this.devToolsCheckElementContainer
|
|
351
|
-
})
|
|
352
|
-
this.currentCheckElem = this.createElement("DIV", {
|
|
233
|
+
}), this.currentCheckElem = this.createElement("DIV", {
|
|
353
234
|
id: "current-check-elem",
|
|
354
235
|
parent: this.devToolsCheckElementContainer
|
|
355
|
-
})
|
|
356
|
-
this.contextViewerContainer = this.createElement("DIV", {
|
|
236
|
+
}), this.contextViewerContainer = this.createElement("DIV", {
|
|
357
237
|
id: "context-viewer-container",
|
|
358
238
|
styles: {
|
|
359
239
|
width: "100%",
|
|
@@ -367,261 +247,138 @@ class UIUtils {
|
|
|
367
247
|
parent: this.document.body
|
|
368
248
|
});
|
|
369
249
|
}
|
|
370
|
-
createElement(
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
if (props.id)
|
|
374
|
-
elem.id = props == null ? void 0 : props.id;
|
|
375
|
-
if (props.styles)
|
|
376
|
-
updateStyle(elem, props.styles);
|
|
377
|
-
if (props.parent)
|
|
378
|
-
props.parent.appendChild(elem);
|
|
379
|
-
}
|
|
380
|
-
return elem;
|
|
250
|
+
createElement(e, n) {
|
|
251
|
+
const s = this.document.createElement(e);
|
|
252
|
+
return n && (n.id && (s.id = n == null ? void 0 : n.id), n.styles && A(s, n.styles), n.parent && n.parent.appendChild(s)), s;
|
|
381
253
|
}
|
|
382
254
|
/**
|
|
383
255
|
*
|
|
384
256
|
* @param message @deprecated
|
|
385
257
|
*/
|
|
386
|
-
async logAction(
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
updateStyle(messageElem, {
|
|
258
|
+
async logAction(e) {
|
|
259
|
+
const n = c.document.createElement("DIV");
|
|
260
|
+
n.innerText = e, A(n, {
|
|
390
261
|
padding: "3px 10px",
|
|
391
262
|
opacity: "1",
|
|
392
263
|
transition: "opacity 1s"
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
await wait(4e3);
|
|
398
|
-
this.devToolsMessageContainer.removeChild(messageElem);
|
|
399
|
-
await wait(1e3);
|
|
400
|
-
}
|
|
401
|
-
async checkElement(elem, name) {
|
|
402
|
-
if (!elem)
|
|
264
|
+
}), this.devToolsMessageContainer.appendChild(n), await f(4e3), n.style.opacity = "0", await f(4e3), this.devToolsMessageContainer.removeChild(n), await f(1e3);
|
|
265
|
+
}
|
|
266
|
+
async checkElement(e, n) {
|
|
267
|
+
if (!e)
|
|
403
268
|
return;
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
this.darkLayerTop.style.left = this.window.scrollX + "px";
|
|
411
|
-
this.darkLayerTop.style.top = "0px";
|
|
412
|
-
this.darkLayerTop.style.width = "100%";
|
|
413
|
-
this.darkLayerTop.style.height = rect.top + "px";
|
|
414
|
-
this.darkLayerRight.style.left = this.window.scrollX + rect.left + rect.width + "px";
|
|
415
|
-
this.darkLayerRight.style.top = rect.top + "px";
|
|
416
|
-
this.darkLayerRight.style.width = bodyBundingRect.width - (rect.left + rect.width) + "px";
|
|
417
|
-
this.darkLayerRight.style.height = rect.height + "px";
|
|
418
|
-
this.darkLayerBottom.style.left = this.window.scrollX + "px";
|
|
419
|
-
this.darkLayerBottom.style.top = rect.top + rect.height + "px";
|
|
420
|
-
this.darkLayerBottom.style.width = "100%";
|
|
421
|
-
this.darkLayerBottom.style.height = bodyBundingRect.height - (rect.top + rect.height) + "px";
|
|
422
|
-
this.currentCheckElem.id = `dev-tools-current-check-elem-${name}`;
|
|
423
|
-
this.currentCheckElem.style.top = rect.top + "px";
|
|
424
|
-
this.currentCheckElem.style.left = this.window.scrollX + rect.left + "px";
|
|
425
|
-
this.currentCheckElem.style.height = rect.height + "px";
|
|
426
|
-
this.currentCheckElem.style.width = rect.width + "px";
|
|
427
|
-
this.currentCheckElem.style.boxShadow = "0px 0px 5px 2px lightgreen";
|
|
428
|
-
this.currentCheckElem.style.position = "absolute";
|
|
429
|
-
this.currentCheckElem.style.zIndex = "9992";
|
|
430
|
-
this.devToolsCheckElementContainer.style.display = "block";
|
|
431
|
-
this.devToolsCheckElementContainer.style.opacity = "1";
|
|
432
|
-
await wait(200);
|
|
433
|
-
}
|
|
434
|
-
async showAlert(message) {
|
|
435
|
-
const messageElem = AutomationInstance.document.createElement("DIV");
|
|
436
|
-
const body = AutomationInstance.document.body;
|
|
437
|
-
messageElem.innerText = message;
|
|
438
|
-
updateStyle(body, {
|
|
269
|
+
const s = e.getBoundingClientRect(), o = this.document.body.getBoundingClientRect();
|
|
270
|
+
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
|
+
}
|
|
272
|
+
async showAlert(e) {
|
|
273
|
+
const n = c.document.createElement("DIV"), s = c.document.body;
|
|
274
|
+
n.innerText = e, A(s, {
|
|
439
275
|
paddingTop: "30px"
|
|
440
|
-
})
|
|
441
|
-
updateStyle(this.devToolsAlertContainer, {
|
|
276
|
+
}), A(this.devToolsAlertContainer, {
|
|
442
277
|
display: "flex"
|
|
443
|
-
});
|
|
444
|
-
this.devToolsAlertContainer.appendChild(messageElem);
|
|
278
|
+
}), this.devToolsAlertContainer.appendChild(n);
|
|
445
279
|
}
|
|
446
280
|
async hideAlert() {
|
|
447
|
-
|
|
281
|
+
A(this.devToolsAlertContainer, {
|
|
448
282
|
display: "none"
|
|
449
283
|
});
|
|
450
|
-
const
|
|
451
|
-
|
|
284
|
+
const e = c.document.body;
|
|
285
|
+
A(e, {
|
|
452
286
|
paddingTop: "0"
|
|
453
|
-
});
|
|
454
|
-
if (this.devToolsAlertContainer.firstChild) {
|
|
455
|
-
this.devToolsAlertContainer.removeChild(this.devToolsAlertContainer.firstChild);
|
|
456
|
-
}
|
|
287
|
+
}), this.devToolsAlertContainer.firstChild && this.devToolsAlertContainer.removeChild(this.devToolsAlertContainer.firstChild);
|
|
457
288
|
}
|
|
458
289
|
async hideCheckElementContainer() {
|
|
459
|
-
this.devToolsCheckElementContainer.style.opacity = "0";
|
|
460
|
-
await wait(200);
|
|
461
|
-
this.devToolsCheckElementContainer.style.display = "none";
|
|
290
|
+
this.devToolsCheckElementContainer.style.opacity = "0", await f(200), this.devToolsCheckElementContainer.style.display = "none";
|
|
462
291
|
}
|
|
463
|
-
displayContext(
|
|
464
|
-
|
|
292
|
+
displayContext(e) {
|
|
293
|
+
A(this.contextViewerContainer, {
|
|
465
294
|
display: "flex",
|
|
466
295
|
"background-color": "white",
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
296
|
+
position: "absolute",
|
|
297
|
+
top: "0px",
|
|
298
|
+
left: "0px",
|
|
470
299
|
"z-index": "9999"
|
|
471
300
|
});
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
updateStyle(contextViewerBefore, {
|
|
301
|
+
const n = this.document.createElement("DIV");
|
|
302
|
+
n.id = "context-viewer-before", A(n, {
|
|
475
303
|
flex: "50%",
|
|
476
304
|
width: "100%",
|
|
477
305
|
height: "auto",
|
|
478
306
|
border: "2px solid orange"
|
|
479
307
|
});
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
updateStyle(contextViewerAfter, {
|
|
308
|
+
const s = this.document.createElement("DIV");
|
|
309
|
+
s.id = "context-viewer-after", A(s, {
|
|
483
310
|
flex: "50%",
|
|
484
311
|
width: "100%",
|
|
485
312
|
height: "auto",
|
|
486
313
|
border: "2px solid green"
|
|
487
314
|
});
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
this.contextViewerContainer.appendChild(contextViewerBefore);
|
|
495
|
-
contextViewerBefore.appendChild(beforeHTML);
|
|
496
|
-
setTimeout(() => {
|
|
497
|
-
this.contextViewerContainer.removeChild(contextViewerBefore);
|
|
498
|
-
this.contextViewerContainer.appendChild(contextViewerAfter);
|
|
499
|
-
contextViewerAfter.appendChild(afterHTML);
|
|
500
|
-
setTimeout(() => {
|
|
501
|
-
this.contextViewerContainer.removeChild(contextViewerAfter);
|
|
502
|
-
updateStyle(this.contextViewerContainer, { display: "none" });
|
|
315
|
+
const o = this.document.createElement("DIV");
|
|
316
|
+
o.innerHTML = e.beforeHTML, H(o, e.beforeInputValues);
|
|
317
|
+
const a = this.document.createElement("DIV");
|
|
318
|
+
a.innerHTML = e.afterHTML, H(a, e.afterInputValues), this.contextViewerContainer.appendChild(n), n.appendChild(o), setTimeout(() => {
|
|
319
|
+
this.contextViewerContainer.removeChild(n), this.contextViewerContainer.appendChild(s), s.appendChild(a), setTimeout(() => {
|
|
320
|
+
this.contextViewerContainer.removeChild(s), A(this.contextViewerContainer, { display: "none" });
|
|
503
321
|
}, 2e3);
|
|
504
322
|
}, 2e3);
|
|
505
323
|
}
|
|
506
324
|
}
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
const
|
|
510
|
-
|
|
325
|
+
const H = (t, e) => {
|
|
326
|
+
t.querySelectorAll("input").forEach((n) => {
|
|
327
|
+
const s = n.getAttribute("input-id") || "";
|
|
328
|
+
n.value = e[s];
|
|
511
329
|
});
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
AutomationInstance.saveCurrentAction(async (action) => {
|
|
519
|
-
if (action.status == "skipped") {
|
|
520
|
-
return resolve(null);
|
|
521
|
-
}
|
|
330
|
+
}, q = null, $ = async (t, e, n, s = 1e3, o = 0, a = 10, r = !1) => {
|
|
331
|
+
if (console.log("Automation Status: ", c.status), c.isPaused)
|
|
332
|
+
return new Promise((l, E) => {
|
|
333
|
+
c.saveCurrentAction(async (C) => {
|
|
334
|
+
if (C.status == "skipped")
|
|
335
|
+
return l(null);
|
|
522
336
|
try {
|
|
523
|
-
const
|
|
524
|
-
|
|
525
|
-
} catch (
|
|
526
|
-
|
|
337
|
+
const g = await $(C, e, n, s, o, a, r);
|
|
338
|
+
l(g);
|
|
339
|
+
} catch (g) {
|
|
340
|
+
E(g);
|
|
527
341
|
}
|
|
528
|
-
},
|
|
342
|
+
}, t);
|
|
529
343
|
});
|
|
530
|
-
|
|
531
|
-
if (AutomationInstance.isStopped) {
|
|
344
|
+
if (c.isStopped)
|
|
532
345
|
throw new Error("Test stopped manually");
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
await
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
throw new Error(`UI Element ${uiElement.getElementName() || "UNKNOWN"} not found after 10 tries`);
|
|
545
|
-
}
|
|
546
|
-
} else {
|
|
547
|
-
const elem = uiElement.selector(parentElement, uiElement.postProcess);
|
|
548
|
-
console.groupEnd();
|
|
549
|
-
if (elem) {
|
|
550
|
-
if (untilRemoved) {
|
|
551
|
-
await wait(delay);
|
|
552
|
-
return await retry(currentAction, uiElement, parentElement, delay, ++index, maxTries, untilRemoved);
|
|
553
|
-
} else {
|
|
554
|
-
console.log("Element found = ", elem);
|
|
555
|
-
return elem;
|
|
556
|
-
}
|
|
557
|
-
} else {
|
|
558
|
-
if (untilRemoved) {
|
|
559
|
-
console.log("Element removed.");
|
|
560
|
-
return HTML_ELEMENT_REMOVED;
|
|
561
|
-
} else {
|
|
562
|
-
await wait(delay);
|
|
563
|
-
return await retry(currentAction, uiElement, parentElement, delay, ++index, maxTries, untilRemoved);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
};
|
|
568
|
-
const waitForElement = async (currentAction, uiElement, delay = 1e3, maxTries = 10, untilRemoved = false) => {
|
|
569
|
-
const elementName = uiElement == null ? void 0 : uiElement.getElementName();
|
|
570
|
-
console.group("Looking for Element: " + elementName);
|
|
571
|
-
let parentElement = null;
|
|
572
|
-
if (uiElement.parent) {
|
|
346
|
+
if (console.groupCollapsed(`tries ${o}/${a}`), t && (t.updateTries(o), await y.notifyActionUpdated(t)), o === a)
|
|
347
|
+
throw console.groupEnd(), r ? new Error(`UI Element ${e.getElementName() || "UNKNOWN"} still present after 10 tries`) : new Error(`UI Element ${e.getElementName() || "UNKNOWN"} not found after 10 tries`);
|
|
348
|
+
{
|
|
349
|
+
const l = e.selector(n, e.postProcess);
|
|
350
|
+
return console.groupEnd(), l ? r ? (await f(s), await $(t, e, n, s, ++o, a, r)) : (console.log("Element found = ", l), l) : r ? (console.log("Element removed."), q) : (await f(s), await $(t, e, n, s, ++o, a, r));
|
|
351
|
+
}
|
|
352
|
+
}, V = async (t, e, n = 1e3, s = 10, o = !1) => {
|
|
353
|
+
const a = e == null ? void 0 : e.getElementName();
|
|
354
|
+
console.group("Looking for Element: " + a);
|
|
355
|
+
let r = null;
|
|
356
|
+
if (e.parent)
|
|
573
357
|
try {
|
|
574
|
-
console.groupCollapsed("Look for Parent ",
|
|
575
|
-
|
|
576
|
-
console.groupEnd()
|
|
577
|
-
|
|
578
|
-
console.groupEnd();
|
|
579
|
-
if (untilRemoved && e.message.includes("not found")) {
|
|
580
|
-
console.log("Parent not found, so element was removed");
|
|
581
|
-
console.groupEnd();
|
|
582
|
-
return HTML_ELEMENT_REMOVED;
|
|
583
|
-
} else {
|
|
584
|
-
console.groupEnd();
|
|
585
|
-
throw e;
|
|
586
|
-
}
|
|
358
|
+
console.groupCollapsed("Look for Parent ", e.parent.getElementName()), r = await V(t, e.parent, n, s, o), console.groupEnd();
|
|
359
|
+
} catch (l) {
|
|
360
|
+
if (console.groupEnd(), o && l.message.includes("not found"))
|
|
361
|
+
return console.log("Parent not found, so element was removed"), console.groupEnd(), q;
|
|
362
|
+
throw console.groupEnd(), l;
|
|
587
363
|
}
|
|
588
|
-
}
|
|
589
364
|
try {
|
|
590
|
-
console.log("Using parent element: ",
|
|
591
|
-
const
|
|
592
|
-
console.groupEnd();
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
console.groupEnd();
|
|
598
|
-
return HTML_ELEMENT_REMOVED;
|
|
599
|
-
} else {
|
|
600
|
-
console.groupEnd();
|
|
601
|
-
throw e;
|
|
602
|
-
}
|
|
365
|
+
console.log("Using parent element: ", r);
|
|
366
|
+
const l = await $(t, e, r, n, 0, s, o);
|
|
367
|
+
return console.groupEnd(), l;
|
|
368
|
+
} catch (l) {
|
|
369
|
+
if (o && l.message.includes("not found"))
|
|
370
|
+
return console.log("Parent not found, so element was removed"), console.groupEnd(), q;
|
|
371
|
+
throw console.groupEnd(), l;
|
|
603
372
|
}
|
|
604
373
|
};
|
|
605
|
-
var
|
|
606
|
-
|
|
607
|
-
ACTION_STATUS2["RUNNING"] = "running";
|
|
608
|
-
ACTION_STATUS2["STOPPED"] = "stopped";
|
|
609
|
-
ACTION_STATUS2["PAUSED"] = "paused";
|
|
610
|
-
ACTION_STATUS2["SUCCESS"] = "success";
|
|
611
|
-
ACTION_STATUS2["ERROR"] = "error";
|
|
612
|
-
ACTION_STATUS2["SKIPPED"] = "skipped";
|
|
613
|
-
return ACTION_STATUS2;
|
|
614
|
-
})(ACTION_STATUS || {});
|
|
615
|
-
class AbstractAction {
|
|
374
|
+
var Y = /* @__PURE__ */ ((t) => (t.WAITING = "waiting", t.RUNNING = "running", t.STOPPED = "stopped", t.PAUSED = "paused", t.SUCCESS = "success", t.ERROR = "error", t.SKIPPED = "skipped", t))(Y || {});
|
|
375
|
+
class y {
|
|
616
376
|
constructor() {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
this.status = "waiting"
|
|
622
|
-
this.error = "";
|
|
623
|
-
this.id = v4();
|
|
624
|
-
this.context = {
|
|
377
|
+
i(this, "status");
|
|
378
|
+
i(this, "error");
|
|
379
|
+
i(this, "id");
|
|
380
|
+
i(this, "context");
|
|
381
|
+
this.status = "waiting", this.error = "", this.id = Z(), this.context = {
|
|
625
382
|
beforeHTML: "",
|
|
626
383
|
beforeInputValues: {},
|
|
627
384
|
afterInputValues: {},
|
|
@@ -641,79 +398,50 @@ class AbstractAction {
|
|
|
641
398
|
};
|
|
642
399
|
}
|
|
643
400
|
reset() {
|
|
644
|
-
this.status = "waiting";
|
|
645
|
-
this.error = "";
|
|
646
|
-
this.resetAction();
|
|
401
|
+
this.status = "waiting", this.error = "", this.resetAction();
|
|
647
402
|
}
|
|
648
403
|
getInputValuesFromPage() {
|
|
649
|
-
const
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
inputsMap[id] = input.value;
|
|
655
|
-
});
|
|
656
|
-
return inputsMap;
|
|
404
|
+
const e = {};
|
|
405
|
+
return c.document.querySelectorAll("input").forEach((s, o) => {
|
|
406
|
+
const a = `value-id-${o}`;
|
|
407
|
+
s.setAttribute("input-id", a), e[a] = s.value;
|
|
408
|
+
}), e;
|
|
657
409
|
}
|
|
658
410
|
async execute() {
|
|
659
411
|
try {
|
|
660
|
-
this.status = "running";
|
|
661
|
-
this.context.beforeInputValues = this.getInputValuesFromPage();
|
|
662
|
-
this.context.beforeHTML = AutomationInstance.document.body.innerHTML;
|
|
663
|
-
await AbstractAction.notifyActionUpdated(this);
|
|
664
|
-
console.log("Action: ", this.getDescription());
|
|
665
|
-
await this.executeAction();
|
|
666
|
-
this.status = "success";
|
|
667
|
-
this.error = "";
|
|
668
|
-
if (AutomationInstance.isStepByStepMode) {
|
|
669
|
-
AutomationInstance.pause();
|
|
670
|
-
}
|
|
412
|
+
this.status = "running", this.context.beforeInputValues = this.getInputValuesFromPage(), this.context.beforeHTML = c.document.body.innerHTML, await y.notifyActionUpdated(this), console.log("Action: ", this.getDescription()), await this.executeAction(), this.status = "success", this.error = "", c.isStepByStepMode && c.pause();
|
|
671
413
|
} catch (e) {
|
|
672
|
-
this.status = "error"
|
|
673
|
-
this.error = e.message;
|
|
674
|
-
if (e.message == "Test stopped manually") {
|
|
414
|
+
if (this.status = "error", this.error = e.message, e.message == "Test stopped manually")
|
|
675
415
|
throw Error("Error in Action " + this.getDescription() + ". Message: " + e.message);
|
|
676
|
-
|
|
677
|
-
this.status = "paused";
|
|
678
|
-
AutomationInstance.pause();
|
|
679
|
-
}
|
|
416
|
+
this.status = "paused", c.pause();
|
|
680
417
|
} finally {
|
|
681
|
-
this.context.afterInputValues = this.getInputValuesFromPage();
|
|
682
|
-
this.context.afterHTML = AutomationInstance.document.body.innerHTML;
|
|
683
|
-
await AbstractAction.notifyActionUpdated(this);
|
|
418
|
+
this.context.afterInputValues = this.getInputValuesFromPage(), this.context.afterHTML = c.document.body.innerHTML, await y.notifyActionUpdated(this);
|
|
684
419
|
}
|
|
685
420
|
}
|
|
686
|
-
static async notifyActionUpdated(
|
|
687
|
-
|
|
688
|
-
action:
|
|
421
|
+
static async notifyActionUpdated(e) {
|
|
422
|
+
m.dispatch(v.ACTION_UPDATE, {
|
|
423
|
+
action: e.getJSON()
|
|
689
424
|
});
|
|
690
425
|
}
|
|
691
426
|
}
|
|
692
|
-
class
|
|
693
|
-
constructor(
|
|
427
|
+
class _ extends y {
|
|
428
|
+
constructor(n, s) {
|
|
694
429
|
super();
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
this.name =
|
|
701
|
-
this.stepsFn = steps;
|
|
702
|
-
this.steps = [];
|
|
703
|
-
this.index = 0;
|
|
430
|
+
i(this, "name");
|
|
431
|
+
i(this, "stepsFn");
|
|
432
|
+
i(this, "steps");
|
|
433
|
+
i(this, "params");
|
|
434
|
+
i(this, "index");
|
|
435
|
+
this.name = n, this.stepsFn = s, this.steps = [], this.index = 0;
|
|
704
436
|
}
|
|
705
437
|
getDescription() {
|
|
706
438
|
return this.name;
|
|
707
439
|
}
|
|
708
440
|
compileSteps() {
|
|
709
|
-
super.reset();
|
|
710
|
-
this.stepsFn(this.params);
|
|
441
|
+
super.reset(), this.stepsFn(this.params);
|
|
711
442
|
}
|
|
712
443
|
stepsToJSON() {
|
|
713
|
-
return this.steps.reduce((
|
|
714
|
-
acc.push(curr.getJSON());
|
|
715
|
-
return acc;
|
|
716
|
-
}, []);
|
|
444
|
+
return this.steps.reduce((n, s) => (n.push(s.getJSON()), n), []);
|
|
717
445
|
}
|
|
718
446
|
getJSON() {
|
|
719
447
|
return {
|
|
@@ -724,86 +452,69 @@ class Action extends AbstractAction {
|
|
|
724
452
|
};
|
|
725
453
|
}
|
|
726
454
|
resetAction() {
|
|
727
|
-
this.steps.length = 0;
|
|
728
|
-
this.index = 0;
|
|
455
|
+
this.steps.length = 0, this.index = 0;
|
|
729
456
|
}
|
|
730
457
|
async continue() {
|
|
731
|
-
if (
|
|
732
|
-
return new Promise((
|
|
733
|
-
|
|
734
|
-
if (
|
|
735
|
-
return
|
|
736
|
-
}
|
|
458
|
+
if (c.isPaused)
|
|
459
|
+
return new Promise((n, s) => {
|
|
460
|
+
c.saveCurrentAction(async (o) => {
|
|
461
|
+
if (o.status == "skipped")
|
|
462
|
+
return n();
|
|
737
463
|
try {
|
|
738
|
-
await
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
reject(error);
|
|
464
|
+
await o.continue(), n();
|
|
465
|
+
} catch (a) {
|
|
466
|
+
s(a);
|
|
742
467
|
}
|
|
743
468
|
}, this);
|
|
744
469
|
});
|
|
745
|
-
|
|
746
|
-
if (AutomationInstance.isStopped) {
|
|
470
|
+
if (c.isStopped)
|
|
747
471
|
throw new Error("Test stopped manually");
|
|
748
|
-
}
|
|
749
472
|
if (this.index < this.steps.length) {
|
|
750
|
-
const
|
|
473
|
+
const n = this.steps[this.index];
|
|
751
474
|
try {
|
|
752
|
-
await
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
AutomationInstance.saveCurrentAction(async (action) => {
|
|
760
|
-
if (action.status == "skipped") {
|
|
761
|
-
this.index++;
|
|
762
|
-
await AbstractAction.notifyActionUpdated(step);
|
|
763
|
-
await this.continue();
|
|
764
|
-
return resolve();
|
|
765
|
-
}
|
|
475
|
+
if (await f(c.speed), await n.execute(), !c.isPaused)
|
|
476
|
+
this.index++, await this.continue();
|
|
477
|
+
else
|
|
478
|
+
return new Promise((s, o) => {
|
|
479
|
+
c.saveCurrentAction(async (a) => {
|
|
480
|
+
if (a.status == "skipped")
|
|
481
|
+
return this.index++, await y.notifyActionUpdated(n), await this.continue(), s();
|
|
766
482
|
try {
|
|
767
|
-
await
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
reject(error);
|
|
483
|
+
await a.continue(), s();
|
|
484
|
+
} catch (r) {
|
|
485
|
+
o(r);
|
|
771
486
|
}
|
|
772
|
-
},
|
|
487
|
+
}, n);
|
|
773
488
|
});
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
throw e;
|
|
489
|
+
} catch (s) {
|
|
490
|
+
throw s;
|
|
777
491
|
}
|
|
778
492
|
}
|
|
779
493
|
}
|
|
780
494
|
async executeAction() {
|
|
781
|
-
this.index = 0;
|
|
782
|
-
await this.continue();
|
|
495
|
+
this.index = 0, await this.continue();
|
|
783
496
|
}
|
|
784
|
-
setParams(
|
|
785
|
-
this.params =
|
|
497
|
+
setParams(n) {
|
|
498
|
+
this.params = n;
|
|
786
499
|
}
|
|
787
|
-
addStep(
|
|
788
|
-
this.steps.push(
|
|
500
|
+
addStep(n) {
|
|
501
|
+
this.steps.push(n);
|
|
789
502
|
}
|
|
790
503
|
}
|
|
791
|
-
class
|
|
792
|
-
constructor(
|
|
504
|
+
class d extends y {
|
|
505
|
+
constructor(n) {
|
|
793
506
|
super();
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
this.uiElement =
|
|
798
|
-
this.element = null;
|
|
799
|
-
this.tries = 0;
|
|
507
|
+
i(this, "uiElement");
|
|
508
|
+
i(this, "element");
|
|
509
|
+
i(this, "tries");
|
|
510
|
+
this.uiElement = n, this.element = null, this.tries = 0;
|
|
800
511
|
}
|
|
801
512
|
getElementName() {
|
|
802
|
-
var
|
|
803
|
-
return (
|
|
513
|
+
var n;
|
|
514
|
+
return (n = this.uiElement) == null ? void 0 : n.getElementName();
|
|
804
515
|
}
|
|
805
|
-
updateTries(
|
|
806
|
-
this.tries =
|
|
516
|
+
updateTries(n) {
|
|
517
|
+
this.tries = n;
|
|
807
518
|
}
|
|
808
519
|
resetTries() {
|
|
809
520
|
this.tries = 0;
|
|
@@ -824,96 +535,61 @@ class ActionOnElement extends AbstractAction {
|
|
|
824
535
|
* @param uiElement
|
|
825
536
|
* @param delay of each try. Defaults to 1 second
|
|
826
537
|
*/
|
|
827
|
-
static waitForElement(
|
|
828
|
-
const
|
|
829
|
-
return new Promise(async (
|
|
830
|
-
var
|
|
831
|
-
const
|
|
832
|
-
console.groupCollapsed(`tries ${
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
console.groupEnd();
|
|
837
|
-
if (untilRemoved2) {
|
|
838
|
-
throw new Error(`UI Element ${elementName || "UNKNOWN"} still present after 10 tries`);
|
|
839
|
-
} else {
|
|
840
|
-
throw new Error(`UI Element ${elementName || "UNKNOWN"} not found after 10 tries`);
|
|
841
|
-
}
|
|
842
|
-
} else {
|
|
843
|
-
const elem = uiElement.selector(parentElement2, uiElement.postProcess);
|
|
844
|
-
console.groupEnd();
|
|
845
|
-
if (elem) {
|
|
846
|
-
if (untilRemoved2) {
|
|
847
|
-
await wait(delay2);
|
|
848
|
-
return await retry2(parentElement2, delay2, ++index, untilRemoved2);
|
|
849
|
-
} else {
|
|
850
|
-
console.log("Element found = ", elem);
|
|
851
|
-
return elem;
|
|
852
|
-
}
|
|
853
|
-
} else {
|
|
854
|
-
if (untilRemoved2) {
|
|
855
|
-
console.log("Element removed.");
|
|
856
|
-
return null;
|
|
857
|
-
} else {
|
|
858
|
-
await wait(delay2);
|
|
859
|
-
return await retry2(parentElement2, delay2, ++index, untilRemoved2);
|
|
860
|
-
}
|
|
861
|
-
}
|
|
538
|
+
static waitForElement(n, s, o = 1e3, a = 10, r = !1) {
|
|
539
|
+
const l = s.getElementName();
|
|
540
|
+
return new Promise(async (E, C) => {
|
|
541
|
+
var N;
|
|
542
|
+
const g = async (k, L = 1e3, b = 0, I = !1) => {
|
|
543
|
+
if (console.groupCollapsed(`tries ${b}/${a}`), n.updateTries(b), await y.notifyActionUpdated(n), b === a)
|
|
544
|
+
throw console.groupEnd(), I ? new Error(`UI Element ${l || "UNKNOWN"} still present after 10 tries`) : new Error(`UI Element ${l || "UNKNOWN"} not found after 10 tries`);
|
|
545
|
+
{
|
|
546
|
+
const M = s.selector(k, s.postProcess);
|
|
547
|
+
return console.groupEnd(), M ? I ? (await f(L), await g(k, L, ++b, I)) : (console.log("Element found = ", M), M) : I ? (console.log("Element removed."), null) : (await f(L), await g(k, L, ++b, I));
|
|
862
548
|
}
|
|
863
549
|
};
|
|
864
|
-
console.group("[Action On Element] Looking for Element: " +
|
|
865
|
-
let
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
console.groupCollapsed("Look for Parent ", uiElement.parent.getElementName());
|
|
550
|
+
console.group("[Action On Element] Looking for Element: " + l);
|
|
551
|
+
let T = null, F = !0;
|
|
552
|
+
if (s.parent) {
|
|
553
|
+
console.groupCollapsed("Look for Parent ", s.parent.getElementName());
|
|
869
554
|
try {
|
|
870
|
-
|
|
871
|
-
} catch
|
|
872
|
-
|
|
555
|
+
T = await d.waitForElement(n, s.parent, o, a, r);
|
|
556
|
+
} catch {
|
|
557
|
+
F = !1;
|
|
873
558
|
} finally {
|
|
874
559
|
console.groupEnd();
|
|
875
560
|
}
|
|
876
561
|
}
|
|
877
|
-
if (
|
|
878
|
-
console.log("using parent element: ",
|
|
562
|
+
if (F) {
|
|
563
|
+
console.log("using parent element: ", T);
|
|
879
564
|
try {
|
|
880
|
-
const
|
|
881
|
-
console.groupEnd();
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
console.groupEnd();
|
|
885
|
-
reject(new Error(e.message));
|
|
565
|
+
const k = await g(T, o, 0, r);
|
|
566
|
+
console.groupEnd(), E(k);
|
|
567
|
+
} catch (k) {
|
|
568
|
+
console.groupEnd(), C(new Error(k.message));
|
|
886
569
|
}
|
|
887
|
-
} else
|
|
888
|
-
console.groupEnd();
|
|
889
|
-
reject(new Error(`Parent ${(_a = uiElement.parent) == null ? void 0 : _a.getElementName()} of UI Element ${uiElement.name || "UNKNOWN"} not found`));
|
|
890
|
-
}
|
|
570
|
+
} else
|
|
571
|
+
console.groupEnd(), C(new Error(`Parent ${(N = s.parent) == null ? void 0 : N.getElementName()} of UI Element ${s.name || "UNKNOWN"} not found`));
|
|
891
572
|
});
|
|
892
573
|
}
|
|
893
574
|
async executeAction() {
|
|
894
|
-
var
|
|
575
|
+
var n;
|
|
895
576
|
try {
|
|
896
|
-
this.element = await
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
this.executeActionOnElement();
|
|
900
|
-
await AutomationInstance.uiUtils.hideCheckElementContainer();
|
|
901
|
-
} catch (e) {
|
|
902
|
-
throw Error(e.message);
|
|
577
|
+
this.element = await V(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
|
+
} catch (s) {
|
|
579
|
+
throw Error(s.message);
|
|
903
580
|
}
|
|
904
581
|
}
|
|
905
582
|
resetAction() {
|
|
906
|
-
this.element = null;
|
|
907
|
-
this.resetTries();
|
|
583
|
+
this.element = null, this.resetTries();
|
|
908
584
|
}
|
|
909
585
|
}
|
|
910
|
-
class
|
|
911
|
-
constructor(
|
|
912
|
-
super(
|
|
586
|
+
class fe extends d {
|
|
587
|
+
constructor(e) {
|
|
588
|
+
super(e);
|
|
913
589
|
}
|
|
914
590
|
executeActionOnElement() {
|
|
915
|
-
var
|
|
916
|
-
return (
|
|
591
|
+
var e;
|
|
592
|
+
return (e = this.element) == null ? void 0 : e.click();
|
|
917
593
|
}
|
|
918
594
|
getDescription() {
|
|
919
595
|
return "Click in " + this.getElementName();
|
|
@@ -925,18 +601,16 @@ class ClickAction extends ActionOnElement {
|
|
|
925
601
|
};
|
|
926
602
|
}
|
|
927
603
|
}
|
|
928
|
-
class
|
|
929
|
-
constructor(
|
|
930
|
-
super(
|
|
931
|
-
|
|
932
|
-
this.text =
|
|
604
|
+
class xe extends d {
|
|
605
|
+
constructor(n, s) {
|
|
606
|
+
super(n);
|
|
607
|
+
i(this, "text");
|
|
608
|
+
this.text = s;
|
|
933
609
|
}
|
|
934
610
|
executeActionOnElement() {
|
|
935
|
-
var
|
|
936
|
-
|
|
937
|
-
if (!textIsEqual) {
|
|
611
|
+
var s;
|
|
612
|
+
if (!(((s = this.element) == null ? void 0 : s.innerText) === this.text))
|
|
938
613
|
throw new Error(`Text in element ${this.getElementName()} is not '${this.text}'`);
|
|
939
|
-
}
|
|
940
614
|
}
|
|
941
615
|
getDescription() {
|
|
942
616
|
return `Assert that text in ${this.getElementName()} is '${this.text}'`;
|
|
@@ -949,18 +623,16 @@ class AssertTextIsAction extends ActionOnElement {
|
|
|
949
623
|
};
|
|
950
624
|
}
|
|
951
625
|
}
|
|
952
|
-
class
|
|
953
|
-
constructor(
|
|
954
|
-
super(
|
|
955
|
-
|
|
956
|
-
this.text =
|
|
626
|
+
class Ae extends d {
|
|
627
|
+
constructor(n, s) {
|
|
628
|
+
super(n);
|
|
629
|
+
i(this, "text");
|
|
630
|
+
this.text = s;
|
|
957
631
|
}
|
|
958
632
|
executeActionOnElement() {
|
|
959
|
-
var
|
|
960
|
-
|
|
961
|
-
if (!containsText) {
|
|
633
|
+
var s;
|
|
634
|
+
if (!((s = this.element) == null ? void 0 : s.innerText.includes(this.text)))
|
|
962
635
|
throw new Error(`Text in element ${this.getElementName()} doesn't contain '${this.text}'`);
|
|
963
|
-
}
|
|
964
636
|
}
|
|
965
637
|
getDescription() {
|
|
966
638
|
return `Assert that ${this.getElementName()} contains '${this.text}'`;
|
|
@@ -973,17 +645,15 @@ class AssertContainsTextAction extends ActionOnElement {
|
|
|
973
645
|
};
|
|
974
646
|
}
|
|
975
647
|
}
|
|
976
|
-
class
|
|
977
|
-
constructor(
|
|
978
|
-
super(
|
|
979
|
-
|
|
980
|
-
this.value =
|
|
648
|
+
class Ce extends d {
|
|
649
|
+
constructor(n, s) {
|
|
650
|
+
super(n);
|
|
651
|
+
i(this, "value");
|
|
652
|
+
this.value = s;
|
|
981
653
|
}
|
|
982
654
|
executeActionOnElement() {
|
|
983
|
-
|
|
984
|
-
if (!valueIsEqual) {
|
|
655
|
+
if (!(this.element.value === this.value))
|
|
985
656
|
throw new Error(`Value in element ${this.getElementName()} is not '${this.value}'`);
|
|
986
|
-
}
|
|
987
657
|
}
|
|
988
658
|
getDescription() {
|
|
989
659
|
return `Assert that value in ${this.getElementName()} is '${this.value}'`;
|
|
@@ -996,15 +666,13 @@ class AssertValueIsAction extends ActionOnElement {
|
|
|
996
666
|
};
|
|
997
667
|
}
|
|
998
668
|
}
|
|
999
|
-
class
|
|
1000
|
-
constructor(
|
|
1001
|
-
super(
|
|
669
|
+
class ke extends d {
|
|
670
|
+
constructor(e) {
|
|
671
|
+
super(e);
|
|
1002
672
|
}
|
|
1003
673
|
executeActionOnElement() {
|
|
1004
|
-
|
|
1005
|
-
if (!exists) {
|
|
674
|
+
if (!!!this.element)
|
|
1006
675
|
throw new Error(`Element ${this.getElementName()} doesn't exist`);
|
|
1007
|
-
}
|
|
1008
676
|
}
|
|
1009
677
|
getDescription() {
|
|
1010
678
|
return `Assert that ${this.getElementName()} exists`;
|
|
@@ -1016,27 +684,21 @@ class AssertExistsAction extends ActionOnElement {
|
|
|
1016
684
|
};
|
|
1017
685
|
}
|
|
1018
686
|
}
|
|
1019
|
-
class
|
|
1020
|
-
constructor(
|
|
1021
|
-
super(
|
|
687
|
+
class Te extends d {
|
|
688
|
+
constructor(e) {
|
|
689
|
+
super(e);
|
|
1022
690
|
}
|
|
1023
691
|
async executeAction() {
|
|
1024
|
-
var
|
|
692
|
+
var e;
|
|
1025
693
|
try {
|
|
1026
|
-
this.element = await
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
this.executeActionOnElement();
|
|
1030
|
-
await AutomationInstance.uiUtils.hideCheckElementContainer();
|
|
1031
|
-
} catch (e) {
|
|
1032
|
-
throw Error(e.message);
|
|
694
|
+
this.element = await V(this, this.uiElement, 1e3, 5, !0), (e = this.element) == null || e.setAttribute("test-id", this.getElementName()), await c.uiUtils.checkElement(this.element, this.getElementName()), this.executeActionOnElement(), await c.uiUtils.hideCheckElementContainer();
|
|
695
|
+
} catch (n) {
|
|
696
|
+
throw Error(n.message);
|
|
1033
697
|
}
|
|
1034
698
|
}
|
|
1035
699
|
executeActionOnElement() {
|
|
1036
|
-
|
|
1037
|
-
if (exists) {
|
|
700
|
+
if (!!this.element)
|
|
1038
701
|
throw new Error(`Element ${this.getElementName()} was not expected to exist`);
|
|
1039
|
-
}
|
|
1040
702
|
}
|
|
1041
703
|
getDescription() {
|
|
1042
704
|
return `Assert that ${this.getElementName()} doesn't exist`;
|
|
@@ -1048,23 +710,18 @@ class AssertNotExistsAction extends ActionOnElement {
|
|
|
1048
710
|
};
|
|
1049
711
|
}
|
|
1050
712
|
}
|
|
1051
|
-
class
|
|
1052
|
-
constructor(
|
|
1053
|
-
super(
|
|
1054
|
-
|
|
1055
|
-
this.value =
|
|
713
|
+
class Se extends d {
|
|
714
|
+
constructor(n, s) {
|
|
715
|
+
super(n);
|
|
716
|
+
i(this, "value");
|
|
717
|
+
this.value = s;
|
|
1056
718
|
}
|
|
1057
719
|
executeActionOnElement() {
|
|
1058
|
-
var
|
|
1059
|
-
let
|
|
1060
|
-
if (((
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
throw new Error("Input element not found. Not able to type value in element " + this.getElementName());
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
inputElem.value = this.value;
|
|
1067
|
-
inputElem.dispatchEvent(new Event("change"));
|
|
720
|
+
var s, o, a, r;
|
|
721
|
+
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 = (r = this.element) == null ? void 0 : r.querySelectorAll("input")[0], !n))
|
|
723
|
+
throw new Error("Input element not found. Not able to type value in element " + this.getElementName());
|
|
724
|
+
n.value = this.value, n.dispatchEvent(new Event("change"));
|
|
1068
725
|
}
|
|
1069
726
|
getDescription() {
|
|
1070
727
|
return `Select value '${this.value}' in ${this.getElementName()}`;
|
|
@@ -1077,24 +734,18 @@ class SelectAction extends ActionOnElement {
|
|
|
1077
734
|
};
|
|
1078
735
|
}
|
|
1079
736
|
}
|
|
1080
|
-
class
|
|
1081
|
-
constructor(
|
|
1082
|
-
super(
|
|
1083
|
-
|
|
1084
|
-
this.value =
|
|
737
|
+
class ee extends d {
|
|
738
|
+
constructor(n, s) {
|
|
739
|
+
super(n);
|
|
740
|
+
i(this, "value");
|
|
741
|
+
this.value = s;
|
|
1085
742
|
}
|
|
1086
743
|
executeActionOnElement() {
|
|
1087
|
-
var
|
|
1088
|
-
let
|
|
1089
|
-
if (((
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
throw new Error("Input element not found. Not able to type value in element " + this.getElementName());
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
inputElem.value = this.value;
|
|
1096
|
-
inputElem.dispatchEvent(new Event("change"));
|
|
1097
|
-
inputElem.dispatchEvent(new Event("keyup"));
|
|
744
|
+
var s, o, a, r;
|
|
745
|
+
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 = (r = this.element) == null ? void 0 : r.querySelectorAll("input")[0], !n))
|
|
747
|
+
throw new Error("Input element not found. Not able to type value in element " + this.getElementName());
|
|
748
|
+
n.value = this.value, n.dispatchEvent(new Event("change")), n.dispatchEvent(new Event("keyup", { bubbles: !0 })), n.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
1098
749
|
}
|
|
1099
750
|
getDescription() {
|
|
1100
751
|
return `Type value '${this.value}' in ${this.getElementName()}`;
|
|
@@ -1107,23 +758,18 @@ class TypeAction extends ActionOnElement {
|
|
|
1107
758
|
};
|
|
1108
759
|
}
|
|
1109
760
|
}
|
|
1110
|
-
class
|
|
1111
|
-
constructor(
|
|
1112
|
-
super(
|
|
1113
|
-
|
|
1114
|
-
this.value =
|
|
761
|
+
class ve extends d {
|
|
762
|
+
constructor(n, s) {
|
|
763
|
+
super(n);
|
|
764
|
+
i(this, "value");
|
|
765
|
+
this.value = s;
|
|
1115
766
|
}
|
|
1116
767
|
executeActionOnElement() {
|
|
1117
|
-
var
|
|
1118
|
-
let
|
|
1119
|
-
if (((
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
throw new Error("Input element not found. Not able to type value in element " + this.getElementName());
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
inputElem.value = this.value;
|
|
1126
|
-
inputElem.dispatchEvent(new Event("change"));
|
|
768
|
+
var s, o, a, r;
|
|
769
|
+
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 = (r = this.element) == null ? void 0 : r.querySelectorAll("input")[0], !n))
|
|
771
|
+
throw new Error("Input element not found. Not able to type value in element " + this.getElementName());
|
|
772
|
+
n.value = this.value, n.dispatchEvent(new Event("change")), n.dispatchEvent(new Event("keyup", { bubbles: !0 })), n.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
1127
773
|
}
|
|
1128
774
|
getDescription() {
|
|
1129
775
|
return `Type a password in ${this.getElementName()}`;
|
|
@@ -1136,23 +782,23 @@ class TypePasswordAction extends ActionOnElement {
|
|
|
1136
782
|
};
|
|
1137
783
|
}
|
|
1138
784
|
}
|
|
1139
|
-
class
|
|
1140
|
-
constructor(
|
|
1141
|
-
super(
|
|
785
|
+
class Ne extends d {
|
|
786
|
+
constructor(e) {
|
|
787
|
+
super(e);
|
|
1142
788
|
}
|
|
1143
789
|
executeActionOnElement() {
|
|
1144
|
-
var
|
|
1145
|
-
(
|
|
790
|
+
var e;
|
|
791
|
+
(e = this.element) == null || e.dispatchEvent(
|
|
1146
792
|
new KeyboardEvent("keydown", {
|
|
1147
|
-
altKey:
|
|
793
|
+
altKey: !1,
|
|
1148
794
|
code: "Escape",
|
|
1149
|
-
ctrlKey:
|
|
1150
|
-
isComposing:
|
|
795
|
+
ctrlKey: !1,
|
|
796
|
+
isComposing: !1,
|
|
1151
797
|
key: "Escape",
|
|
1152
798
|
location: 0,
|
|
1153
|
-
metaKey:
|
|
1154
|
-
repeat:
|
|
1155
|
-
shiftKey:
|
|
799
|
+
metaKey: !1,
|
|
800
|
+
repeat: !1,
|
|
801
|
+
shiftKey: !1,
|
|
1156
802
|
which: 27,
|
|
1157
803
|
charCode: 0,
|
|
1158
804
|
keyCode: 27
|
|
@@ -1169,23 +815,23 @@ class PressEscKeyAction extends ActionOnElement {
|
|
|
1169
815
|
};
|
|
1170
816
|
}
|
|
1171
817
|
}
|
|
1172
|
-
class
|
|
1173
|
-
constructor(
|
|
1174
|
-
super(
|
|
818
|
+
class be extends d {
|
|
819
|
+
constructor(e) {
|
|
820
|
+
super(e);
|
|
1175
821
|
}
|
|
1176
822
|
executeActionOnElement() {
|
|
1177
|
-
var
|
|
1178
|
-
(
|
|
823
|
+
var e;
|
|
824
|
+
(e = this.element) == null || e.dispatchEvent(
|
|
1179
825
|
new KeyboardEvent("keyup", {
|
|
1180
|
-
altKey:
|
|
826
|
+
altKey: !1,
|
|
1181
827
|
code: "Down",
|
|
1182
|
-
ctrlKey:
|
|
1183
|
-
isComposing:
|
|
828
|
+
ctrlKey: !1,
|
|
829
|
+
isComposing: !1,
|
|
1184
830
|
key: "Down",
|
|
1185
831
|
location: 0,
|
|
1186
|
-
metaKey:
|
|
1187
|
-
repeat:
|
|
1188
|
-
shiftKey:
|
|
832
|
+
metaKey: !1,
|
|
833
|
+
repeat: !1,
|
|
834
|
+
shiftKey: !1,
|
|
1189
835
|
which: 40,
|
|
1190
836
|
charCode: 0,
|
|
1191
837
|
keyCode: 40
|
|
@@ -1202,23 +848,23 @@ class PressDownKeyAction extends ActionOnElement {
|
|
|
1202
848
|
};
|
|
1203
849
|
}
|
|
1204
850
|
}
|
|
1205
|
-
class
|
|
1206
|
-
constructor(
|
|
1207
|
-
super(
|
|
851
|
+
class Ie extends d {
|
|
852
|
+
constructor(e) {
|
|
853
|
+
super(e);
|
|
1208
854
|
}
|
|
1209
855
|
executeActionOnElement() {
|
|
1210
|
-
var
|
|
1211
|
-
(
|
|
856
|
+
var e;
|
|
857
|
+
(e = this.element) == null || e.dispatchEvent(
|
|
1212
858
|
new KeyboardEvent("keydown", {
|
|
1213
|
-
altKey:
|
|
859
|
+
altKey: !1,
|
|
1214
860
|
code: "Tab",
|
|
1215
|
-
ctrlKey:
|
|
1216
|
-
isComposing:
|
|
861
|
+
ctrlKey: !1,
|
|
862
|
+
isComposing: !1,
|
|
1217
863
|
key: "Tab",
|
|
1218
864
|
location: 0,
|
|
1219
|
-
metaKey:
|
|
1220
|
-
repeat:
|
|
1221
|
-
shiftKey:
|
|
865
|
+
metaKey: !1,
|
|
866
|
+
repeat: !1,
|
|
867
|
+
shiftKey: !1,
|
|
1222
868
|
which: 9,
|
|
1223
869
|
charCode: 0,
|
|
1224
870
|
keyCode: 9
|
|
@@ -1235,35 +881,108 @@ class PressTabKeyAction extends ActionOnElement {
|
|
|
1235
881
|
};
|
|
1236
882
|
}
|
|
1237
883
|
}
|
|
1238
|
-
class
|
|
1239
|
-
constructor(
|
|
1240
|
-
super(
|
|
1241
|
-
__publicField(this, "file");
|
|
1242
|
-
this.file = file;
|
|
884
|
+
class Oe extends d {
|
|
885
|
+
constructor(e) {
|
|
886
|
+
super(e);
|
|
1243
887
|
}
|
|
1244
888
|
executeActionOnElement() {
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
889
|
+
var e;
|
|
890
|
+
(e = this.element) == null || e.dispatchEvent(
|
|
891
|
+
new KeyboardEvent("keydown", {
|
|
892
|
+
altKey: !1,
|
|
893
|
+
code: "Enter",
|
|
894
|
+
ctrlKey: !1,
|
|
895
|
+
isComposing: !1,
|
|
896
|
+
key: "Enter",
|
|
897
|
+
location: 0,
|
|
898
|
+
metaKey: !1,
|
|
899
|
+
repeat: !1,
|
|
900
|
+
shiftKey: !1,
|
|
901
|
+
which: 13,
|
|
902
|
+
charCode: 0,
|
|
903
|
+
keyCode: 13
|
|
904
|
+
})
|
|
905
|
+
);
|
|
906
|
+
}
|
|
907
|
+
getDescription() {
|
|
908
|
+
return `Press Enter key in ${this.getElementName()}`;
|
|
909
|
+
}
|
|
910
|
+
getJSON() {
|
|
911
|
+
return {
|
|
912
|
+
...super.getJSON(),
|
|
913
|
+
type: "PressEnterKey"
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
var De = /* @__PURE__ */ ((t) => (t.ESCAPE = "Escape", t.ENTER = "Enter", t.TAB = "Tab", t.ARROW_DOWN = "ArrowDown", t.ARROW_UP = "ArrowUp", t.ARROW_LEFT = "ArrowLeft", t.ARROW_RIGHT = "ArrowRight", t.BACKSPACE = "Backspace", t.DELETE = "Delete", t.SHIFT = "Shift", t.CONTROL = "Control", t.ALT = "Alt", t.META = "Meta", t))(De || {});
|
|
918
|
+
const j = {
|
|
919
|
+
Escape: 27,
|
|
920
|
+
Enter: 13,
|
|
921
|
+
Tab: 9,
|
|
922
|
+
ArrowDown: 40,
|
|
923
|
+
ArrowUp: 38,
|
|
924
|
+
ArrowLeft: 37,
|
|
925
|
+
ArrowRight: 39,
|
|
926
|
+
Backspace: 8,
|
|
927
|
+
Delete: 46,
|
|
928
|
+
Shift: 16,
|
|
929
|
+
Control: 17,
|
|
930
|
+
Alt: 18,
|
|
931
|
+
Meta: 91
|
|
932
|
+
};
|
|
933
|
+
class Le extends d {
|
|
934
|
+
constructor(n, s) {
|
|
935
|
+
super(n);
|
|
936
|
+
i(this, "key");
|
|
937
|
+
this.key = s;
|
|
938
|
+
}
|
|
939
|
+
executeActionOnElement() {
|
|
940
|
+
var n;
|
|
941
|
+
(n = this.element) == null || n.dispatchEvent(
|
|
942
|
+
new KeyboardEvent("keydown", {
|
|
943
|
+
key: this.key,
|
|
944
|
+
code: this.key,
|
|
945
|
+
keyCode: j[this.key],
|
|
946
|
+
charCode: 0,
|
|
947
|
+
which: j[this.key],
|
|
948
|
+
altKey: !1,
|
|
949
|
+
ctrlKey: !1,
|
|
950
|
+
metaKey: !1,
|
|
951
|
+
shiftKey: !1,
|
|
952
|
+
isComposing: !1,
|
|
953
|
+
location: 0,
|
|
954
|
+
repeat: !1
|
|
955
|
+
})
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
getDescription() {
|
|
959
|
+
return `Press ${this.key} key in ${this.getElementName()}`;
|
|
960
|
+
}
|
|
961
|
+
getJSON() {
|
|
962
|
+
return {
|
|
963
|
+
...super.getJSON(),
|
|
964
|
+
type: "PressKey",
|
|
965
|
+
key: this.key
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
class Pe extends d {
|
|
970
|
+
constructor(n, s) {
|
|
971
|
+
super(n);
|
|
972
|
+
i(this, "file");
|
|
973
|
+
this.file = s;
|
|
974
|
+
}
|
|
975
|
+
executeActionOnElement() {
|
|
976
|
+
const n = this.element, s = new DataTransfer();
|
|
977
|
+
s.items.add(this.file);
|
|
978
|
+
const o = s.files;
|
|
979
|
+
n.files = o, n.dispatchEvent(new Event("change"));
|
|
980
|
+
function a(l) {
|
|
981
|
+
var E;
|
|
982
|
+
return l != null && l.parentElement ? ((E = l.parentElement) == null ? void 0 : E.tagName.toLowerCase()) === "form" ? l.parentElement : a(l.parentElement) : null;
|
|
1266
983
|
}
|
|
984
|
+
const r = a(n);
|
|
985
|
+
r && r.dispatchEvent(new Event("change"));
|
|
1267
986
|
}
|
|
1268
987
|
getDescription() {
|
|
1269
988
|
return `Upload file in ${this.getElementName()}`;
|
|
@@ -1275,24 +994,20 @@ class UploadFileAction extends ActionOnElement {
|
|
|
1275
994
|
};
|
|
1276
995
|
}
|
|
1277
996
|
}
|
|
1278
|
-
class
|
|
1279
|
-
constructor(
|
|
1280
|
-
super(
|
|
1281
|
-
|
|
1282
|
-
this.memorySlotName =
|
|
997
|
+
class $e extends d {
|
|
998
|
+
constructor(n, s) {
|
|
999
|
+
super(n);
|
|
1000
|
+
i(this, "memorySlotName");
|
|
1001
|
+
this.memorySlotName = s;
|
|
1283
1002
|
}
|
|
1284
1003
|
executeActionOnElement() {
|
|
1285
|
-
var
|
|
1286
|
-
let
|
|
1287
|
-
if (((
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
throw new Error("Input element not found. Not able to save value from element " + this.getElementName());
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
AutomationEvents.dispatch(EVENT_NAMES.SAVE_VALUE, {
|
|
1004
|
+
var s, o, a, r;
|
|
1005
|
+
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 = (r = this.element) == null ? void 0 : r.querySelectorAll("input")[0], !n))
|
|
1007
|
+
throw new Error("Input element not found. Not able to save value from element " + this.getElementName());
|
|
1008
|
+
m.dispatch(v.SAVE_VALUE, {
|
|
1294
1009
|
memorySlotName: this.memorySlotName,
|
|
1295
|
-
value:
|
|
1010
|
+
value: n.value
|
|
1296
1011
|
});
|
|
1297
1012
|
}
|
|
1298
1013
|
getDescription() {
|
|
@@ -1306,11 +1021,11 @@ class SaveValueAction extends ActionOnElement {
|
|
|
1306
1021
|
};
|
|
1307
1022
|
}
|
|
1308
1023
|
}
|
|
1309
|
-
class
|
|
1310
|
-
constructor(
|
|
1024
|
+
class Ue extends y {
|
|
1025
|
+
constructor(n) {
|
|
1311
1026
|
super();
|
|
1312
|
-
|
|
1313
|
-
this.miliseconds =
|
|
1027
|
+
i(this, "miliseconds");
|
|
1028
|
+
this.miliseconds = n;
|
|
1314
1029
|
}
|
|
1315
1030
|
getDescription() {
|
|
1316
1031
|
return "Wait " + this.miliseconds + " miliseconds";
|
|
@@ -1322,31 +1037,30 @@ class WaitAction extends AbstractAction {
|
|
|
1322
1037
|
};
|
|
1323
1038
|
}
|
|
1324
1039
|
async executeAction() {
|
|
1325
|
-
await
|
|
1040
|
+
await f(this.miliseconds);
|
|
1326
1041
|
}
|
|
1327
1042
|
resetAction() {
|
|
1328
1043
|
}
|
|
1329
1044
|
}
|
|
1330
|
-
class
|
|
1331
|
-
constructor(
|
|
1045
|
+
class Re extends y {
|
|
1046
|
+
constructor(n) {
|
|
1332
1047
|
super();
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
this.uiElement =
|
|
1336
|
-
this.tries = 0;
|
|
1048
|
+
i(this, "uiElement");
|
|
1049
|
+
i(this, "tries");
|
|
1050
|
+
this.uiElement = n, this.tries = 0;
|
|
1337
1051
|
}
|
|
1338
|
-
updateTries(
|
|
1339
|
-
this.tries =
|
|
1052
|
+
updateTries(n) {
|
|
1053
|
+
this.tries = n;
|
|
1340
1054
|
}
|
|
1341
1055
|
resetAction() {
|
|
1342
1056
|
this.tries = 0;
|
|
1343
1057
|
}
|
|
1344
1058
|
getElementName() {
|
|
1345
|
-
var
|
|
1346
|
-
return (
|
|
1059
|
+
var n;
|
|
1060
|
+
return (n = this.uiElement) == null ? void 0 : n.getElementName();
|
|
1347
1061
|
}
|
|
1348
1062
|
async executeAction() {
|
|
1349
|
-
await
|
|
1063
|
+
await V(this, this.uiElement, 1e3, 10, !0);
|
|
1350
1064
|
}
|
|
1351
1065
|
getDescription() {
|
|
1352
1066
|
return "Wait until " + this.getElementName() + " is removed";
|
|
@@ -1358,7 +1072,7 @@ class WaitUntilElementRemovedAction extends AbstractAction {
|
|
|
1358
1072
|
};
|
|
1359
1073
|
}
|
|
1360
1074
|
}
|
|
1361
|
-
class
|
|
1075
|
+
class Je extends y {
|
|
1362
1076
|
constructor() {
|
|
1363
1077
|
super();
|
|
1364
1078
|
}
|
|
@@ -1372,16 +1086,16 @@ class PauseAction extends AbstractAction {
|
|
|
1372
1086
|
};
|
|
1373
1087
|
}
|
|
1374
1088
|
async executeAction() {
|
|
1375
|
-
await
|
|
1089
|
+
await c.pause();
|
|
1376
1090
|
}
|
|
1377
1091
|
resetAction() {
|
|
1378
1092
|
}
|
|
1379
1093
|
}
|
|
1380
|
-
class
|
|
1381
|
-
constructor(
|
|
1094
|
+
class Ve extends y {
|
|
1095
|
+
constructor(n) {
|
|
1382
1096
|
super();
|
|
1383
|
-
|
|
1384
|
-
this.description =
|
|
1097
|
+
i(this, "description");
|
|
1098
|
+
this.description = n;
|
|
1385
1099
|
}
|
|
1386
1100
|
getDescription() {
|
|
1387
1101
|
return "Manual Step: " + this.description;
|
|
@@ -1393,22 +1107,14 @@ class ManualAction extends AbstractAction {
|
|
|
1393
1107
|
};
|
|
1394
1108
|
}
|
|
1395
1109
|
async executeAction() {
|
|
1396
|
-
await
|
|
1397
|
-
|
|
1398
|
-
AutomationEvents.on(EVENT_NAMES.USER_ACCEPT, async () => {
|
|
1399
|
-
await AutomationInstance.uiUtils.hideAlert();
|
|
1400
|
-
return resolve(true);
|
|
1401
|
-
});
|
|
1402
|
-
AutomationEvents.on(EVENT_NAMES.USER_REJECT, async () => {
|
|
1403
|
-
await AutomationInstance.uiUtils.hideAlert();
|
|
1404
|
-
return reject();
|
|
1405
|
-
});
|
|
1110
|
+
return await c.uiUtils.showAlert("Waiting manual step..."), new Promise((n, s) => {
|
|
1111
|
+
m.on(v.USER_ACCEPT, async () => (await c.uiUtils.hideAlert(), n(!0))), m.on(v.USER_REJECT, async () => (await c.uiUtils.hideAlert(), s()));
|
|
1406
1112
|
});
|
|
1407
1113
|
}
|
|
1408
1114
|
resetAction() {
|
|
1409
1115
|
}
|
|
1410
1116
|
}
|
|
1411
|
-
class
|
|
1117
|
+
class Ke extends y {
|
|
1412
1118
|
constructor() {
|
|
1413
1119
|
super();
|
|
1414
1120
|
}
|
|
@@ -1427,338 +1133,217 @@ class ReloadPageAction extends AbstractAction {
|
|
|
1427
1133
|
resetAction() {
|
|
1428
1134
|
}
|
|
1429
1135
|
}
|
|
1430
|
-
const
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
const
|
|
1435
|
-
return
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1136
|
+
const J = (t) => t.toLocaleDateString("en-US", { year: "numeric", month: "2-digit", day: "2-digit" }), K = (t) => {
|
|
1137
|
+
const e = /* @__PURE__ */ new Date();
|
|
1138
|
+
return J(new Date(e.setDate(e.getDate() + t)));
|
|
1139
|
+
}, te = (t) => {
|
|
1140
|
+
const e = /* @__PURE__ */ new Date();
|
|
1141
|
+
return J(new Date(e.setMonth(e.getMonth() + t)));
|
|
1142
|
+
}, Fe = K(1), Me = K(-1), We = K(7), qe = K(-7), Be = te(1), He = te(-1), ht = {
|
|
1143
|
+
formatDate: J,
|
|
1144
|
+
today: J(/* @__PURE__ */ new Date()),
|
|
1145
|
+
tomorrow: Fe,
|
|
1146
|
+
nextWeek: We,
|
|
1147
|
+
nextMonth: Be,
|
|
1148
|
+
yesterday: Me,
|
|
1149
|
+
lastWeek: qe,
|
|
1150
|
+
lastMonth: He
|
|
1440
1151
|
};
|
|
1441
|
-
|
|
1442
|
-
const yesterday = setDateFromToday(-1);
|
|
1443
|
-
const nextWeek = setDateFromToday(7);
|
|
1444
|
-
const lastWeek = setDateFromToday(-7);
|
|
1445
|
-
const nextMonth = setMonthFromToday(1);
|
|
1446
|
-
const lastMonth = setMonthFromToday(-1);
|
|
1447
|
-
const DateUtils = {
|
|
1448
|
-
formatDate,
|
|
1449
|
-
today: formatDate(/* @__PURE__ */ new Date()),
|
|
1450
|
-
tomorrow,
|
|
1451
|
-
nextWeek,
|
|
1452
|
-
nextMonth,
|
|
1453
|
-
yesterday,
|
|
1454
|
-
lastWeek,
|
|
1455
|
-
lastMonth
|
|
1456
|
-
};
|
|
1457
|
-
class Logger {
|
|
1152
|
+
class je {
|
|
1458
1153
|
constructor() {
|
|
1459
|
-
|
|
1154
|
+
i(this, "enabled", !1);
|
|
1460
1155
|
}
|
|
1461
|
-
setEnabled(
|
|
1462
|
-
this.enabled =
|
|
1156
|
+
setEnabled(e) {
|
|
1157
|
+
this.enabled = e;
|
|
1463
1158
|
}
|
|
1464
|
-
log(...
|
|
1465
|
-
|
|
1466
|
-
console.log("[tomation]", ...args);
|
|
1467
|
-
}
|
|
1159
|
+
log(...e) {
|
|
1160
|
+
this.enabled && console.log("[tomation]", ...e);
|
|
1468
1161
|
}
|
|
1469
|
-
groupCollapsed(...
|
|
1470
|
-
|
|
1471
|
-
console.groupCollapsed("[tomation]", ...args);
|
|
1472
|
-
}
|
|
1162
|
+
groupCollapsed(...e) {
|
|
1163
|
+
this.enabled && console.groupCollapsed("[tomation]", ...e);
|
|
1473
1164
|
}
|
|
1474
1165
|
groupEnd() {
|
|
1475
|
-
|
|
1476
|
-
console.groupEnd();
|
|
1477
|
-
}
|
|
1166
|
+
this.enabled && console.groupEnd();
|
|
1478
1167
|
}
|
|
1479
|
-
error(...
|
|
1480
|
-
|
|
1481
|
-
console.error("[tomation]", ...args);
|
|
1482
|
-
}
|
|
1168
|
+
error(...e) {
|
|
1169
|
+
this.enabled && console.error("[tomation]", ...e);
|
|
1483
1170
|
}
|
|
1484
1171
|
}
|
|
1485
|
-
const
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
const
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
action.
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
logger.log("Add action: ", action.getDescription());
|
|
1498
|
-
_AutomationCompiler.currentAction.addStep(action);
|
|
1499
|
-
}
|
|
1500
|
-
static init(startAction) {
|
|
1501
|
-
_AutomationCompiler.currentAction = startAction;
|
|
1502
|
-
_AutomationCompiler.isCompiling = true;
|
|
1503
|
-
logger.groupCollapsed("Compile: " + startAction.getDescription());
|
|
1504
|
-
startAction.compileSteps();
|
|
1505
|
-
_AutomationCompiler.isCompiling = false;
|
|
1506
|
-
logger.log("Compilation finished");
|
|
1507
|
-
logger.groupEnd();
|
|
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();
|
|
1508
1184
|
}
|
|
1509
1185
|
};
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
EVENT_NAMES2["ACTION_UPDATE"] = "tomation-action-update";
|
|
1515
|
-
EVENT_NAMES2["SAVE_VALUE"] = "tomation-save-value";
|
|
1516
|
-
EVENT_NAMES2["REGISTER_TEST"] = "tomation-register-test";
|
|
1517
|
-
EVENT_NAMES2["TEST_STARTED"] = "tomation-test-started";
|
|
1518
|
-
EVENT_NAMES2["TEST_PASSED"] = "tomation-test-passed";
|
|
1519
|
-
EVENT_NAMES2["TEST_FAILED"] = "tomation-test-failed";
|
|
1520
|
-
EVENT_NAMES2["TEST_END"] = "tomation-test-end";
|
|
1521
|
-
EVENT_NAMES2["TEST_STOP"] = "tomation-test-stop";
|
|
1522
|
-
EVENT_NAMES2["USER_ACCEPT"] = "tomation-user-accept";
|
|
1523
|
-
EVENT_NAMES2["USER_REJECT"] = "tomation-user-reject";
|
|
1524
|
-
return EVENT_NAMES2;
|
|
1525
|
-
})(EVENT_NAMES || {});
|
|
1526
|
-
class EventDispatcher {
|
|
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 {
|
|
1527
1190
|
constructor() {
|
|
1528
|
-
|
|
1191
|
+
i(this, "events");
|
|
1529
1192
|
this.events = /* @__PURE__ */ new Map();
|
|
1530
1193
|
}
|
|
1531
|
-
on(
|
|
1532
|
-
var
|
|
1533
|
-
|
|
1534
|
-
this.events.set(eventName, []);
|
|
1535
|
-
}
|
|
1536
|
-
(_a = this.events.get(eventName)) == null ? void 0 : _a.push(callback);
|
|
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);
|
|
1537
1197
|
}
|
|
1538
|
-
off(
|
|
1539
|
-
var
|
|
1540
|
-
|
|
1541
|
-
this.events.set(eventName, ((_a = this.events.get(eventName)) == null ? void 0 : _a.filter((cb) => cb !== callback)) || []);
|
|
1542
|
-
}
|
|
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)) || []);
|
|
1543
1201
|
}
|
|
1544
|
-
dispatch(
|
|
1545
|
-
var
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
callback(data);
|
|
1550
|
-
});
|
|
1551
|
-
}
|
|
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
|
+
}));
|
|
1552
1207
|
}
|
|
1553
1208
|
}
|
|
1554
|
-
const
|
|
1555
|
-
var
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
static async start(startAction) {
|
|
1563
|
-
if (_AutomationRunner.running) {
|
|
1564
|
-
logger.error("Not able to run test while other test is running.");
|
|
1565
|
-
throw new Error("Not able to run test while other test is running.");
|
|
1566
|
-
}
|
|
1567
|
-
_AutomationRunner.running = true;
|
|
1568
|
-
AutomationInstance.status = "Playing";
|
|
1569
|
-
AutomationInstance.runMode = "Normal";
|
|
1570
|
-
logger.groupCollapsed("Start Action: ", startAction.getDescription());
|
|
1571
|
-
AutomationEvents.dispatch("tomation-test-started", {
|
|
1572
|
-
action: startAction == null ? void 0 : startAction.getJSON()
|
|
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()
|
|
1573
1217
|
});
|
|
1574
1218
|
try {
|
|
1575
|
-
await (
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
AutomationEvents.dispatch("tomation-test-failed", { id: startAction.name });
|
|
1579
|
-
AutomationInstance.uiUtils.hideCheckElementContainer();
|
|
1580
|
-
logger.error(`🤖 Error running task ${startAction.getDescription()}. Reason: ${e.message}`);
|
|
1581
|
-
throw e;
|
|
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;
|
|
1582
1222
|
} finally {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
AutomationEvents.dispatch("tomation-test-end", {
|
|
1586
|
-
action: startAction == null ? void 0 : startAction.getJSON()
|
|
1223
|
+
u.groupEnd(), S.running = !1, m.dispatch("tomation-test-end", {
|
|
1224
|
+
action: e == null ? void 0 : e.getJSON()
|
|
1587
1225
|
});
|
|
1588
1226
|
}
|
|
1589
1227
|
}
|
|
1590
1228
|
};
|
|
1591
|
-
|
|
1592
|
-
let
|
|
1593
|
-
const
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
console.log(`Compiled Test: ${id}`);
|
|
1599
|
-
AutomationEvents.dispatch("tomation-register-test", { id, action: action.getJSON() });
|
|
1600
|
-
console.log(`Registered Test: ${id} in TestsMap`);
|
|
1601
|
-
TestsMap[id] = () => {
|
|
1602
|
-
AutomationRunner.start(action);
|
|
1603
|
-
};
|
|
1604
|
-
};
|
|
1605
|
-
const RunTest = (id) => {
|
|
1606
|
-
if (!TestsMap[id]) {
|
|
1607
|
-
console.log("Available Tests:", Object.keys(TestsMap));
|
|
1608
|
-
throw new Error(`Test with id ${id} not found.`);
|
|
1609
|
-
} else {
|
|
1610
|
-
TestsMap[id]();
|
|
1611
|
-
}
|
|
1612
|
-
};
|
|
1613
|
-
const Task = (id, steps) => {
|
|
1614
|
-
return async (params) => {
|
|
1615
|
-
const action = new Action(id, steps);
|
|
1616
|
-
action.setParams(params);
|
|
1617
|
-
if (!AutomationRunner.running && !AutomationCompiler.isCompiling) {
|
|
1618
|
-
try {
|
|
1619
|
-
logger.log(`Compilation of Task ${id} starts...`);
|
|
1620
|
-
AutomationCompiler.init(action);
|
|
1621
|
-
logger.log(`Compilation of Task ${id} Finished.`);
|
|
1622
|
-
logger.log(`Start running Task ${id}...`);
|
|
1623
|
-
await AutomationRunner.start(action);
|
|
1624
|
-
logger.log(`End of Task ${id}: SUCCESS`);
|
|
1625
|
-
} catch (e) {
|
|
1626
|
-
logger.error("Error running task " + id + ". " + e.message);
|
|
1627
|
-
}
|
|
1628
|
-
} else {
|
|
1629
|
-
logger.log(`Adding action ${id} to compilation stack`);
|
|
1630
|
-
AutomationCompiler.addAction(action);
|
|
1631
|
-
AutomationCompiler.compileAction(action);
|
|
1632
|
-
}
|
|
1633
|
-
};
|
|
1634
|
-
};
|
|
1635
|
-
const Click = (uiElement) => {
|
|
1636
|
-
const action = new ClickAction(uiElement);
|
|
1637
|
-
AutomationCompiler.addAction(action);
|
|
1638
|
-
};
|
|
1639
|
-
const Assert = (uiElement) => {
|
|
1640
|
-
return {
|
|
1641
|
-
textIs: (text) => {
|
|
1642
|
-
AutomationCompiler.addAction(new AssertTextIsAction(uiElement, text));
|
|
1643
|
-
},
|
|
1644
|
-
containsText: (text) => {
|
|
1645
|
-
AutomationCompiler.addAction(new AssertContainsTextAction(uiElement, text));
|
|
1646
|
-
},
|
|
1647
|
-
valueIs: (value) => {
|
|
1648
|
-
AutomationCompiler.addAction(new AssertValueIsAction(uiElement, value));
|
|
1649
|
-
},
|
|
1650
|
-
exists: () => {
|
|
1651
|
-
AutomationCompiler.addAction(new AssertExistsAction(uiElement));
|
|
1652
|
-
},
|
|
1653
|
-
notExists: () => {
|
|
1654
|
-
AutomationCompiler.addAction(new AssertNotExistsAction(uiElement));
|
|
1655
|
-
}
|
|
1656
|
-
};
|
|
1657
|
-
};
|
|
1658
|
-
const Select = (value) => {
|
|
1659
|
-
return {
|
|
1660
|
-
in: (uiElement) => {
|
|
1661
|
-
const action = new SelectAction(uiElement, value);
|
|
1662
|
-
AutomationCompiler.addAction(action);
|
|
1663
|
-
}
|
|
1664
|
-
};
|
|
1665
|
-
};
|
|
1666
|
-
const Type = (value) => {
|
|
1667
|
-
return {
|
|
1668
|
-
in: (uiElement) => {
|
|
1669
|
-
const action = new TypeAction(uiElement, value);
|
|
1670
|
-
AutomationCompiler.addAction(action);
|
|
1671
|
-
}
|
|
1672
|
-
};
|
|
1673
|
-
};
|
|
1674
|
-
const ClearValue = () => {
|
|
1675
|
-
return {
|
|
1676
|
-
in: (uiElement) => {
|
|
1677
|
-
const action = new TypeAction(uiElement, "");
|
|
1678
|
-
AutomationCompiler.addAction(action);
|
|
1679
|
-
}
|
|
1680
|
-
};
|
|
1681
|
-
};
|
|
1682
|
-
const PressEscKey = () => {
|
|
1683
|
-
return {
|
|
1684
|
-
in: (uiElement) => {
|
|
1685
|
-
AutomationCompiler.addAction(new PressEscKeyAction(uiElement));
|
|
1686
|
-
}
|
|
1687
|
-
};
|
|
1688
|
-
};
|
|
1689
|
-
const PressDownKey = () => {
|
|
1690
|
-
return {
|
|
1691
|
-
in: (uiElement) => {
|
|
1692
|
-
AutomationCompiler.addAction(new PressDownKeyAction(uiElement));
|
|
1693
|
-
}
|
|
1694
|
-
};
|
|
1695
|
-
};
|
|
1696
|
-
const PressTabKey = () => {
|
|
1697
|
-
return {
|
|
1698
|
-
in: (uiElement) => {
|
|
1699
|
-
AutomationCompiler.addAction(new PressTabKeyAction(uiElement));
|
|
1700
|
-
}
|
|
1701
|
-
};
|
|
1702
|
-
};
|
|
1703
|
-
const TypePassword = (value) => {
|
|
1704
|
-
return {
|
|
1705
|
-
in: (uiElement) => {
|
|
1706
|
-
const action = new TypePasswordAction(uiElement, value);
|
|
1707
|
-
AutomationCompiler.addAction(action);
|
|
1708
|
-
}
|
|
1709
|
-
};
|
|
1710
|
-
};
|
|
1711
|
-
const UploadFile = (file) => {
|
|
1712
|
-
return {
|
|
1713
|
-
in: (uiElement) => {
|
|
1714
|
-
const action = new UploadFileAction(uiElement, file);
|
|
1715
|
-
AutomationCompiler.addAction(action);
|
|
1716
|
-
}
|
|
1717
|
-
};
|
|
1718
|
-
};
|
|
1719
|
-
const SaveValue = (uiElement) => {
|
|
1720
|
-
return {
|
|
1721
|
-
in: (memorySlotName) => {
|
|
1722
|
-
const action = new SaveValueAction(uiElement, memorySlotName);
|
|
1723
|
-
AutomationCompiler.addAction(action);
|
|
1724
|
-
}
|
|
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);
|
|
1725
1236
|
};
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1237
|
+
}, Ge = (t) => {
|
|
1238
|
+
if (U[t])
|
|
1239
|
+
U[t]();
|
|
1240
|
+
else
|
|
1241
|
+
throw console.log("Available Tests:", Object.keys(U)), new Error(`Test with id ${t} not found.`);
|
|
1242
|
+
}, pt = (t, e) => async (n) => {
|
|
1243
|
+
const s = new _(t, e);
|
|
1244
|
+
if (s.setParams(n), !O.running && !h.isCompiling)
|
|
1245
|
+
try {
|
|
1246
|
+
u.log(`Compilation of Task ${t} starts...`), h.init(s), u.log(`Compilation of Task ${t} Finished.`), u.log(`Start running Task ${t}...`), await O.start(s), u.log(`End of Task ${t}: SUCCESS`);
|
|
1247
|
+
} catch (o) {
|
|
1248
|
+
u.error("Error running task " + t + ". " + o.message);
|
|
1734
1249
|
}
|
|
1735
|
-
|
|
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));
|
|
1736
1323
|
};
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
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());
|
|
1745
1335
|
};
|
|
1746
|
-
class
|
|
1747
|
-
constructor(
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
this._document =
|
|
1757
|
-
this.debug = true;
|
|
1758
|
-
this._uiUtils = new UIUtils(window2);
|
|
1759
|
-
this.speed = 1e3;
|
|
1760
|
-
this.status = "Stopped";
|
|
1761
|
-
this.runMode = "Normal";
|
|
1336
|
+
class Ze {
|
|
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";
|
|
1762
1347
|
}
|
|
1763
1348
|
get document() {
|
|
1764
1349
|
return this._document;
|
|
@@ -1779,200 +1364,161 @@ class Automation {
|
|
|
1779
1364
|
return this.status == "Paused";
|
|
1780
1365
|
}
|
|
1781
1366
|
pause() {
|
|
1782
|
-
|
|
1783
|
-
|
|
1367
|
+
u.log("Pause Test"), this.status = "Paused", m.dispatch(
|
|
1368
|
+
"tomation-test-pause"
|
|
1369
|
+
/* TEST_PAUSE */
|
|
1370
|
+
);
|
|
1784
1371
|
}
|
|
1785
1372
|
continue() {
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
logger.log("Continue: Executing current action callback");
|
|
1791
|
-
this.currentActionCallback(this.currentAction);
|
|
1792
|
-
this.currentActionCallback = void 0;
|
|
1793
|
-
}
|
|
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);
|
|
1794
1377
|
}
|
|
1795
1378
|
next() {
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
logger.log("Next: Executing current action callback");
|
|
1801
|
-
this.currentActionCallback(this.currentAction);
|
|
1802
|
-
this.currentActionCallback = void 0;
|
|
1803
|
-
}
|
|
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);
|
|
1804
1383
|
}
|
|
1805
1384
|
stop() {
|
|
1806
|
-
|
|
1807
|
-
this.status = "Stopped";
|
|
1808
|
-
if (this.currentActionCallback && this.currentAction) {
|
|
1809
|
-
logger.log("Stop: Executing current action callback");
|
|
1810
|
-
this.currentActionCallback(this.currentAction);
|
|
1811
|
-
this.currentActionCallback = void 0;
|
|
1812
|
-
}
|
|
1813
|
-
AutomationEvents.dispatch(
|
|
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(
|
|
1814
1386
|
"tomation-test-stop"
|
|
1815
1387
|
/* TEST_STOP */
|
|
1816
1388
|
);
|
|
1817
1389
|
}
|
|
1818
1390
|
retryAction() {
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
logger.log("Retry: Resetting tries for current action");
|
|
1824
|
-
this.currentAction.resetTries();
|
|
1825
|
-
}
|
|
1826
|
-
logger.log("Retry: Executing current action callback");
|
|
1827
|
-
this.currentActionCallback(this.currentAction);
|
|
1828
|
-
this.currentActionCallback = void 0;
|
|
1829
|
-
}
|
|
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);
|
|
1830
1395
|
}
|
|
1831
1396
|
skipAction() {
|
|
1832
|
-
|
|
1833
|
-
this.status = "Playing";
|
|
1834
|
-
if (this.currentActionCallback && this.currentAction) {
|
|
1835
|
-
this.currentAction.status = ACTION_STATUS.SKIPPED;
|
|
1836
|
-
logger.log("Skip: Marked current action as SKIPPED");
|
|
1837
|
-
AbstractAction.notifyActionUpdated(this.currentAction);
|
|
1838
|
-
logger.log("Skip: Executing current action callback");
|
|
1839
|
-
this.currentActionCallback(this.currentAction);
|
|
1840
|
-
this.currentActionCallback = void 0;
|
|
1841
|
-
}
|
|
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);
|
|
1842
1398
|
}
|
|
1843
|
-
saveCurrentAction(
|
|
1844
|
-
|
|
1845
|
-
this.currentActionCallback = callback;
|
|
1846
|
-
this.currentAction = action;
|
|
1399
|
+
saveCurrentAction(e, n) {
|
|
1400
|
+
u.log("Save current action"), this.currentActionCallback = e, this.currentAction = n;
|
|
1847
1401
|
}
|
|
1848
|
-
setDebug(
|
|
1849
|
-
|
|
1402
|
+
setDebug(e) {
|
|
1403
|
+
Xe(e);
|
|
1850
1404
|
}
|
|
1851
1405
|
}
|
|
1852
|
-
let
|
|
1853
|
-
const
|
|
1854
|
-
|
|
1855
|
-
setDocument(AutomationInstance.document);
|
|
1856
|
-
tests == null ? void 0 : tests.forEach((installerFn) => installerFn());
|
|
1857
|
-
return AutomationInstance;
|
|
1858
|
-
};
|
|
1859
|
-
function tomation(options) {
|
|
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) {
|
|
1860
1409
|
const {
|
|
1861
|
-
matches,
|
|
1862
|
-
tests = [],
|
|
1863
|
-
speed = "NORMAL",
|
|
1864
|
-
debug =
|
|
1865
|
-
} =
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
console.log(`[tomation] URL "${document.location.href}" does not match "${matches}"`);
|
|
1410
|
+
matches: e,
|
|
1411
|
+
tests: n = [],
|
|
1412
|
+
speed: s = "NORMAL",
|
|
1413
|
+
debug: o = !1
|
|
1414
|
+
} = t;
|
|
1415
|
+
if (!(typeof e == "string" ? document.location.href.includes(e) : !!document.location.href.match(e))) {
|
|
1416
|
+
console.log(`[tomation] URL "${document.location.href}" does not match "${e}"`);
|
|
1869
1417
|
return;
|
|
1870
1418
|
}
|
|
1871
1419
|
try {
|
|
1872
|
-
console.log("[tomation] Setting up messaging bridge with extension...")
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
AutomationEvents.on(event, (data) => {
|
|
1876
|
-
console.log(`[tomation] Dispatching event "${event}" to extension`, data);
|
|
1877
|
-
window.postMessage({
|
|
1420
|
+
console.log("[tomation] Setting up messaging bridge with extension..."), Object.values(v).forEach((r) => {
|
|
1421
|
+
console.log(`[tomation] Setting up listener for event "${r}"`), m.on(r, (l) => {
|
|
1422
|
+
console.log(`[tomation] Dispatching event "${r}" to extension`, l), window.postMessage({
|
|
1878
1423
|
message: "injectedScript-to-contentScript",
|
|
1879
1424
|
sender: "tomation",
|
|
1880
1425
|
payload: {
|
|
1881
|
-
cmd:
|
|
1882
|
-
params:
|
|
1426
|
+
cmd: r,
|
|
1427
|
+
params: l
|
|
1883
1428
|
}
|
|
1884
1429
|
});
|
|
1885
1430
|
});
|
|
1886
|
-
})
|
|
1887
|
-
window.addEventListener("message", (event) => {
|
|
1431
|
+
}), window.addEventListener("message", (r) => {
|
|
1888
1432
|
try {
|
|
1889
|
-
console.log("[tomation] Received message from extension:",
|
|
1890
|
-
const { message, sender, payload } =
|
|
1891
|
-
|
|
1892
|
-
if (sender !== "web-extension")
|
|
1433
|
+
console.log("[tomation] Received message from extension:", r.data);
|
|
1434
|
+
const { message: l, sender: E, payload: C } = r.data || {}, { cmd: g, params: T } = C || {};
|
|
1435
|
+
if (E !== "web-extension")
|
|
1893
1436
|
return;
|
|
1894
|
-
if (
|
|
1895
|
-
const
|
|
1896
|
-
"run-test-request": () =>
|
|
1897
|
-
"reload-tests-request": () =>
|
|
1898
|
-
"pause-test-request": () =>
|
|
1899
|
-
"stop-test-request": () =>
|
|
1900
|
-
"continue-test-request": () =>
|
|
1901
|
-
"next-step-request": () =>
|
|
1902
|
-
"retry-action-request": () =>
|
|
1903
|
-
"skip-action-request": () =>
|
|
1904
|
-
"user-accept-request": () =>
|
|
1437
|
+
if (l === "contentScript-to-injectedScript") {
|
|
1438
|
+
const N = {
|
|
1439
|
+
"run-test-request": () => Ge(T == null ? void 0 : T.testId),
|
|
1440
|
+
"reload-tests-request": () => X(window, n || []),
|
|
1441
|
+
"pause-test-request": () => c.pause(),
|
|
1442
|
+
"stop-test-request": () => c.stop(),
|
|
1443
|
+
"continue-test-request": () => c.continue(),
|
|
1444
|
+
"next-step-request": () => c.next(),
|
|
1445
|
+
"retry-action-request": () => c.retryAction(),
|
|
1446
|
+
"skip-action-request": () => c.skipAction(),
|
|
1447
|
+
"user-accept-request": () => m.dispatch(
|
|
1905
1448
|
"tomation-user-accept"
|
|
1906
1449
|
/* USER_ACCEPT */
|
|
1907
1450
|
),
|
|
1908
|
-
"user-reject-request": () =>
|
|
1451
|
+
"user-reject-request": () => m.dispatch(
|
|
1909
1452
|
"tomation-user-reject"
|
|
1910
1453
|
/* USER_REJECT */
|
|
1911
1454
|
)
|
|
1912
|
-
};
|
|
1913
|
-
|
|
1914
|
-
if (commandFn) {
|
|
1915
|
-
console.log(`[tomation] Executing command "${cmd}" from extension`);
|
|
1916
|
-
commandFn();
|
|
1917
|
-
} else {
|
|
1918
|
-
console.warn(`[tomation] Unknown command "${cmd}" from extension`);
|
|
1919
|
-
}
|
|
1455
|
+
}[g];
|
|
1456
|
+
N ? (console.log(`[tomation] Executing command "${g}" from extension`), N()) : console.warn(`[tomation] Unknown command "${g}" from extension`);
|
|
1920
1457
|
return;
|
|
1921
1458
|
}
|
|
1922
|
-
} catch (
|
|
1923
|
-
console.error("[tomation] Error handling message from extension:",
|
|
1459
|
+
} catch (l) {
|
|
1460
|
+
console.error("[tomation] Error handling message from extension:", l);
|
|
1924
1461
|
}
|
|
1925
|
-
})
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1462
|
+
}), X(window, n), c.setDebug(o), c.speed = ne[s], window.postMessage({
|
|
1463
|
+
message: "injectedScript-to-contentScript",
|
|
1464
|
+
sender: "tomation",
|
|
1465
|
+
payload: {
|
|
1466
|
+
cmd: "tomation-session-init",
|
|
1467
|
+
params: {
|
|
1468
|
+
speed: c.speed,
|
|
1469
|
+
sessionId: Z()
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
}), console.log("[tomation] Ready ✓");
|
|
1473
|
+
} catch (r) {
|
|
1474
|
+
console.error("[tomation] Initialization failed:", r);
|
|
1932
1475
|
}
|
|
1933
1476
|
}
|
|
1934
1477
|
export {
|
|
1935
|
-
ACTION_STATUS,
|
|
1936
|
-
Assert,
|
|
1937
|
-
AutomationEvents,
|
|
1938
|
-
AutomationInstance,
|
|
1939
|
-
ClearValue,
|
|
1940
|
-
Click,
|
|
1941
|
-
DateUtils,
|
|
1942
|
-
EVENT_NAMES,
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1478
|
+
Y as ACTION_STATUS,
|
|
1479
|
+
gt as Assert,
|
|
1480
|
+
m as AutomationEvents,
|
|
1481
|
+
c as AutomationInstance,
|
|
1482
|
+
wt as ClearValue,
|
|
1483
|
+
mt as Click,
|
|
1484
|
+
ht as DateUtils,
|
|
1485
|
+
v as EVENT_NAMES,
|
|
1486
|
+
De as KEY_MAP,
|
|
1487
|
+
bt as ManualTask,
|
|
1488
|
+
Nt as Pause,
|
|
1489
|
+
xt as PressDownKey,
|
|
1490
|
+
Ct as PressEnterKey,
|
|
1491
|
+
ft as PressEscKey,
|
|
1492
|
+
kt as PressKey,
|
|
1493
|
+
At as PressTabKey,
|
|
1494
|
+
It as ReloadPage,
|
|
1495
|
+
Ge as RunTest,
|
|
1496
|
+
vt as SaveValue,
|
|
1497
|
+
yt as Select,
|
|
1498
|
+
z as SelectorBuilder,
|
|
1499
|
+
X as Setup,
|
|
1500
|
+
pt as Task,
|
|
1501
|
+
dt as Test,
|
|
1502
|
+
ne as TestSpeed,
|
|
1503
|
+
Et as Type,
|
|
1504
|
+
Tt as TypePassword,
|
|
1505
|
+
ie as UIElement,
|
|
1506
|
+
St as UploadFile,
|
|
1507
|
+
Qe as Wait,
|
|
1508
|
+
lt as and,
|
|
1509
|
+
tt as classIncludes,
|
|
1510
|
+
et as classIs,
|
|
1511
|
+
Ot as default,
|
|
1512
|
+
at as elementIndexIs,
|
|
1513
|
+
ct as firstChildTextIs,
|
|
1514
|
+
st as innerTextContains,
|
|
1515
|
+
nt as innerTextIs,
|
|
1516
|
+
ut as is,
|
|
1517
|
+
rt as isFirstElement,
|
|
1518
|
+
it as placeholderIs,
|
|
1519
|
+
Xe as setAutomationLogs,
|
|
1520
|
+
_e as setFilterLogs,
|
|
1521
|
+
ot as titleIs,
|
|
1522
|
+
Ot as tomation,
|
|
1523
|
+
f as wait
|
|
1978
1524
|
};
|