@flemist/simple-utils 2.1.4 → 2.1.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/build/node/index.cjs +8 -8
- package/build/node/index.mjs +762 -601
- package/build/node/test/helpers/common.d.ts +2 -0
- package/build/node/test/helpers/createTestE2e.d.ts +30 -0
- package/build/node/test/helpers/index.d.ts +3 -0
- package/build/node/test/helpers/waitPageStable.d.ts +35 -0
- package/build/node/test/index.d.ts +1 -0
- package/package.json +1 -1
package/build/node/index.mjs
CHANGED
|
@@ -1,55 +1,56 @@
|
|
|
1
|
-
import { V as
|
|
2
|
-
import { ac as
|
|
3
|
-
import { Locker as
|
|
4
|
-
import { Pool as
|
|
5
|
-
import
|
|
6
|
-
import * as
|
|
7
|
-
import
|
|
8
|
-
import { priorityCreate as
|
|
9
|
-
import * as
|
|
10
|
-
import
|
|
11
|
-
import { spawn as
|
|
12
|
-
import { AbortControllerFast as
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { V as bt, S as gt, F as Et } from "../urlGet-DZEwtNXt.mjs";
|
|
2
|
+
import { ac as Se, M as xe, W as ke, X as Oe, P as Te, aj as Pe, a2 as Ce, a3 as Ae, b5 as je, b6 as De, b7 as Le, b8 as Me, b9 as Ie, ba as Fe, bb as Re, bk as _e, bc as $e, bd as Ne, be as We, bf as ve, bg as Be, bh as ze, bi as Je, bj as Ue, R as Ge, $ as He, a0 as Ve, U as Ke, L as qe, H as Ye, a6 as Xe, ad as Qe, ae as Ze, K as tr, I as er, N as rr, q as nr, aa as sr, a9 as ar, a8 as or, Z as ir, l as cr, o as lr, B as ur, C as fr, D as hr, E as dr, z as mr, A as wr, a5 as yr, ag as pr, af as br, Q as gr, u as Er, v as Sr, w as xr, J as kr, p as Or, x as Tr, d as Pr, g as Cr, a4 as Ar, _ as jr, ab as Dr, aH as Lr, aJ as Mr, am as Ir, ak as Fr, b4 as Rr, al as _r, ap as $r, aL as Nr, aO as Wr, aD as vr, aC as Br, aq as zr, aZ as Jr, ax as Ur, aY as Gr, av as Hr, aX as Vr, aA as Kr, au as qr, a_ as Yr, as as Xr, ar as Qr, ao as Zr, b1 as tn, aF as en, aE as rn, at as nn, aw as sn, aR as an, aS as on, aT as cn, aV as ln, aP as un, aW as fn, ay as hn, aU as dn, aQ as mn, aN as wn, aK as yn, aG as pn, aI as bn, a$ as gn, b0 as En, an as Sn, ah as xn, ai as kn, az as On, aM as Tn, aB as Pn, b2 as Cn, b3 as An, b as jn, m as Dn, c as Ln, n as Mn, f as In, k as Fn, r as Rn, h as _n, e as $n, i as Nn, j as Wn, G as vn, a as Bn, s as zn, T as Jn, t as Un, y as Gn, bq as Hn, bs as Vn, br as Kn, bl as qn, bp as Yn, bm as Xn, bo as Qn, bn as Zn, a7 as ts, a1 as es, O as rs, Y as ns } from "../urlGet-DZEwtNXt.mjs";
|
|
3
|
+
import { Locker as St, useAbortController as xt, combineAbortSignals as tt, delay as it } from "@flemist/async-utils";
|
|
4
|
+
import { Pool as kt, poolRunWait as $ } from "@flemist/time-limits";
|
|
5
|
+
import Ot from "node:os";
|
|
6
|
+
import * as M from "path";
|
|
7
|
+
import ct from "path";
|
|
8
|
+
import { priorityCreate as B } from "@flemist/priority-queue";
|
|
9
|
+
import * as I from "fs";
|
|
10
|
+
import Tt from "picomatch";
|
|
11
|
+
import { spawn as U } from "child_process";
|
|
12
|
+
import { AbortControllerFast as lt, AbortError as nt } from "@flemist/abort-controller-fast";
|
|
13
|
+
import { createTestVariants as Pt } from "@flemist/test-variants";
|
|
14
|
+
const et = new kt(Ot.cpus().length);
|
|
15
|
+
function N(t) {
|
|
15
16
|
return t.replace(/\\/g, "/");
|
|
16
17
|
}
|
|
17
|
-
let
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
const e =
|
|
21
|
-
let n =
|
|
22
|
-
return n == null && (n = new
|
|
18
|
+
let J = null;
|
|
19
|
+
function Ct(t) {
|
|
20
|
+
J == null && (J = /* @__PURE__ */ new Map());
|
|
21
|
+
const e = N(t);
|
|
22
|
+
let n = J.get(e);
|
|
23
|
+
return n == null && (n = new St(), J.set(e, n)), n;
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
+
function oe(t) {
|
|
25
26
|
const { filePath: e, func: n } = t;
|
|
26
|
-
return
|
|
27
|
-
() =>
|
|
28
|
-
pool:
|
|
27
|
+
return Ct(e).lock(
|
|
28
|
+
() => $({
|
|
29
|
+
pool: et,
|
|
29
30
|
count: 1,
|
|
30
31
|
func: n
|
|
31
32
|
})
|
|
32
33
|
);
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function At(t) {
|
|
35
36
|
return t.match(/^[/\\]?[^/\\]+/)[0];
|
|
36
37
|
}
|
|
37
38
|
function jt(t, e) {
|
|
38
|
-
return
|
|
39
|
+
return At(t) + "|" + e.ino;
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
return t.endsWith(":") && (t += "/"),
|
|
41
|
+
function Dt(t) {
|
|
42
|
+
return t.endsWith(":") && (t += "/"), M.resolve(t);
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function st(t, e) {
|
|
44
45
|
t.totalSize += e.totalSize, t.maxFileDateModified = Math.max(
|
|
45
46
|
t.maxFileDateModified,
|
|
46
47
|
e.maxFileDateModified
|
|
47
48
|
), t.countFiles += e.countFiles, t.countDirs += e.countDirs, t.countLinks += e.countLinks;
|
|
48
49
|
}
|
|
49
|
-
const
|
|
50
|
+
const Lt = function(e) {
|
|
50
51
|
return e.code === "ENOENT";
|
|
51
52
|
};
|
|
52
|
-
function
|
|
53
|
+
function ut(t) {
|
|
53
54
|
const e = t.paths;
|
|
54
55
|
if (!e || e.length === 0)
|
|
55
56
|
return Promise.resolve({
|
|
@@ -59,148 +60,148 @@ function it(t) {
|
|
|
59
60
|
countDirs: 0,
|
|
60
61
|
countLinks: 0
|
|
61
62
|
});
|
|
62
|
-
const n = t.level ?? 0, s = t.walkedIds ?? /* @__PURE__ */ new Set(), r = t.abortSignal, a = t.pool ??
|
|
63
|
-
async function
|
|
64
|
-
if (!(o && await o(
|
|
65
|
-
throw
|
|
63
|
+
const n = t.level ?? 0, s = t.walkedIds ?? /* @__PURE__ */ new Set(), r = t.abortSignal, a = t.pool ?? et, o = t.handleError, i = t.priority ?? B(0), h = t.walkLinks ?? !1, l = t.log, g = t.handlePath, d = t.matchPath;
|
|
64
|
+
async function f(u) {
|
|
65
|
+
if (!(o && await o(u)) && !Lt(u))
|
|
66
|
+
throw u;
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
-
return !(!
|
|
68
|
+
function x(u) {
|
|
69
|
+
return !(!l || l.minTotalContentSize != null && u < l.minTotalContentSize || l.maxNestedLevel != null && n > l.maxNestedLevel);
|
|
69
70
|
}
|
|
70
|
-
return
|
|
71
|
-
const
|
|
71
|
+
return xt(async (u) => {
|
|
72
|
+
const m = tt(r, u), w = {
|
|
72
73
|
totalSize: 0,
|
|
73
74
|
maxFileDateModified: 0,
|
|
74
75
|
countFiles: 0,
|
|
75
76
|
countDirs: 0,
|
|
76
77
|
countLinks: 0
|
|
77
78
|
};
|
|
78
|
-
function
|
|
79
|
-
if (
|
|
80
|
-
const
|
|
81
|
-
|
|
79
|
+
function P(y, T) {
|
|
80
|
+
if (x(T.totalSize)) {
|
|
81
|
+
const k = `${T.totalSize.toLocaleString("en-US").replace(/,/g, " ").padStart(19)}: ${y}`;
|
|
82
|
+
l?.handleLog ? l.handleLog(k) : console.log(k);
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
|
-
async function
|
|
85
|
-
return
|
|
85
|
+
async function c(y, T, S, k) {
|
|
86
|
+
return g ? await $({
|
|
86
87
|
pool: a,
|
|
87
88
|
func: async () => {
|
|
88
89
|
try {
|
|
89
|
-
return await
|
|
90
|
+
return await g({
|
|
90
91
|
level: n,
|
|
91
|
-
path:
|
|
92
|
-
stat:
|
|
93
|
-
itemStat:
|
|
94
|
-
totalStat:
|
|
95
|
-
abortSignal:
|
|
92
|
+
path: y,
|
|
93
|
+
stat: T,
|
|
94
|
+
itemStat: S,
|
|
95
|
+
totalStat: w,
|
|
96
|
+
abortSignal: m
|
|
96
97
|
});
|
|
97
|
-
} catch (
|
|
98
|
-
return await
|
|
98
|
+
} catch (O) {
|
|
99
|
+
return await f(O), !1;
|
|
99
100
|
}
|
|
100
101
|
},
|
|
101
102
|
count: 1,
|
|
102
|
-
priority:
|
|
103
|
-
abortSignal:
|
|
103
|
+
priority: k,
|
|
104
|
+
abortSignal: m
|
|
104
105
|
}) : !0;
|
|
105
106
|
}
|
|
106
|
-
async function
|
|
107
|
-
|
|
108
|
-
const
|
|
107
|
+
async function p(y, T, S, k) {
|
|
108
|
+
k || (k = y);
|
|
109
|
+
const O = await $({
|
|
109
110
|
pool: a,
|
|
110
|
-
func: () =>
|
|
111
|
+
func: () => I.promises.lstat(y).catch(f),
|
|
111
112
|
count: 1,
|
|
112
|
-
priority:
|
|
113
|
-
abortSignal:
|
|
113
|
+
priority: B(T, B(1, i)),
|
|
114
|
+
abortSignal: m
|
|
114
115
|
});
|
|
115
|
-
if (!
|
|
116
|
+
if (!O || !S && O.isFile())
|
|
116
117
|
return null;
|
|
117
|
-
const
|
|
118
|
-
if (s.has(
|
|
118
|
+
const A = jt(y, O);
|
|
119
|
+
if (s.has(A))
|
|
119
120
|
return null;
|
|
120
|
-
s.add(
|
|
121
|
-
let
|
|
122
|
-
totalSize:
|
|
123
|
-
maxFileDateModified:
|
|
121
|
+
s.add(A);
|
|
122
|
+
let b = {
|
|
123
|
+
totalSize: O.size,
|
|
124
|
+
maxFileDateModified: O.isDirectory() ? 0 : O.mtimeMs,
|
|
124
125
|
countFiles: 0,
|
|
125
126
|
countDirs: 0,
|
|
126
127
|
countLinks: 0
|
|
127
128
|
};
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
const j = B(
|
|
130
|
+
T,
|
|
131
|
+
B(O.isDirectory() ? 2 : 3, i)
|
|
131
132
|
);
|
|
132
|
-
if (
|
|
133
|
-
if (
|
|
134
|
-
const C = await
|
|
133
|
+
if (O.isSymbolicLink()) {
|
|
134
|
+
if (h) {
|
|
135
|
+
const C = await $({
|
|
135
136
|
pool: a,
|
|
136
|
-
func: () =>
|
|
137
|
+
func: () => I.promises.readlink(y).catch(f).then((L) => L ?? null),
|
|
137
138
|
count: 1,
|
|
138
|
-
priority:
|
|
139
|
-
abortSignal:
|
|
139
|
+
priority: j,
|
|
140
|
+
abortSignal: m
|
|
140
141
|
});
|
|
141
142
|
if (C) {
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
const L = M.isAbsolute(C) ? C : M.resolve(M.dirname(k), C), F = await p(
|
|
144
|
+
L,
|
|
145
|
+
T,
|
|
146
|
+
S,
|
|
147
|
+
k
|
|
147
148
|
);
|
|
148
|
-
|
|
149
|
+
F && (b = F);
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
|
-
return (
|
|
152
|
-
b,
|
|
152
|
+
return (S || b.countFiles + b.countDirs + b.countLinks >= 1) && (b.countLinks += 1, await c(
|
|
153
153
|
k,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
O,
|
|
155
|
+
b,
|
|
156
|
+
j
|
|
157
|
+
) && (st(w, b), P(k, b))), b;
|
|
158
|
+
} else if (O.isDirectory()) {
|
|
159
|
+
const C = await $({
|
|
159
160
|
pool: a,
|
|
160
|
-
func: () =>
|
|
161
|
+
func: () => I.promises.readdir(y).catch(f),
|
|
161
162
|
count: 1,
|
|
162
163
|
priority: i,
|
|
163
|
-
abortSignal:
|
|
164
|
+
abortSignal: m
|
|
164
165
|
});
|
|
165
166
|
if (C) {
|
|
166
|
-
for (let
|
|
167
|
-
C[
|
|
168
|
-
|
|
167
|
+
for (let L = 0, F = C.length; L < F; L++)
|
|
168
|
+
C[L] = M.join(k, C[L]);
|
|
169
|
+
b = await ut({
|
|
169
170
|
...t,
|
|
170
171
|
paths: C,
|
|
171
|
-
abortSignal:
|
|
172
|
-
priority:
|
|
172
|
+
abortSignal: m,
|
|
173
|
+
priority: j,
|
|
173
174
|
level: n + 1,
|
|
174
175
|
walkedIds: s
|
|
175
176
|
});
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
|
-
return (
|
|
179
|
-
b,
|
|
179
|
+
return (S || b.countFiles + b.countDirs + b.countLinks >= 1) && (O.isDirectory() ? b.countDirs += 1 : O.isFile() && (b.countFiles += 1), await c(
|
|
180
180
|
k,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
O,
|
|
182
|
+
b,
|
|
183
|
+
j
|
|
184
|
+
) && (st(w, b), P(k, b))), b;
|
|
184
185
|
}
|
|
185
|
-
const
|
|
186
|
-
for (let
|
|
187
|
-
const
|
|
188
|
-
|
|
186
|
+
const E = [];
|
|
187
|
+
for (let y = 0, T = e.length; y < T; y++) {
|
|
188
|
+
const S = Dt(e[y]), k = d ? d(S) : !0;
|
|
189
|
+
k !== !1 && E.push(p(S, y, k));
|
|
189
190
|
}
|
|
190
|
-
return await Promise.all(
|
|
191
|
+
return await Promise.all(E), w;
|
|
191
192
|
});
|
|
192
193
|
}
|
|
193
|
-
function
|
|
194
|
-
return
|
|
194
|
+
function ie(t) {
|
|
195
|
+
return ut(t);
|
|
195
196
|
}
|
|
196
|
-
function
|
|
197
|
+
function ce({
|
|
197
198
|
globs: t,
|
|
198
199
|
rootDir: e,
|
|
199
200
|
noCase: n
|
|
200
201
|
}) {
|
|
201
202
|
const s = [];
|
|
202
203
|
return t.forEach((r) => {
|
|
203
|
-
r =
|
|
204
|
+
r = N(r).trim();
|
|
204
205
|
const a = r.startsWith("^");
|
|
205
206
|
a && (r = r.substring(1).trim());
|
|
206
207
|
const o = r.startsWith("!");
|
|
@@ -209,85 +210,85 @@ function te({
|
|
|
209
210
|
`Invalid glob pattern: "${r}". The syntax '${r.substring(0, 2)}' is not supported. Valid glob patterns use: * (match any characters), ** (match any directories), ? (match single character), [abc] (character class), ! (negate pattern), ^ (exclude if included). Examples of valid patterns: "*.js", "src/**/*.ts", "!node_modules", "^dist". Avoid starting with '!' after '^' or multiple special prefixes.`
|
|
210
211
|
);
|
|
211
212
|
r.startsWith("/") && (r = "." + r);
|
|
212
|
-
const i =
|
|
213
|
+
const i = N(e ? M.resolve(e, r) : r);
|
|
213
214
|
if (!i)
|
|
214
215
|
return;
|
|
215
|
-
let
|
|
216
|
+
let h;
|
|
216
217
|
try {
|
|
217
|
-
|
|
218
|
+
h = Tt(i, {
|
|
218
219
|
nocase: n ?? !1,
|
|
219
220
|
dot: !0,
|
|
220
221
|
strictBrackets: !0
|
|
221
222
|
// Validate bracket balance for patterns like "["
|
|
222
223
|
});
|
|
223
|
-
} catch (
|
|
224
|
+
} catch (l) {
|
|
224
225
|
throw new Error(
|
|
225
|
-
`Invalid glob pattern: "${r}". ${
|
|
226
|
+
`Invalid glob pattern: "${r}". ${l instanceof Error ? l.message : "Unknown error"}. Valid glob patterns use: * (match any characters), ** (match any directories), ? (match single character), [abc] (character class with balanced brackets), ! (negate pattern), ^ (exclude if included). Examples: "*.js", "src/**/*.ts", "!node_modules", "[abc]def.txt". Ensure all brackets [ ] are properly closed and balanced.`
|
|
226
227
|
);
|
|
227
228
|
}
|
|
228
229
|
s.push({
|
|
229
230
|
exclude: a,
|
|
230
231
|
negative: o,
|
|
231
232
|
debugInfo: i,
|
|
232
|
-
match:
|
|
233
|
+
match: h
|
|
233
234
|
});
|
|
234
235
|
}), function(a) {
|
|
235
|
-
a =
|
|
236
|
+
a = N(a);
|
|
236
237
|
let o = null, i = !1;
|
|
237
|
-
for (let
|
|
238
|
-
const
|
|
239
|
-
|
|
238
|
+
for (let h = 0, l = s.length; h < l; h++) {
|
|
239
|
+
const g = s[h];
|
|
240
|
+
g.match(a) && (g.exclude ? i = !g.negative : (o = !g.negative, i = !1));
|
|
240
241
|
}
|
|
241
242
|
return i ? !1 : o;
|
|
242
243
|
};
|
|
243
244
|
}
|
|
244
|
-
function
|
|
245
|
+
function Mt(t) {
|
|
245
246
|
const e = t.startsWith("!");
|
|
246
247
|
return e && (t = t.substring(1)), t.startsWith("/") ? t = t.substring(1) : !t.startsWith("**") && !t.startsWith("../") && (t = `**/${t}`), e && (t = "!" + t), t;
|
|
247
248
|
}
|
|
248
|
-
function
|
|
249
|
+
function It(t, e) {
|
|
249
250
|
if (!e || e === ".")
|
|
250
251
|
return t;
|
|
251
252
|
const n = t.startsWith("^");
|
|
252
253
|
n && (t = t.substring(1));
|
|
253
254
|
const s = t.startsWith("!");
|
|
254
|
-
return s && (t = t.substring(1)), t.startsWith("/") ? (e.endsWith("/") && (e = e.substring(0, e.length - 1)), t = e + t) : (e.endsWith("/") || (e += "/"), t.startsWith("./") ? t = e + t.substring(2) : t.startsWith("../") ? t = e + t : (e.startsWith("..") && (e = ""), t.startsWith("**") ? t = e + t : t = e + "**/" + t)), t =
|
|
255
|
+
return s && (t = t.substring(1)), t.startsWith("/") ? (e.endsWith("/") && (e = e.substring(0, e.length - 1)), t = e + t) : (e.endsWith("/") || (e += "/"), t.startsWith("./") ? t = e + t.substring(2) : t.startsWith("../") ? t = e + t : (e.startsWith("..") && (e = ""), t.startsWith("**") ? t = e + t : t = e + "**/" + t)), t = N(M.normalize(t)), s && (t = "!" + t), n && (t = "^" + t), t;
|
|
255
256
|
}
|
|
256
|
-
function
|
|
257
|
+
function at(t) {
|
|
257
258
|
return "^" + t;
|
|
258
259
|
}
|
|
259
|
-
async function
|
|
260
|
-
const n = (await
|
|
260
|
+
async function Ft(t) {
|
|
261
|
+
const n = (await I.promises.readFile(t, "utf-8")).split(`
|
|
261
262
|
`), s = [];
|
|
262
263
|
return n.forEach((r) => {
|
|
263
264
|
r = r.trim(), !(!r || r.startsWith("#")) && s.push(r);
|
|
264
265
|
}), s;
|
|
265
266
|
}
|
|
266
|
-
async function
|
|
267
|
+
async function le(t) {
|
|
267
268
|
const e = t.rootDir ?? ".", n = [];
|
|
268
269
|
if (!t.globs?.length)
|
|
269
270
|
return n;
|
|
270
271
|
const s = [];
|
|
271
272
|
return t.globs.forEach((r) => {
|
|
272
|
-
r.value && (r.valueType === "file-contains-patterns" ? s.push(r) : r.valueType === "pattern" && n.push(r.exclude ?
|
|
273
|
+
r.value && (r.valueType === "file-contains-patterns" ? s.push(r) : r.valueType === "pattern" && n.push(r.exclude ? at(r.value) : r.value));
|
|
273
274
|
}), s.length && await Promise.all(
|
|
274
275
|
s.map(async (r) => {
|
|
275
|
-
await
|
|
276
|
-
pool:
|
|
276
|
+
await $({
|
|
277
|
+
pool: et,
|
|
277
278
|
count: 1,
|
|
278
279
|
func: async () => {
|
|
279
|
-
const a =
|
|
280
|
-
o.forEach((
|
|
281
|
-
|
|
280
|
+
const a = M.resolve(e, r.value), o = await Ft(a), i = M.relative(e, M.dirname(a));
|
|
281
|
+
o.forEach((h) => {
|
|
282
|
+
h = Mt(h), h = It(h, i), n.push(r.exclude ? at(h) : h);
|
|
282
283
|
});
|
|
283
284
|
}
|
|
284
285
|
});
|
|
285
286
|
})
|
|
286
287
|
), n;
|
|
287
288
|
}
|
|
288
|
-
function
|
|
289
|
+
function Rt(t, e = {}) {
|
|
289
290
|
return new Promise((n, s) => {
|
|
290
|
-
const r =
|
|
291
|
+
const r = U(t, {
|
|
291
292
|
shell: !0,
|
|
292
293
|
...e
|
|
293
294
|
}), a = [];
|
|
@@ -305,19 +306,19 @@ function Mt(t, e = {}) {
|
|
|
305
306
|
});
|
|
306
307
|
});
|
|
307
308
|
}
|
|
308
|
-
async function
|
|
309
|
+
async function ue() {
|
|
309
310
|
let t;
|
|
310
311
|
switch (process.platform) {
|
|
311
312
|
case "darwin":
|
|
312
|
-
t =
|
|
313
|
+
t = U("afplay", ["/System/Library/Sounds/Ping.aiff"], {
|
|
313
314
|
stdio: "ignore"
|
|
314
315
|
});
|
|
315
316
|
break;
|
|
316
317
|
case "linux":
|
|
317
|
-
t =
|
|
318
|
+
t = U("beep", [], { stdio: "ignore", shell: !0 });
|
|
318
319
|
break;
|
|
319
320
|
case "win32":
|
|
320
|
-
t =
|
|
321
|
+
t = U("powershell", ["-c", "[console]::beep(1000,300)"], {
|
|
321
322
|
stdio: "ignore"
|
|
322
323
|
});
|
|
323
324
|
break;
|
|
@@ -332,84 +333,84 @@ async function re() {
|
|
|
332
333
|
});
|
|
333
334
|
});
|
|
334
335
|
}
|
|
335
|
-
async function
|
|
336
|
+
async function _t({
|
|
336
337
|
page: t,
|
|
337
338
|
urlFilters: e,
|
|
338
339
|
timeouts: n
|
|
339
340
|
}) {
|
|
340
|
-
return n || (n = {}), n.downloadInternal || (n.downloadInternal = 10 * 1e3), n.downloadExternal || (n.downloadExternal = 60 * 1e3), n.total || (n.total = 300 * 1e3), await
|
|
341
|
+
return n || (n = {}), n.downloadInternal || (n.downloadInternal = 10 * 1e3), n.downloadExternal || (n.downloadExternal = 60 * 1e3), n.total || (n.total = 300 * 1e3), await bt(
|
|
341
342
|
() => t.evaluate(
|
|
342
343
|
({
|
|
343
344
|
urlFilters: r,
|
|
344
345
|
timeouts: a
|
|
345
346
|
}) => {
|
|
346
|
-
function o(
|
|
347
|
-
return function(
|
|
348
|
-
let
|
|
349
|
-
for (let
|
|
350
|
-
const
|
|
351
|
-
|
|
347
|
+
function o(l) {
|
|
348
|
+
return function(d) {
|
|
349
|
+
let f = !1;
|
|
350
|
+
for (let x = 0, u = l.length; x < u; x++) {
|
|
351
|
+
const m = l[x];
|
|
352
|
+
m.pattern.test(d) && (f = m.value);
|
|
352
353
|
}
|
|
353
|
-
return
|
|
354
|
+
return f;
|
|
354
355
|
};
|
|
355
356
|
}
|
|
356
357
|
const i = r && o(r);
|
|
357
|
-
let
|
|
358
|
-
return
|
|
358
|
+
let h = performance.getEntries && performance.getEntries();
|
|
359
|
+
return h || (h = []), h.push({
|
|
359
360
|
name: location.href
|
|
360
361
|
}), Promise.all(
|
|
361
|
-
|
|
362
|
-
(
|
|
363
|
-
if (
|
|
362
|
+
h.map(
|
|
363
|
+
(l) => {
|
|
364
|
+
if (l.entryType != null && l.entryType !== "resource" || i && !i(l.name))
|
|
364
365
|
return null;
|
|
365
|
-
if (
|
|
366
|
-
return
|
|
367
|
-
url:
|
|
368
|
-
error:
|
|
366
|
+
if (l.responseStatus != null)
|
|
367
|
+
return l.responseStatus >= 400 ? Promise.resolve({
|
|
368
|
+
url: l.name,
|
|
369
|
+
error: l.responseStatus
|
|
369
370
|
}) : null;
|
|
370
371
|
if (navigator.userAgent.indexOf("Chrome") === -1)
|
|
371
372
|
return null;
|
|
372
|
-
const
|
|
373
|
-
let
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
}),
|
|
377
|
-
|
|
373
|
+
const g = typeof AbortController < "u" ? new AbortController() : null, d = new URL(l.name).origin === location.origin, f = d ? a.downloadInternal : a.downloadExternal;
|
|
374
|
+
let x;
|
|
375
|
+
const u = new Promise((c, p) => {
|
|
376
|
+
x = p;
|
|
377
|
+
}), m = f && setTimeout(() => {
|
|
378
|
+
g?.abort(), x(
|
|
378
379
|
new Error("[test][getPageHttpErrors] fetch timeout")
|
|
379
380
|
);
|
|
380
|
-
},
|
|
381
|
-
let
|
|
382
|
-
mode:
|
|
383
|
-
signal:
|
|
384
|
-
cache:
|
|
381
|
+
}, f);
|
|
382
|
+
let w = fetch(l.name, {
|
|
383
|
+
mode: d ? "same-origin" : "no-cors",
|
|
384
|
+
signal: g?.signal,
|
|
385
|
+
cache: d ? "force-cache" : void 0,
|
|
385
386
|
method: "HEAD"
|
|
386
|
-
}).then((
|
|
387
|
-
url:
|
|
388
|
-
error:
|
|
389
|
-
}).catch((
|
|
390
|
-
url:
|
|
391
|
-
error:
|
|
387
|
+
}).then((c) => c.ok ? null : {
|
|
388
|
+
url: l.name,
|
|
389
|
+
error: c.status + " " + c.statusText
|
|
390
|
+
}).catch((c) => ({
|
|
391
|
+
url: l.name,
|
|
392
|
+
error: c.message
|
|
392
393
|
}));
|
|
393
|
-
|
|
394
|
-
function
|
|
395
|
-
|
|
394
|
+
g || (w = Promise.race([w, u]));
|
|
395
|
+
function P() {
|
|
396
|
+
m && clearTimeout(m);
|
|
396
397
|
}
|
|
397
|
-
return
|
|
398
|
-
(
|
|
399
|
-
(
|
|
400
|
-
throw
|
|
398
|
+
return w.then(
|
|
399
|
+
(c) => (P(), c),
|
|
400
|
+
(c) => {
|
|
401
|
+
throw P(), c;
|
|
401
402
|
}
|
|
402
403
|
);
|
|
403
404
|
}
|
|
404
405
|
)
|
|
405
|
-
).then((
|
|
406
|
-
const
|
|
407
|
-
(
|
|
408
|
-
url: new URL(
|
|
409
|
-
error:
|
|
406
|
+
).then((l) => {
|
|
407
|
+
const g = l.filter((d) => d).map(
|
|
408
|
+
(d) => ({
|
|
409
|
+
url: new URL(d.url),
|
|
410
|
+
error: d.error
|
|
410
411
|
})
|
|
411
412
|
);
|
|
412
|
-
return
|
|
413
|
+
return g.length > 0 ? g : null;
|
|
413
414
|
});
|
|
414
415
|
},
|
|
415
416
|
{
|
|
@@ -420,12 +421,12 @@ async function Dt({
|
|
|
420
421
|
{ timeout: n.total }
|
|
421
422
|
);
|
|
422
423
|
}
|
|
423
|
-
async function
|
|
424
|
+
async function $t({
|
|
424
425
|
page: t,
|
|
425
426
|
urlFilters: e,
|
|
426
427
|
errorFilter: n
|
|
427
428
|
}) {
|
|
428
|
-
let s = await
|
|
429
|
+
let s = await _t({
|
|
429
430
|
page: t,
|
|
430
431
|
urlFilters: e
|
|
431
432
|
});
|
|
@@ -434,12 +435,12 @@ async function Ft({
|
|
|
434
435
|
`[test][checkPageHttpErrors] Page has http errors: ${JSON.stringify(s, null, 2)}`
|
|
435
436
|
);
|
|
436
437
|
}
|
|
437
|
-
async function
|
|
438
|
+
async function Nt({
|
|
438
439
|
page: t,
|
|
439
440
|
filter: e,
|
|
440
441
|
onError: n
|
|
441
442
|
}) {
|
|
442
|
-
const s = "callback_191b355ea6f64499a6607ad571da5d4d", r = t.context().browser()?.browserType().name(), a =
|
|
443
|
+
const s = "callback_191b355ea6f64499a6607ad571da5d4d", r = t.context().browser()?.browserType().name(), a = gt();
|
|
443
444
|
function o(i) {
|
|
444
445
|
try {
|
|
445
446
|
if (e && !e({
|
|
@@ -447,73 +448,73 @@ async function It({
|
|
|
447
448
|
error: i
|
|
448
449
|
}))
|
|
449
450
|
return;
|
|
450
|
-
} catch (
|
|
451
|
-
i = String(
|
|
451
|
+
} catch (h) {
|
|
452
|
+
i = String(h);
|
|
452
453
|
}
|
|
453
454
|
try {
|
|
454
455
|
console.error(
|
|
455
456
|
`[test][subscribeJsErrors] BROWSER JS ERROR (${r}): ${i}`
|
|
456
457
|
);
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
} catch (
|
|
460
|
-
console.error("[test][subscribeJsErrors] error",
|
|
458
|
+
const h = new Error(i);
|
|
459
|
+
h.stack = a, n(h);
|
|
460
|
+
} catch (h) {
|
|
461
|
+
console.error("[test][subscribeJsErrors] error", h);
|
|
461
462
|
}
|
|
462
463
|
}
|
|
463
464
|
await t.exposeFunction(s, o), await t.addInitScript((i) => {
|
|
464
|
-
function
|
|
465
|
-
if (Array.isArray(
|
|
466
|
-
return
|
|
465
|
+
function h(d) {
|
|
466
|
+
if (Array.isArray(d))
|
|
467
|
+
return d.map(h).join(`\r
|
|
467
468
|
\r
|
|
468
469
|
`);
|
|
469
|
-
if (
|
|
470
|
-
return
|
|
471
|
-
if (typeof
|
|
472
|
-
const
|
|
470
|
+
if (d instanceof Error)
|
|
471
|
+
return d.stack || d.toString();
|
|
472
|
+
if (typeof d == "object" && d != null) {
|
|
473
|
+
const f = /* @__PURE__ */ new Set();
|
|
473
474
|
return JSON.stringify(
|
|
474
|
-
|
|
475
|
-
(
|
|
476
|
-
if (typeof
|
|
477
|
-
if (
|
|
475
|
+
d,
|
|
476
|
+
(x, u) => {
|
|
477
|
+
if (typeof u == "object" && u != null) {
|
|
478
|
+
if (f.has(u))
|
|
478
479
|
return "[Circular]";
|
|
479
|
-
|
|
480
|
+
f.add(u);
|
|
480
481
|
}
|
|
481
|
-
return
|
|
482
|
+
return u;
|
|
482
483
|
},
|
|
483
484
|
2
|
|
484
485
|
);
|
|
485
486
|
}
|
|
486
|
-
return String(
|
|
487
|
+
return String(d);
|
|
487
488
|
}
|
|
488
|
-
function
|
|
489
|
-
window[i](
|
|
489
|
+
function l(d) {
|
|
490
|
+
window[i](d);
|
|
490
491
|
}
|
|
491
|
-
const
|
|
492
|
+
const g = {
|
|
492
493
|
warn: console.warn.bind(console),
|
|
493
494
|
error: console.error.bind(console)
|
|
494
495
|
};
|
|
495
|
-
console.warn = function(...
|
|
496
|
-
return
|
|
497
|
-
}, console.error = function(...
|
|
498
|
-
return
|
|
496
|
+
console.warn = function(...f) {
|
|
497
|
+
return l("console.warn: " + h(f)), g.warn.apply(this, f);
|
|
498
|
+
}, console.error = function(...f) {
|
|
499
|
+
return l("console.error: " + h(f)), g.error.apply(this, f);
|
|
499
500
|
}, window.addEventListener(
|
|
500
501
|
"error",
|
|
501
|
-
function(
|
|
502
|
-
|
|
502
|
+
function(d) {
|
|
503
|
+
l("window error: " + (d.message || JSON.stringify(d)));
|
|
503
504
|
},
|
|
504
505
|
!0
|
|
505
506
|
), window.addEventListener(
|
|
506
507
|
"unhandledrejection",
|
|
507
|
-
function(
|
|
508
|
-
|
|
508
|
+
function(d) {
|
|
509
|
+
l("window unhandledrejection: " + h(d.reason));
|
|
509
510
|
},
|
|
510
511
|
!0
|
|
511
512
|
);
|
|
512
513
|
}, s);
|
|
513
514
|
}
|
|
514
|
-
async function
|
|
515
|
+
async function ft() {
|
|
515
516
|
try {
|
|
516
|
-
process.platform === "win32" && await
|
|
517
|
+
process.platform === "win32" && await Rt(
|
|
517
518
|
`wmic process where "commandline like '%ms-playwright%' and not commandline like '%wmic.exe%' and priority != 4" CALL setpriority "idle"`
|
|
518
519
|
);
|
|
519
520
|
} catch (t) {
|
|
@@ -523,38 +524,38 @@ async function Rt() {
|
|
|
523
524
|
console.warn("[test][setPlaywrightPriorityLow] error: " + e);
|
|
524
525
|
}
|
|
525
526
|
}
|
|
526
|
-
let
|
|
527
|
-
function
|
|
528
|
-
|
|
527
|
+
let G = null, X = null;
|
|
528
|
+
function fe(t) {
|
|
529
|
+
X = t;
|
|
529
530
|
}
|
|
530
|
-
function
|
|
531
|
-
if (
|
|
531
|
+
function Wt() {
|
|
532
|
+
if (G)
|
|
532
533
|
return;
|
|
533
|
-
const t =
|
|
534
|
-
if (
|
|
535
|
-
return console.log(`[test][delayOnError] Delay on error: ${t} ms`),
|
|
534
|
+
const t = X || (process.env.DELAY_ON_ERROR ? parseInt(process.env.DELAY_ON_ERROR, 10) : 0);
|
|
535
|
+
if (X)
|
|
536
|
+
return console.log(`[test][delayOnError] Delay on error: ${t} ms`), G = it(t), G;
|
|
536
537
|
}
|
|
537
|
-
function
|
|
538
|
-
return
|
|
538
|
+
function he() {
|
|
539
|
+
return G;
|
|
539
540
|
}
|
|
540
|
-
async function
|
|
541
|
-
const { page: e } = t, n = e.context().browser()?.browserType().name(), s = new
|
|
541
|
+
async function vt(t) {
|
|
542
|
+
const { page: e } = t, n = e.context().browser()?.browserType().name(), s = new lt(), r = tt(
|
|
542
543
|
s.signal,
|
|
543
544
|
t.abortSignal
|
|
544
545
|
), a = (i) => {
|
|
545
|
-
let
|
|
546
|
+
let h = `Error in (${n}) ${e.url()}
|
|
546
547
|
`;
|
|
547
|
-
t.pageFilePath && (
|
|
548
|
-
`), i.stack =
|
|
548
|
+
t.pageFilePath && (h += ` at _ (${ct.resolve(t.pageFilePath)}:0:0)
|
|
549
|
+
`), i.stack = h + (i.stack || i.message), i.message = h + i.message, console.error("[test][initPage] error", i), s.abort(i);
|
|
549
550
|
};
|
|
550
|
-
return await
|
|
551
|
+
return await Nt({
|
|
551
552
|
page: e,
|
|
552
553
|
filter: t.filters?.js?.filter,
|
|
553
554
|
onError: a
|
|
554
555
|
}), {
|
|
555
556
|
abortSignal: r,
|
|
556
557
|
checkErrors: async () => {
|
|
557
|
-
await
|
|
558
|
+
await $t({
|
|
558
559
|
page: e,
|
|
559
560
|
urlFilters: t.filters?.http?.urlFilters,
|
|
560
561
|
errorFilter: t.filters?.http?.errorFilter
|
|
@@ -562,7 +563,7 @@ async function Nt(t) {
|
|
|
562
563
|
}
|
|
563
564
|
};
|
|
564
565
|
}
|
|
565
|
-
async function
|
|
566
|
+
async function Bt({
|
|
566
567
|
page: t,
|
|
567
568
|
abortSignal: e,
|
|
568
569
|
filters: n,
|
|
@@ -571,7 +572,7 @@ async function ae({
|
|
|
571
572
|
}) {
|
|
572
573
|
const a = t.context().browser()?.browserType().name();
|
|
573
574
|
try {
|
|
574
|
-
const { abortSignal: o, checkErrors: i } = await
|
|
575
|
+
const { abortSignal: o, checkErrors: i } = await vt({
|
|
575
576
|
page: t,
|
|
576
577
|
abortSignal: e,
|
|
577
578
|
filters: n,
|
|
@@ -585,11 +586,11 @@ async function ae({
|
|
|
585
586
|
} catch (o) {
|
|
586
587
|
let i = `Error in (${a}) ${t.url()}
|
|
587
588
|
`;
|
|
588
|
-
throw r && (i += ` at _ (${
|
|
589
|
+
throw r && (i += ` at _ (${ct.resolve(r)}:0:0)
|
|
589
590
|
`), o.stack = i + (o.stack || o.message), o.message = i + o.message, o;
|
|
590
591
|
}
|
|
591
592
|
}
|
|
592
|
-
function
|
|
593
|
+
function de({
|
|
593
594
|
browserType: t,
|
|
594
595
|
options: e
|
|
595
596
|
}) {
|
|
@@ -602,43 +603,199 @@ function oe({
|
|
|
602
603
|
}
|
|
603
604
|
};
|
|
604
605
|
}
|
|
605
|
-
function
|
|
606
|
+
function zt({
|
|
606
607
|
browser: t,
|
|
607
608
|
options: e
|
|
608
609
|
}) {
|
|
609
610
|
return async function(s) {
|
|
610
611
|
const r = await t.newContext(e ?? void 0);
|
|
611
|
-
await
|
|
612
|
+
await ft();
|
|
612
613
|
try {
|
|
613
614
|
const a = await s(r);
|
|
614
615
|
return await r.close(), a;
|
|
615
616
|
} catch (a) {
|
|
616
|
-
const o =
|
|
617
|
+
const o = Wt?.();
|
|
617
618
|
throw o ? (console.error("[test][useBrowserContext] error", a), o.finally(() => r.close())) : await r.close(), a;
|
|
618
619
|
}
|
|
619
620
|
};
|
|
620
621
|
}
|
|
622
|
+
async function me(t, e) {
|
|
623
|
+
const n = await t.$$(e);
|
|
624
|
+
for (const s of n)
|
|
625
|
+
await s.click();
|
|
626
|
+
}
|
|
627
|
+
const q = new lt();
|
|
628
|
+
let Jt = 0;
|
|
629
|
+
function Ut(t) {
|
|
630
|
+
return async function({
|
|
631
|
+
browser: n,
|
|
632
|
+
contextOptions: s,
|
|
633
|
+
name: r,
|
|
634
|
+
url: a,
|
|
635
|
+
pool: o,
|
|
636
|
+
priority: i,
|
|
637
|
+
filters: h,
|
|
638
|
+
...l
|
|
639
|
+
}, g) {
|
|
640
|
+
const d = tt(
|
|
641
|
+
q.signal,
|
|
642
|
+
g
|
|
643
|
+
);
|
|
644
|
+
try {
|
|
645
|
+
await $({
|
|
646
|
+
pool: o,
|
|
647
|
+
count: 1,
|
|
648
|
+
priority: i,
|
|
649
|
+
abortSignal: d,
|
|
650
|
+
func: async (f, x) => {
|
|
651
|
+
x.throwIfAborted(), await zt({
|
|
652
|
+
browser: n,
|
|
653
|
+
options: s
|
|
654
|
+
})(async (u) => {
|
|
655
|
+
x.throwIfAborted();
|
|
656
|
+
const m = await u.newPage();
|
|
657
|
+
await ft();
|
|
658
|
+
const w = n.browserType().name(), P = x.subscribe(() => {
|
|
659
|
+
m.isClosed() || (m.close({
|
|
660
|
+
// reason: reason?.message,
|
|
661
|
+
runBeforeUnload: !1
|
|
662
|
+
}), u.close({
|
|
663
|
+
// reason: reason?.message,
|
|
664
|
+
}));
|
|
665
|
+
});
|
|
666
|
+
try {
|
|
667
|
+
console.log(`START ${r} (${w}): ${a}`), await Bt({
|
|
668
|
+
page: m,
|
|
669
|
+
abortSignal: x,
|
|
670
|
+
filters: h,
|
|
671
|
+
func: async ({ page: c, checkErrors: p, abortSignal: E }) => {
|
|
672
|
+
await t({
|
|
673
|
+
page: c,
|
|
674
|
+
url: a,
|
|
675
|
+
checkErrors: p,
|
|
676
|
+
abortSignal: E,
|
|
677
|
+
args: l
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
}), console.log(
|
|
681
|
+
`END [${Jt++}] ${r} (${w}): ${a}`
|
|
682
|
+
);
|
|
683
|
+
} catch (c) {
|
|
684
|
+
if (x.aborted || c instanceof nt) {
|
|
685
|
+
console.log(`ABORTED ${r} (${w}): ${a}`);
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
throw console.log(`ERROR ${r} (${w}): ${a}`), q.signal.aborted || (console.log("unsubscribe on first error"), P()), q.abort(), c;
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
} catch (f) {
|
|
694
|
+
if (f instanceof nt)
|
|
695
|
+
return;
|
|
696
|
+
throw f;
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
function we(t) {
|
|
701
|
+
const e = Ut(t);
|
|
702
|
+
return Pt(async (n) => await e(n));
|
|
703
|
+
}
|
|
704
|
+
function ye(t, e) {
|
|
705
|
+
const n = e.stableTime, s = e.timeout, r = e.mutation ? {
|
|
706
|
+
childList: !!e.mutation.childList,
|
|
707
|
+
attributes: !!e.mutation.attributes,
|
|
708
|
+
characterData: !!e.mutation.characterData,
|
|
709
|
+
subtree: !!e.mutation.subtree,
|
|
710
|
+
selector: e.mutation.selector ?? null
|
|
711
|
+
} : null, a = e.resource ? {
|
|
712
|
+
resource: !!e.resource.resource,
|
|
713
|
+
navigation: !!e.resource.navigation,
|
|
714
|
+
paint: !!e.resource.paint,
|
|
715
|
+
longTask: !!e.resource.longTask
|
|
716
|
+
} : null;
|
|
717
|
+
return t.evaluate(
|
|
718
|
+
({ stableTime: o, timeout: i, mutation: h, resource: l }) => {
|
|
719
|
+
return new Promise((f, x) => {
|
|
720
|
+
let u = Date.now(), m = null, w = null;
|
|
721
|
+
const P = [];
|
|
722
|
+
function c() {
|
|
723
|
+
u = Date.now();
|
|
724
|
+
}
|
|
725
|
+
function p() {
|
|
726
|
+
m != null && (clearTimeout(m), m = null), w != null && (clearTimeout(w), w = null);
|
|
727
|
+
for (let y = 0, T = P.length; y < T; y++)
|
|
728
|
+
P[y]();
|
|
729
|
+
}
|
|
730
|
+
function E() {
|
|
731
|
+
const y = o - (Date.now() - u);
|
|
732
|
+
y <= 0 ? (p(), f()) : m = setTimeout(E, y);
|
|
733
|
+
}
|
|
734
|
+
if (h) {
|
|
735
|
+
const y = g(h, c);
|
|
736
|
+
P.push(y);
|
|
737
|
+
}
|
|
738
|
+
if (l) {
|
|
739
|
+
const y = d(l, c);
|
|
740
|
+
P.push(y);
|
|
741
|
+
}
|
|
742
|
+
m = setTimeout(E, o), w = setTimeout(() => {
|
|
743
|
+
p(), x(
|
|
744
|
+
new Error(
|
|
745
|
+
`[waitPageStable] timed out after ${i}ms waiting for page to stabilize`
|
|
746
|
+
)
|
|
747
|
+
);
|
|
748
|
+
}, i);
|
|
749
|
+
});
|
|
750
|
+
function g(f, x) {
|
|
751
|
+
const u = f.selector ? document.querySelector(f.selector) : document.documentElement;
|
|
752
|
+
if (!u)
|
|
753
|
+
throw new Error(
|
|
754
|
+
`[waitPageStable] element not found: ${f.selector}`
|
|
755
|
+
);
|
|
756
|
+
const m = new MutationObserver(x);
|
|
757
|
+
return m.observe(u, {
|
|
758
|
+
childList: f.childList,
|
|
759
|
+
attributes: f.attributes,
|
|
760
|
+
characterData: f.characterData,
|
|
761
|
+
subtree: f.subtree
|
|
762
|
+
}), () => {
|
|
763
|
+
m.disconnect();
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
function d(f, x) {
|
|
767
|
+
const u = [];
|
|
768
|
+
f.resource && u.push("resource"), f.navigation && u.push("navigation"), f.paint && u.push("paint"), f.longTask && u.push("longtask");
|
|
769
|
+
const m = new PerformanceObserver(x);
|
|
770
|
+
return m.observe({ entryTypes: u }), () => {
|
|
771
|
+
m.disconnect();
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
{ stableTime: n, timeout: s, mutation: r, resource: a }
|
|
776
|
+
);
|
|
777
|
+
}
|
|
621
778
|
async function Y(t, e) {
|
|
622
|
-
const n =
|
|
623
|
-
await
|
|
779
|
+
const n = M.dirname(t);
|
|
780
|
+
await I.promises.stat(n).catch(() => null) || await I.promises.mkdir(n, { recursive: !0 }), await I.promises.writeFile(t, JSON.stringify(e, null, 4), {
|
|
624
781
|
encoding: "utf-8"
|
|
625
782
|
});
|
|
626
783
|
}
|
|
627
|
-
async function
|
|
628
|
-
if (!await
|
|
784
|
+
async function Gt(t) {
|
|
785
|
+
if (!await I.promises.stat(t).catch(() => null))
|
|
629
786
|
return null;
|
|
630
|
-
const e = await
|
|
787
|
+
const e = await I.promises.readFile(t, { encoding: "utf-8" });
|
|
631
788
|
return JSON.parse(e);
|
|
632
789
|
}
|
|
633
|
-
const
|
|
634
|
-
function
|
|
790
|
+
const Q = "-", Z = "+";
|
|
791
|
+
function H(t, e, n) {
|
|
635
792
|
if (t === e)
|
|
636
793
|
return null;
|
|
637
794
|
if (Array.isArray(t)) {
|
|
638
795
|
if (Array.isArray(e)) {
|
|
639
796
|
let r = null;
|
|
640
797
|
for (let a = 0, o = Math.max(e.length, e.length); a < o; a++) {
|
|
641
|
-
const i =
|
|
798
|
+
const i = H(t[a], e[a], n);
|
|
642
799
|
i != null && (r || (r = []), r.push(i));
|
|
643
800
|
}
|
|
644
801
|
return r != null && n && (r = n(t, e, r)), r;
|
|
@@ -647,159 +804,159 @@ function G(t, e, n) {
|
|
|
647
804
|
let r = null;
|
|
648
805
|
for (const a in t)
|
|
649
806
|
if (Object.prototype.hasOwnProperty.call(t, a)) {
|
|
650
|
-
const o =
|
|
807
|
+
const o = H(t[a], e[a], n);
|
|
651
808
|
o != null && (r || (r = {}), r[a] = o);
|
|
652
809
|
}
|
|
653
810
|
for (const a in e)
|
|
654
811
|
if (Object.prototype.hasOwnProperty.call(e, a) && !Object.prototype.hasOwnProperty.call(t, a)) {
|
|
655
|
-
const o =
|
|
812
|
+
const o = H(t[a], e[a], n);
|
|
656
813
|
o != null && (r || (r = {}), r[a] = o);
|
|
657
814
|
}
|
|
658
815
|
return r != null && n && (r = n(t, e, r)), r;
|
|
659
816
|
}
|
|
660
817
|
let s = {
|
|
661
|
-
[
|
|
662
|
-
[
|
|
818
|
+
[Q]: t,
|
|
819
|
+
[Z]: e
|
|
663
820
|
};
|
|
664
821
|
return n && (s = n(t, e, s)), s;
|
|
665
822
|
}
|
|
666
|
-
function
|
|
667
|
-
function e(
|
|
668
|
-
return
|
|
823
|
+
function ot(t) {
|
|
824
|
+
function e(c) {
|
|
825
|
+
return c.sort((p, E) => p[0] > E[0] ? 1 : -1).reduce((p, E) => (p[E[0]] = E[1], p), {});
|
|
669
826
|
}
|
|
670
|
-
function n(
|
|
671
|
-
return
|
|
827
|
+
function n(c) {
|
|
828
|
+
return c.reduce((p, E) => (p[E] = !0, p), {});
|
|
672
829
|
}
|
|
673
|
-
const s = t.filters && t.filters.excludeAttrs && n(t.filters.excludeAttrs), r = t.filters && t.filters.fixAttrs, a = t.filters && t.filters.fixStyles, o = t.filters && t.filters.excludeStyles && n(t.filters.excludeStyles), i = t.filters && t.filters.fixTags,
|
|
674
|
-
let
|
|
830
|
+
const s = t.filters && t.filters.excludeAttrs && n(t.filters.excludeAttrs), r = t.filters && t.filters.fixAttrs, a = t.filters && t.filters.fixStyles, o = t.filters && t.filters.excludeStyles && n(t.filters.excludeStyles), i = t.filters && t.filters.fixTags, h = t.filters && t.filters.excludeClasses, l = t.filters && t.filters.excludeIds, g = t.filters && t.filters.excludeSelectorClasses, d = t.filters && t.filters.excludeSelectorIds;
|
|
831
|
+
let f;
|
|
675
832
|
if (t.filters && t.filters.excludeSelectors && t.filters.excludeSelectors.length > 0) {
|
|
676
|
-
const
|
|
833
|
+
const c = Array.from(
|
|
677
834
|
document.querySelectorAll(t.filters.excludeSelectors.join(","))
|
|
678
835
|
);
|
|
679
|
-
|
|
836
|
+
c.length > 0 && (f = new Set(c));
|
|
680
837
|
}
|
|
681
|
-
function
|
|
682
|
-
const
|
|
683
|
-
for (let
|
|
684
|
-
const
|
|
685
|
-
if (o && o[
|
|
838
|
+
function x(c, p, E, y) {
|
|
839
|
+
const T = getComputedStyle(c, p), S = [];
|
|
840
|
+
for (let k = 0, O = T.length; k < O; k++) {
|
|
841
|
+
const A = T[k];
|
|
842
|
+
if (o && o[A])
|
|
686
843
|
continue;
|
|
687
|
-
let
|
|
688
|
-
if (
|
|
689
|
-
for (let
|
|
690
|
-
a[
|
|
691
|
-
(!
|
|
844
|
+
let b = T[A];
|
|
845
|
+
if (b && a)
|
|
846
|
+
for (let j = 0, C = a.length; j < C; j++)
|
|
847
|
+
a[j].name.test(A) && (b = b.replace(a[j].search, a[j].replace));
|
|
848
|
+
(!E || E[A] !== b) && (!y || y[A] === b) && S.push([A, b]);
|
|
692
849
|
}
|
|
693
|
-
return e(
|
|
850
|
+
return e(S);
|
|
694
851
|
}
|
|
695
|
-
function
|
|
852
|
+
function u(c, p, E) {
|
|
696
853
|
return {
|
|
697
|
-
_:
|
|
698
|
-
|
|
854
|
+
_: x(
|
|
855
|
+
c,
|
|
699
856
|
void 0,
|
|
700
|
-
|
|
701
|
-
|
|
857
|
+
p && p._,
|
|
858
|
+
E && E._
|
|
702
859
|
),
|
|
703
|
-
before:
|
|
704
|
-
|
|
860
|
+
before: x(
|
|
861
|
+
c,
|
|
705
862
|
"before",
|
|
706
|
-
|
|
707
|
-
|
|
863
|
+
p && p.before,
|
|
864
|
+
E && E.before
|
|
708
865
|
),
|
|
709
|
-
after:
|
|
710
|
-
|
|
866
|
+
after: x(
|
|
867
|
+
c,
|
|
711
868
|
"after",
|
|
712
|
-
|
|
713
|
-
|
|
869
|
+
p && p.after,
|
|
870
|
+
E && E.after
|
|
714
871
|
)
|
|
715
872
|
};
|
|
716
873
|
}
|
|
717
|
-
function
|
|
718
|
-
for (let
|
|
719
|
-
const
|
|
720
|
-
if (!
|
|
874
|
+
function m(c, p, E, y, T) {
|
|
875
|
+
for (let S = 0, k = c.childNodes.length; S < k; S++) {
|
|
876
|
+
const O = c.childNodes[S];
|
|
877
|
+
if (!O)
|
|
721
878
|
throw new Error(
|
|
722
|
-
`child is null; index=${
|
|
879
|
+
`child is null; index=${S}; ${y}, ${c.className}\r
|
|
723
880
|
You should wait js executions before test`
|
|
724
881
|
);
|
|
725
|
-
|
|
726
|
-
|
|
882
|
+
O instanceof Element && w(
|
|
883
|
+
O,
|
|
884
|
+
p,
|
|
727
885
|
E,
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
O
|
|
886
|
+
y,
|
|
887
|
+
T
|
|
731
888
|
);
|
|
732
889
|
}
|
|
733
890
|
}
|
|
734
|
-
function
|
|
735
|
-
const
|
|
736
|
-
if (
|
|
891
|
+
function w(c, p, E, y, T) {
|
|
892
|
+
const S = T && T[p.length];
|
|
893
|
+
if (T && !S || f && f.has(c))
|
|
737
894
|
return;
|
|
738
|
-
let
|
|
739
|
-
if (
|
|
740
|
-
for (let
|
|
741
|
-
|
|
742
|
-
if (
|
|
895
|
+
let k = c.tagName && c.tagName.toLowerCase();
|
|
896
|
+
if (k === "head" && (E = !1), i)
|
|
897
|
+
for (let D = 0, W = i.length; D < W; D++)
|
|
898
|
+
k = k.replace(i[D].search, i[D].replace);
|
|
899
|
+
if (S && S.tag !== k)
|
|
743
900
|
return;
|
|
744
|
-
const
|
|
745
|
-
for (let
|
|
746
|
-
const R =
|
|
747
|
-
let _ = R.name,
|
|
901
|
+
const O = [];
|
|
902
|
+
for (let D = 0, W = c.attributes.length; D < W; D++) {
|
|
903
|
+
const R = c.attributes.item(D);
|
|
904
|
+
let _ = R.name, z = R.value;
|
|
748
905
|
if (_ = _.toLowerCase(), _ !== "class" && !(s && s[_])) {
|
|
749
906
|
if (r)
|
|
750
|
-
for (let
|
|
751
|
-
r[
|
|
752
|
-
(!
|
|
907
|
+
for (let v = 0, pt = r.length; v < pt; v++)
|
|
908
|
+
r[v].name.test(_) && (z = z.replace(r[v].search, r[v].replace));
|
|
909
|
+
(!S || S.attrs && S.attrs[_] === z) && O.push([_, z]);
|
|
753
910
|
}
|
|
754
911
|
}
|
|
755
|
-
const
|
|
756
|
-
for (let
|
|
757
|
-
const R =
|
|
758
|
-
(!
|
|
912
|
+
const A = [], b = [];
|
|
913
|
+
for (let D = 0, W = c.classList.length; D < W; D++) {
|
|
914
|
+
const R = c.classList.item(D);
|
|
915
|
+
(!h || !h.test(R)) && A.push(R), (!g || !g.test(R)) && b.push(R);
|
|
759
916
|
}
|
|
760
|
-
const
|
|
761
|
-
|
|
762
|
-
const
|
|
763
|
-
tag:
|
|
764
|
-
selector:
|
|
765
|
-
classes:
|
|
766
|
-
attrs:
|
|
767
|
-
style:
|
|
917
|
+
const j = E ? u(c, t.defaultStyle, S && S.style) : null, C = c.childElementCount ? [] : null;
|
|
918
|
+
c.id && (!l || !l.test(c.id)) && c.id;
|
|
919
|
+
const L = c.id && (!d || !d.test(c.id)) ? c.id : "", F = (k || "") + (L ? "#" + L : "") + (b.length > 0 ? "." + b.join(".") : ""), rt = F ? y ? y + " > " + F : F : y, yt = {
|
|
920
|
+
tag: k,
|
|
921
|
+
selector: rt,
|
|
922
|
+
classes: A,
|
|
923
|
+
attrs: O.length > 0 ? e(O) : null,
|
|
924
|
+
style: j,
|
|
768
925
|
childs: C
|
|
769
926
|
};
|
|
770
|
-
|
|
771
|
-
|
|
927
|
+
p.push(yt), C && m(
|
|
928
|
+
c,
|
|
772
929
|
C,
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
930
|
+
E,
|
|
931
|
+
rt,
|
|
932
|
+
S && S.childs
|
|
776
933
|
);
|
|
777
934
|
}
|
|
778
|
-
const
|
|
779
|
-
return
|
|
935
|
+
const P = [];
|
|
936
|
+
return w(
|
|
780
937
|
document.documentElement,
|
|
781
|
-
|
|
938
|
+
P,
|
|
782
939
|
!0,
|
|
783
940
|
"",
|
|
784
941
|
t.shouldEqualResult && [t.shouldEqualResult]
|
|
785
|
-
),
|
|
942
|
+
), P[0];
|
|
786
943
|
}
|
|
787
|
-
async function
|
|
944
|
+
async function ht(t) {
|
|
788
945
|
const e = await t.context().newCDPSession(t);
|
|
789
946
|
return await e.send("DOM.enable"), await e.send("CSS.enable"), e;
|
|
790
947
|
}
|
|
791
|
-
async function
|
|
948
|
+
async function dt(t) {
|
|
792
949
|
await t.send("CSS.disable"), await t.send("DOM.disable"), await t.detach();
|
|
793
950
|
}
|
|
794
|
-
async function
|
|
795
|
-
const n = await
|
|
951
|
+
async function pe(t, e) {
|
|
952
|
+
const n = await ht(t);
|
|
796
953
|
try {
|
|
797
954
|
return await e(n);
|
|
798
955
|
} finally {
|
|
799
|
-
await
|
|
956
|
+
await dt(n);
|
|
800
957
|
}
|
|
801
958
|
}
|
|
802
|
-
async function
|
|
959
|
+
async function Ht(t, e) {
|
|
803
960
|
const { nodes: n } = await t.send("DOM.getFlattenedDocument", {
|
|
804
961
|
depth: -1,
|
|
805
962
|
pierce: !0
|
|
@@ -810,7 +967,7 @@ async function $t(t, e) {
|
|
|
810
967
|
forcedPseudoClasses: e
|
|
811
968
|
});
|
|
812
969
|
}
|
|
813
|
-
function
|
|
970
|
+
function V(t, e) {
|
|
814
971
|
if (!t || !e)
|
|
815
972
|
return e || null;
|
|
816
973
|
let n = null;
|
|
@@ -820,17 +977,17 @@ function K(t, e) {
|
|
|
820
977
|
Object.prototype.hasOwnProperty.call(t, s) && !Object.prototype.hasOwnProperty.call(e, s) && (n || (n = {}), n[s] = "");
|
|
821
978
|
return n;
|
|
822
979
|
}
|
|
823
|
-
function
|
|
980
|
+
function Vt(t, e) {
|
|
824
981
|
if (!t || !e)
|
|
825
982
|
return e || null;
|
|
826
|
-
const n =
|
|
983
|
+
const n = V(t._, e._), s = V(t.before, e.before), r = V(t.after, e.after);
|
|
827
984
|
return !n && !s && !r ? null : {
|
|
828
985
|
_: n || {},
|
|
829
986
|
before: s || {},
|
|
830
987
|
after: r || {}
|
|
831
988
|
};
|
|
832
989
|
}
|
|
833
|
-
function
|
|
990
|
+
function Kt(t, e) {
|
|
834
991
|
if (!t || !e)
|
|
835
992
|
return e || null;
|
|
836
993
|
if (t.length !== e.length)
|
|
@@ -840,20 +997,20 @@ function zt(t, e) {
|
|
|
840
997
|
return e;
|
|
841
998
|
return null;
|
|
842
999
|
}
|
|
843
|
-
function
|
|
844
|
-
const n =
|
|
1000
|
+
function mt(t, e) {
|
|
1001
|
+
const n = Kt(t.classes, e.classes), s = V(t.attrs, e.attrs), r = Vt(t.style, e.style);
|
|
845
1002
|
let a = null;
|
|
846
1003
|
if (t.childs && e.childs) {
|
|
847
1004
|
const o = Math.min(t.childs.length, e.childs.length);
|
|
848
1005
|
for (let i = 0; i < o; i++) {
|
|
849
|
-
const
|
|
850
|
-
if (
|
|
1006
|
+
const h = mt(t.childs[i], e.childs[i]);
|
|
1007
|
+
if (h) {
|
|
851
1008
|
if (!a) {
|
|
852
1009
|
a = [];
|
|
853
|
-
for (let
|
|
1010
|
+
for (let l = 0; l < o; l++)
|
|
854
1011
|
a.push({});
|
|
855
1012
|
}
|
|
856
|
-
a[i] =
|
|
1013
|
+
a[i] = h;
|
|
857
1014
|
}
|
|
858
1015
|
}
|
|
859
1016
|
}
|
|
@@ -866,23 +1023,23 @@ function ut(t, e) {
|
|
|
866
1023
|
childs: a
|
|
867
1024
|
};
|
|
868
1025
|
}
|
|
869
|
-
const
|
|
1026
|
+
const K = (t, e, n, s) => {
|
|
870
1027
|
const r = s(t, e, n, s);
|
|
871
1028
|
if (r == null)
|
|
872
1029
|
return r;
|
|
873
1030
|
if (Array.isArray(r))
|
|
874
1031
|
return r.map(
|
|
875
|
-
(a, o, i) =>
|
|
1032
|
+
(a, o, i) => K(a, o, i, s)
|
|
876
1033
|
);
|
|
877
1034
|
if (typeof r == "object") {
|
|
878
1035
|
const a = {};
|
|
879
1036
|
for (const o in r)
|
|
880
|
-
Object.prototype.hasOwnProperty.call(r, o) && (a[o] =
|
|
1037
|
+
Object.prototype.hasOwnProperty.call(r, o) && (a[o] = K(r[o], o, r, s));
|
|
881
1038
|
return a;
|
|
882
1039
|
}
|
|
883
1040
|
return r;
|
|
884
1041
|
};
|
|
885
|
-
function
|
|
1042
|
+
function wt(t, e) {
|
|
886
1043
|
if (t.attrs && e.excludeAttrs) {
|
|
887
1044
|
for (let n = 0, s = e.excludeAttrs.length; n < s; n++)
|
|
888
1045
|
delete t.attrs[e.excludeAttrs[n]];
|
|
@@ -899,9 +1056,9 @@ function ft(t, e) {
|
|
|
899
1056
|
}
|
|
900
1057
|
if (t.childs)
|
|
901
1058
|
for (let n = 0, s = t.childs.length; n < s; n++)
|
|
902
|
-
|
|
1059
|
+
wt(t.childs[n], e);
|
|
903
1060
|
}
|
|
904
|
-
function
|
|
1061
|
+
function qt(t, e) {
|
|
905
1062
|
for (const n in t) {
|
|
906
1063
|
if (!Object.prototype.hasOwnProperty.call(t, n)) continue;
|
|
907
1064
|
const s = t[n];
|
|
@@ -909,11 +1066,11 @@ function Jt(t, e) {
|
|
|
909
1066
|
if (!Object.prototype.hasOwnProperty.call(s, r)) continue;
|
|
910
1067
|
const a = s[r];
|
|
911
1068
|
for (const o in a)
|
|
912
|
-
Object.prototype.hasOwnProperty.call(a, o) &&
|
|
1069
|
+
Object.prototype.hasOwnProperty.call(a, o) && wt(a[o], e);
|
|
913
1070
|
}
|
|
914
1071
|
}
|
|
915
1072
|
}
|
|
916
|
-
function
|
|
1073
|
+
function be({
|
|
917
1074
|
actualResultFile: t,
|
|
918
1075
|
expectedResultFile: e,
|
|
919
1076
|
diffResultFile: n,
|
|
@@ -921,269 +1078,273 @@ function le({
|
|
|
921
1078
|
transform: r,
|
|
922
1079
|
pseudoStates: a
|
|
923
1080
|
}) {
|
|
924
|
-
let o, i,
|
|
1081
|
+
let o, i, h, l = {};
|
|
925
1082
|
return {
|
|
926
|
-
async init(
|
|
927
|
-
o = await
|
|
1083
|
+
async init(g) {
|
|
1084
|
+
o = await Gt(e), r && (o = K(o, null, null, r)), o && s && qt(o, s), await g.goto("about:blank"), i = await g.evaluate(ot, { filters: s }), h = i.style;
|
|
928
1085
|
},
|
|
929
1086
|
async handlePage({
|
|
930
|
-
page:
|
|
931
|
-
testId:
|
|
932
|
-
url:
|
|
933
|
-
stateId:
|
|
934
|
-
_filters:
|
|
1087
|
+
page: g,
|
|
1088
|
+
testId: d,
|
|
1089
|
+
url: f,
|
|
1090
|
+
stateId: x,
|
|
1091
|
+
_filters: u
|
|
935
1092
|
}) {
|
|
936
|
-
let
|
|
937
|
-
|
|
938
|
-
let
|
|
939
|
-
|
|
1093
|
+
let m = l[d];
|
|
1094
|
+
m || (m = {}, l[d] = m);
|
|
1095
|
+
let w = m[f.href];
|
|
1096
|
+
w || (w = {}, m[f.href] = w), await g.addStyleTag({
|
|
940
1097
|
content: "*, *::before, *::after { animation-name: none!important; transition-duration: 0s !important; }"
|
|
941
1098
|
});
|
|
942
|
-
const
|
|
943
|
-
let
|
|
1099
|
+
const P = a ?? [{ states: [] }];
|
|
1100
|
+
let c = null, p;
|
|
944
1101
|
try {
|
|
945
|
-
for (let
|
|
946
|
-
const
|
|
947
|
-
let
|
|
948
|
-
if (
|
|
949
|
-
|
|
950
|
-
const
|
|
951
|
-
await
|
|
1102
|
+
for (let E = 0; E < P.length; E++) {
|
|
1103
|
+
const y = P[E], T = y.states.length > 0 ? x + ":" + y.states.join(":") : x;
|
|
1104
|
+
let S = null;
|
|
1105
|
+
if (y.states.length > 0) {
|
|
1106
|
+
c || (c = await ht(g));
|
|
1107
|
+
const b = performance.now();
|
|
1108
|
+
await Ht(c, y.states), S = performance.now() - b;
|
|
952
1109
|
}
|
|
953
|
-
|
|
954
|
-
const
|
|
955
|
-
filters:
|
|
956
|
-
defaultStyle:
|
|
957
|
-
shouldEqualResult:
|
|
958
|
-
}),
|
|
1110
|
+
y.delay && await it(y.delay);
|
|
1111
|
+
const k = performance.now(), O = await g.evaluate(ot, {
|
|
1112
|
+
filters: u || s,
|
|
1113
|
+
defaultStyle: h,
|
|
1114
|
+
shouldEqualResult: w[T]
|
|
1115
|
+
}), A = performance.now() - k;
|
|
959
1116
|
if (console.log(
|
|
960
|
-
`SNAPSHOT ${
|
|
961
|
-
), !
|
|
962
|
-
|
|
1117
|
+
`SNAPSHOT ${T}:` + (S != null ? ` forcePseudoClasses ${S.toFixed(0)}ms,` : "") + ` getAllElements ${A.toFixed(0)}ms`
|
|
1118
|
+
), !p)
|
|
1119
|
+
p = O, w[T] = O;
|
|
963
1120
|
else {
|
|
964
|
-
const
|
|
965
|
-
|
|
1121
|
+
const b = mt(p, O);
|
|
1122
|
+
b && (w[T] = b);
|
|
966
1123
|
}
|
|
967
1124
|
}
|
|
968
1125
|
} finally {
|
|
969
|
-
|
|
1126
|
+
c && await dt(c);
|
|
970
1127
|
}
|
|
971
1128
|
},
|
|
972
|
-
async end({ checkExistUrlsOnly:
|
|
973
|
-
if (
|
|
974
|
-
let
|
|
975
|
-
if (!
|
|
976
|
-
|
|
1129
|
+
async end({ checkExistUrlsOnly: g }) {
|
|
1130
|
+
if (l = Et(l), r && (l = K(l, null, null, r)), o) {
|
|
1131
|
+
let d, f;
|
|
1132
|
+
if (!g)
|
|
1133
|
+
d = o, f = l;
|
|
977
1134
|
else {
|
|
978
|
-
|
|
979
|
-
for (const
|
|
980
|
-
if (Object.prototype.hasOwnProperty.call(o,
|
|
981
|
-
|
|
982
|
-
for (const
|
|
983
|
-
Object.prototype.hasOwnProperty.call(o[
|
|
1135
|
+
d = {}, f = {};
|
|
1136
|
+
for (const u in o)
|
|
1137
|
+
if (Object.prototype.hasOwnProperty.call(o, u) && Object.prototype.hasOwnProperty.call(l, u)) {
|
|
1138
|
+
d[u] = {}, f[u] = {};
|
|
1139
|
+
for (const m in o[u])
|
|
1140
|
+
Object.prototype.hasOwnProperty.call(o[u], m) && Object.prototype.hasOwnProperty.call(l[u], m) && (d[u][m] = o[u][m], f[u][m] = l[u][m]);
|
|
984
1141
|
}
|
|
985
1142
|
}
|
|
986
|
-
const
|
|
1143
|
+
const x = H(
|
|
1144
|
+
d,
|
|
987
1145
|
f,
|
|
988
|
-
|
|
989
|
-
(h, w, m) => m.selector && (delete m.selector, Object.keys(m).length === 0) ? null : m.childs && m.childs.length === 1 ? m.childs[0] : (w && w.selector ? m[Q] ? m[Q] = w.selector : m = { selector: w.selector, ...m } : h && h.selector && (m[X] ? m[X] = h.selector : m = { selector: h.selector, ...m }), m)
|
|
1146
|
+
(u, m, w) => w.selector && (delete w.selector, Object.keys(w).length === 0) ? null : w.childs && w.childs.length === 1 ? w.childs[0] : (m && m.selector ? w[Z] ? w[Z] = m.selector : w = { selector: m.selector, ...w } : u && u.selector && (w[Q] ? w[Q] = u.selector : w = { selector: u.selector, ...w }), w)
|
|
990
1147
|
);
|
|
991
|
-
if (n && await Y(n,
|
|
992
|
-
throw await Y(t,
|
|
993
|
-
"Pages elements changes: " + JSON.stringify(
|
|
1148
|
+
if (n && await Y(n, x || {}), x)
|
|
1149
|
+
throw await Y(t, l), console.error(
|
|
1150
|
+
"Pages elements changes: " + JSON.stringify(x, null, 4).substring(0, 5e3)
|
|
994
1151
|
), new Error("Pages elements changes detected");
|
|
995
|
-
await
|
|
1152
|
+
await I.promises.stat(t).catch(() => null) && await I.promises.unlink(t);
|
|
996
1153
|
} else
|
|
997
|
-
await Y(e,
|
|
998
|
-
return
|
|
1154
|
+
await Y(e, l);
|
|
1155
|
+
return l;
|
|
999
1156
|
}
|
|
1000
1157
|
};
|
|
1001
1158
|
}
|
|
1002
1159
|
export {
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1160
|
+
Se as CheckError,
|
|
1161
|
+
xe as ConsoleMessageLevel,
|
|
1162
|
+
Z as DIFF_NEW,
|
|
1163
|
+
Q as DIFF_OLD,
|
|
1164
|
+
ke as Lazy,
|
|
1165
|
+
Oe as LazyWithId,
|
|
1166
|
+
Te as LogLevel,
|
|
1167
|
+
Pe as MAX_REPORT_ITEMS_DEFAULT,
|
|
1168
|
+
Ce as MatchInternalError,
|
|
1169
|
+
Ae as Matcher,
|
|
1170
|
+
je as MatcherAny,
|
|
1171
|
+
De as MatcherArray,
|
|
1172
|
+
Le as MatcherArrayItem,
|
|
1173
|
+
Me as MatcherConvert,
|
|
1174
|
+
Ie as MatcherCustom,
|
|
1175
|
+
Fe as MatcherFew,
|
|
1176
|
+
Re as MatcherIn,
|
|
1177
|
+
_e as MatcherInstanceOf,
|
|
1178
|
+
$e as MatcherIs,
|
|
1179
|
+
Ne as MatcherNever,
|
|
1180
|
+
We as MatcherNot,
|
|
1181
|
+
ve as MatcherNumber,
|
|
1182
|
+
Be as MatcherObject,
|
|
1183
|
+
ze as MatcherObjectEntry,
|
|
1184
|
+
Je as MatcherRef,
|
|
1185
|
+
Ue as MatcherString,
|
|
1186
|
+
Ge as Random,
|
|
1187
|
+
He as Subject,
|
|
1188
|
+
Ve as SubjectWithId,
|
|
1189
|
+
Ke as UNIQUE_PSEUDO_RANDOM_MAX_COUNT,
|
|
1190
|
+
qe as alertConsole,
|
|
1191
|
+
Ye as alertReplace,
|
|
1192
|
+
Xe as argsToString,
|
|
1193
|
+
Qe as check,
|
|
1194
|
+
Ze as checkFunc,
|
|
1195
|
+
$t as checkPageHttpErrors,
|
|
1196
|
+
me as clickAll,
|
|
1197
|
+
tr as consoleIntercept,
|
|
1198
|
+
er as consoleMessageToString,
|
|
1199
|
+
rr as consoleReplace,
|
|
1200
|
+
nr as convertTimeZone,
|
|
1201
|
+
ht as createCDPSession,
|
|
1202
|
+
ce as createMatchPath,
|
|
1203
|
+
sr as createMatchResult,
|
|
1204
|
+
ar as createMatchResultBoolean,
|
|
1205
|
+
or as createMatchResultError,
|
|
1206
|
+
be as createPagesElementsChangesTest,
|
|
1207
|
+
ir as createTaskDelayRetry,
|
|
1208
|
+
Ut as createTestE2e,
|
|
1209
|
+
we as createTestE2eVariants,
|
|
1210
|
+
cr as createUniquePseudoRandom,
|
|
1211
|
+
lr as dateNowUnique,
|
|
1212
|
+
ur as deepCloneJsonLike,
|
|
1213
|
+
fr as deepEqualJsonLike,
|
|
1214
|
+
hr as deepEqualJsonLikeMap,
|
|
1215
|
+
Wt as delayOnErrorCall,
|
|
1216
|
+
fe as delayOnErrorSet,
|
|
1217
|
+
he as delayOnErrorWait,
|
|
1218
|
+
dt as destroyCDPSession,
|
|
1219
|
+
dr as equalArray,
|
|
1220
|
+
mr as escapeHtml,
|
|
1221
|
+
wr as escapeRegExp,
|
|
1222
|
+
Rt as exec,
|
|
1223
|
+
yr as expectedToString,
|
|
1224
|
+
oe as fileLock,
|
|
1225
|
+
pr as filterMatchResult,
|
|
1226
|
+
br as filterMatchResultNested,
|
|
1227
|
+
gr as fixStackTrace,
|
|
1228
|
+
Ht as forcePseudoClasses,
|
|
1229
|
+
Er as formatAny,
|
|
1230
|
+
Sr as formatDate,
|
|
1231
|
+
xr as formatDateFileName,
|
|
1232
|
+
ot as getAllElements,
|
|
1233
|
+
kr as getConsoleMessages,
|
|
1234
|
+
Or as getDateInet,
|
|
1235
|
+
At as getDrive,
|
|
1236
|
+
mt as getElementsStyleDiff,
|
|
1077
1237
|
jt as getFileId,
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1238
|
+
Et as getNormalizedObject,
|
|
1239
|
+
Tr as getObjectId,
|
|
1240
|
+
H as getObjectsDiff,
|
|
1241
|
+
_t as getPageHttpErrors,
|
|
1242
|
+
Pr as getRandomFunc,
|
|
1243
|
+
Cr as getRandomSeed,
|
|
1244
|
+
gt as getStackTrace,
|
|
1245
|
+
Mt as globGitIgnoreToPicomatch,
|
|
1246
|
+
It as globToRelative,
|
|
1247
|
+
vt as initPage,
|
|
1248
|
+
Ar as isMatcher,
|
|
1249
|
+
jr as isObservable,
|
|
1250
|
+
le as loadGlobs,
|
|
1251
|
+
Ft as loadGlobsFromFile,
|
|
1252
|
+
Gt as loadJson,
|
|
1253
|
+
Dr as match,
|
|
1254
|
+
Lr as matchAnd,
|
|
1255
|
+
Mr as matchAndPipe,
|
|
1256
|
+
Ir as matchAny,
|
|
1257
|
+
Fr as matchArray,
|
|
1258
|
+
Rr as matchArrayBuffer,
|
|
1259
|
+
_r as matchArrayIncludes,
|
|
1260
|
+
$r as matchArrayItem,
|
|
1261
|
+
Nr as matchArrayLength,
|
|
1262
|
+
Wr as matchArrayWith,
|
|
1263
|
+
vr as matchBoolean,
|
|
1264
|
+
Br as matchConstructor,
|
|
1265
|
+
zr as matchConvert,
|
|
1266
|
+
Jr as matchCustom,
|
|
1267
|
+
Ur as matchDeep,
|
|
1268
|
+
Gr as matchEnum,
|
|
1269
|
+
Hr as matchFloat,
|
|
1270
|
+
Vr as matchIn,
|
|
1271
|
+
Kr as matchInstanceOf,
|
|
1272
|
+
qr as matchInt,
|
|
1273
|
+
Yr as matchIntDate,
|
|
1274
|
+
Xr as matchIs,
|
|
1275
|
+
Qr as matchIsNonStrict,
|
|
1276
|
+
Zr as matchNever,
|
|
1277
|
+
tn as matchNot,
|
|
1278
|
+
en as matchNotNullish,
|
|
1279
|
+
rn as matchNullish,
|
|
1280
|
+
nn as matchNumber,
|
|
1281
|
+
sn as matchObject,
|
|
1282
|
+
an as matchObjectEntries,
|
|
1283
|
+
on as matchObjectEntry,
|
|
1284
|
+
cn as matchObjectKey,
|
|
1285
|
+
ln as matchObjectKeyValue,
|
|
1286
|
+
un as matchObjectKeys,
|
|
1287
|
+
fn as matchObjectKeysNotNull,
|
|
1288
|
+
hn as matchObjectPartial,
|
|
1289
|
+
dn as matchObjectValue,
|
|
1290
|
+
mn as matchObjectValues,
|
|
1291
|
+
wn as matchObjectWith,
|
|
1292
|
+
yn as matchOptional,
|
|
1293
|
+
pn as matchOr,
|
|
1294
|
+
bn as matchOrPipe,
|
|
1295
|
+
gn as matchRange,
|
|
1296
|
+
En as matchRangeDate,
|
|
1297
|
+
Sn as matchRef,
|
|
1298
|
+
xn as matchResultNestedToString,
|
|
1299
|
+
kn as matchResultToString,
|
|
1300
|
+
On as matchString,
|
|
1301
|
+
Tn as matchStringLength,
|
|
1302
|
+
Pn as matchTypeOf,
|
|
1303
|
+
Cn as matchUuid,
|
|
1304
|
+
An as matchValueState,
|
|
1305
|
+
jn as max,
|
|
1306
|
+
Dn as min,
|
|
1307
|
+
Ln as minMax,
|
|
1308
|
+
ue as nodeBeep,
|
|
1309
|
+
Mn as numberMod,
|
|
1310
|
+
K as objectTransform,
|
|
1311
|
+
N as pathNormalize,
|
|
1312
|
+
Dt as pathResolve,
|
|
1313
|
+
et as poolFs,
|
|
1314
|
+
In as randomBoolean,
|
|
1315
|
+
Fn as randomEnum,
|
|
1316
|
+
Rn as randomFloat,
|
|
1317
|
+
_n as randomIndexWeighted,
|
|
1318
|
+
$n as randomInt,
|
|
1319
|
+
Nn as randomItem,
|
|
1320
|
+
Wn as randomItems,
|
|
1161
1321
|
Y as saveJson,
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1322
|
+
vn as setFuncName,
|
|
1323
|
+
ft as setPlaywrightPriorityLow,
|
|
1324
|
+
Bn as sha256,
|
|
1325
|
+
zn as sha256Buffer,
|
|
1326
|
+
Nt as subscribeJsErrors,
|
|
1327
|
+
Bt as testPage,
|
|
1328
|
+
Jn as timeoutAbortController,
|
|
1329
|
+
Un as toHex,
|
|
1330
|
+
Gn as truncateString,
|
|
1331
|
+
Hn as urlGetBoolean,
|
|
1332
|
+
Vn as urlGetFloat,
|
|
1333
|
+
Kn as urlGetInt,
|
|
1334
|
+
qn as urlGetParams,
|
|
1335
|
+
Yn as urlGetString,
|
|
1336
|
+
Xn as urlParamToBoolean,
|
|
1337
|
+
Qn as urlParamToFloat,
|
|
1338
|
+
Zn as urlParamToInt,
|
|
1339
|
+
de as useBrowser,
|
|
1340
|
+
zt as useBrowserContext,
|
|
1341
|
+
pe as usingCDPSession,
|
|
1342
|
+
ts as validateMatchResult,
|
|
1343
|
+
es as waitObservable,
|
|
1344
|
+
ye as waitPageStable,
|
|
1345
|
+
Lt as walkPathHandleErrorDefault,
|
|
1346
|
+
ie as walkPaths,
|
|
1347
|
+
rs as withConsoleReplace,
|
|
1348
|
+
ns as withRetry,
|
|
1349
|
+
bt as withTimeout
|
|
1189
1350
|
};
|