@piwitests/reporter 0.69.0 → 0.70.0
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/README.md +5 -1
- package/dist/cli/index.js +166 -121
- package/dist/index.d.ts +10 -9
- package/dist/index.js +243 -143
- package/dist/internal/capture/capture-fixtures.d.ts +133 -8
- package/dist/internal/capture/capture-fixtures.js +95 -22
- package/package.json +1 -1
- package/dist/internal/capture/attachments.d.ts +0 -67
- package/dist/internal/capture/attachments.js +0 -90
- package/dist/internal/capture/inspect-on-failure.d.ts +0 -50
- package/dist/internal/capture/inspect-on-failure.js +0 -72
- package/dist/internal/capture/locator-healing.d.ts +0 -368
- package/dist/internal/capture/locator-healing.js +0 -833
- package/dist/internal/capture/pick-on-failure.d.ts +0 -272
- package/dist/internal/capture/pick-on-failure.js +0 -1820
- package/dist/types-CGr9jJZ_.d.ts +0 -87
- package/dist/wire-7zsqlBoY.d.ts +0 -48
|
@@ -1,833 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/internal/capture/locator-healing.ts
|
|
31
|
-
var locator_healing_exports = {};
|
|
32
|
-
__export(locator_healing_exports, {
|
|
33
|
-
ACTION_METHODS: () => ACTION_METHODS,
|
|
34
|
-
CAPTURED_ATTRIBUTES: () => CAPTURED_ATTRIBUTES,
|
|
35
|
-
CHAIN_METHODS: () => CHAIN_METHODS,
|
|
36
|
-
EXPECT_CAPTURE_EXPRESSIONS: () => EXPECT_CAPTURE_EXPRESSIONS,
|
|
37
|
-
EXPECT_METHOD: () => EXPECT_METHOD,
|
|
38
|
-
FORM_FIELD_TAGS: () => FORM_FIELD_TAGS,
|
|
39
|
-
INPUT_TYPE_TO_ROLE: () => INPUT_TYPE_TO_ROLE,
|
|
40
|
-
LOCATOR_CREATING_CHAINS: () => LOCATOR_CREATING_CHAINS,
|
|
41
|
-
LOCATOR_METHODS: () => LOCATOR_METHODS,
|
|
42
|
-
TAG_TO_ROLE: () => TAG_TO_ROLE,
|
|
43
|
-
approximateAccessibleName: () => approximateAccessibleName,
|
|
44
|
-
callSitePath: () => callSitePath,
|
|
45
|
-
captureCallerLocation: () => captureCallerLocation,
|
|
46
|
-
classifyCssStability: () => classifyCssStability,
|
|
47
|
-
dedupeSnapshotsByLocation: () => dedupeSnapshotsByLocation,
|
|
48
|
-
exactAccessibleName: () => exactAccessibleName,
|
|
49
|
-
extractAccessibleName: () => extractAccessibleName,
|
|
50
|
-
framePath: () => framePath,
|
|
51
|
-
generateAlternatives: () => generateAlternatives,
|
|
52
|
-
headingLevel: () => headingLevel,
|
|
53
|
-
isAutoGenerated: () => isAutoGenerated,
|
|
54
|
-
renderFailing: () => renderFailing,
|
|
55
|
-
resolveAriaRole: () => resolveAriaRole,
|
|
56
|
-
suggestLocatorsFromAria: () => suggestLocatorsFromAria
|
|
57
|
-
});
|
|
58
|
-
module.exports = __toCommonJS(locator_healing_exports);
|
|
59
|
-
var path = __toESM(require("path"));
|
|
60
|
-
var import_node_url = require("url");
|
|
61
|
-
|
|
62
|
-
// ../core/src/locator-chain.ts
|
|
63
|
-
var LOCATING_METHODS = /* @__PURE__ */ new Set([
|
|
64
|
-
"getByRole",
|
|
65
|
-
"getByTestId",
|
|
66
|
-
"getByText",
|
|
67
|
-
"getByLabel",
|
|
68
|
-
"getByPlaceholder",
|
|
69
|
-
"getByAltText",
|
|
70
|
-
"getByTitle",
|
|
71
|
-
"locator",
|
|
72
|
-
"frameLocator"
|
|
73
|
-
]);
|
|
74
|
-
var NARROWING_METHODS = /* @__PURE__ */ new Set([
|
|
75
|
-
"filter",
|
|
76
|
-
"first",
|
|
77
|
-
"last",
|
|
78
|
-
"nth",
|
|
79
|
-
"and",
|
|
80
|
-
"or",
|
|
81
|
-
"visible",
|
|
82
|
-
"contentFrame",
|
|
83
|
-
"owner"
|
|
84
|
-
]);
|
|
85
|
-
var LOCATOR_CHAIN_METHODS = /* @__PURE__ */ new Set([...LOCATING_METHODS, ...NARROWING_METHODS]);
|
|
86
|
-
function quoteJsString(value) {
|
|
87
|
-
const json = JSON.stringify(value).slice(1, -1);
|
|
88
|
-
return `'${json.replace(/\\"/g, '"').replace(/'/g, "\\'").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029")}'`;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// ../core/src/locator-fingerprint.ts
|
|
92
|
-
var PRESENT_SIMILARITY = 0.8;
|
|
93
|
-
var MATCH_SIMILARITY = 0.2;
|
|
94
|
-
function parseAriaCandidates(ariaSnapshot) {
|
|
95
|
-
if (!ariaSnapshot) return [];
|
|
96
|
-
const out = [];
|
|
97
|
-
for (const line of ariaSnapshot.split("\n")) {
|
|
98
|
-
const m = line.match(/^\s*-\s+([a-z]+)(?:\s+"((?:[^"\\]|\\.)*)")?/i);
|
|
99
|
-
if (!m) continue;
|
|
100
|
-
const role = m[1];
|
|
101
|
-
const name = m[2] != null ? m[2].replace(/\\(.)/g, "$1") : null;
|
|
102
|
-
if (!name && (role === "generic" || role === "group" || role === "list" || role === "paragraph")) continue;
|
|
103
|
-
const levelMatch = line.slice(m[0].length).match(/\[level=(\d+)\]/);
|
|
104
|
-
const level = levelMatch ? Number(levelMatch[1]) : null;
|
|
105
|
-
out.push({ role, name, level });
|
|
106
|
-
}
|
|
107
|
-
return out;
|
|
108
|
-
}
|
|
109
|
-
function textSimilarity(a, b) {
|
|
110
|
-
const tok = (s) => new Set(
|
|
111
|
-
(s ?? "").toLowerCase().split(/[^a-z0-9]+/i).filter(Boolean)
|
|
112
|
-
);
|
|
113
|
-
const sa = tok(a);
|
|
114
|
-
const sb = tok(b);
|
|
115
|
-
if (sa.size === 0 && sb.size === 0) return 1;
|
|
116
|
-
if (sa.size === 0 || sb.size === 0) return 0;
|
|
117
|
-
let common = 0;
|
|
118
|
-
for (const t of sa) if (sb.has(t)) common++;
|
|
119
|
-
return 2 * common / (sa.size + sb.size);
|
|
120
|
-
}
|
|
121
|
-
var FUNCTION_WORDS = new Set(
|
|
122
|
-
"the and for with from your you our this that les des une pour avec par sur aux dans vos votre nos notre".split(" ")
|
|
123
|
-
);
|
|
124
|
-
function significantWords(text) {
|
|
125
|
-
const all = (text ?? "").replace(new RegExp("(\\p{Ll})(\\p{Lu})", "gu"), "$1 $2").toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);
|
|
126
|
-
const meaningful = all.filter((w) => w.length >= 3 && !FUNCTION_WORDS.has(w));
|
|
127
|
-
return new Set(meaningful.length > 0 ? meaningful : all);
|
|
128
|
-
}
|
|
129
|
-
function significantWordSimilarity(a, b) {
|
|
130
|
-
const sa = significantWords(a);
|
|
131
|
-
const sb = significantWords(b);
|
|
132
|
-
if (sa.size === 0 && sb.size === 0) return 1;
|
|
133
|
-
if (sa.size === 0 || sb.size === 0) return 0;
|
|
134
|
-
let common = 0;
|
|
135
|
-
for (const w of sa) if (sb.has(w)) common++;
|
|
136
|
-
return 2 * common / (sa.size + sb.size);
|
|
137
|
-
}
|
|
138
|
-
function fingerprintPresent(fp, candidates) {
|
|
139
|
-
if (!fp.name) return false;
|
|
140
|
-
return candidates.some(
|
|
141
|
-
(c) => (!fp.role || c.role === fp.role) && textSimilarity(c.name, fp.name) >= PRESENT_SIMILARITY
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
function matchRenamedElement(fp, candidates) {
|
|
145
|
-
if (candidates.length === 0) return null;
|
|
146
|
-
const sameRole = fp.role ? candidates.filter((c) => c.role === fp.role) : candidates;
|
|
147
|
-
if (sameRole.length === 0) return null;
|
|
148
|
-
let pool = sameRole;
|
|
149
|
-
if (fp.level != null) {
|
|
150
|
-
const sameLevel = sameRole.filter((c) => c.level === fp.level);
|
|
151
|
-
if (sameLevel.length > 0) pool = sameLevel;
|
|
152
|
-
}
|
|
153
|
-
if (pool.length === 1) {
|
|
154
|
-
return { candidate: pool[0], confidence: 0.7 };
|
|
155
|
-
}
|
|
156
|
-
let best = null;
|
|
157
|
-
let bestScore = -1;
|
|
158
|
-
for (const c of pool) {
|
|
159
|
-
const s = significantWordSimilarity(c.name, fp.name);
|
|
160
|
-
if (s > bestScore) {
|
|
161
|
-
bestScore = s;
|
|
162
|
-
best = c;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (best && bestScore >= MATCH_SIMILARITY) return { candidate: best, confidence: bestScore };
|
|
166
|
-
const pos = fp.rolePosition;
|
|
167
|
-
if (pos && fp.role && pos.role === fp.role && sameRole.length >= 2 && sameRole.length === pos.count) {
|
|
168
|
-
const byIndex = sameRole[pos.index];
|
|
169
|
-
if (byIndex) return { candidate: byIndex, confidence: 0.5 };
|
|
170
|
-
}
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// ../core/src/locator-methods.ts
|
|
175
|
-
var LOCATOR_BUILDER_METHODS = [
|
|
176
|
-
"getByRole",
|
|
177
|
-
"getByTestId",
|
|
178
|
-
"getByText",
|
|
179
|
-
"getByLabel",
|
|
180
|
-
"getByPlaceholder",
|
|
181
|
-
"getByAltText",
|
|
182
|
-
"getByTitle",
|
|
183
|
-
"locator"
|
|
184
|
-
];
|
|
185
|
-
|
|
186
|
-
// ../core/src/locator-generation.ts
|
|
187
|
-
var TAG_TO_ROLE = {
|
|
188
|
-
a: "link",
|
|
189
|
-
button: "button",
|
|
190
|
-
nav: "navigation",
|
|
191
|
-
main: "main",
|
|
192
|
-
article: "article",
|
|
193
|
-
section: "region",
|
|
194
|
-
form: "form",
|
|
195
|
-
img: "img",
|
|
196
|
-
figure: "figure",
|
|
197
|
-
figcaption: "caption",
|
|
198
|
-
blockquote: "blockquote",
|
|
199
|
-
table: "table",
|
|
200
|
-
caption: "caption",
|
|
201
|
-
thead: "rowgroup",
|
|
202
|
-
tbody: "rowgroup",
|
|
203
|
-
tfoot: "rowgroup",
|
|
204
|
-
tr: "row",
|
|
205
|
-
td: "cell",
|
|
206
|
-
ul: "list",
|
|
207
|
-
ol: "list",
|
|
208
|
-
li: "listitem",
|
|
209
|
-
dialog: "dialog",
|
|
210
|
-
output: "status",
|
|
211
|
-
progress: "progressbar",
|
|
212
|
-
meter: "meter",
|
|
213
|
-
textarea: "textbox",
|
|
214
|
-
h1: "heading",
|
|
215
|
-
h2: "heading",
|
|
216
|
-
h3: "heading",
|
|
217
|
-
h4: "heading",
|
|
218
|
-
h5: "heading",
|
|
219
|
-
h6: "heading",
|
|
220
|
-
details: "group",
|
|
221
|
-
summary: "button",
|
|
222
|
-
search: "search"
|
|
223
|
-
};
|
|
224
|
-
var INPUT_TYPE_TO_ROLE = {
|
|
225
|
-
button: "button",
|
|
226
|
-
submit: "button",
|
|
227
|
-
reset: "button",
|
|
228
|
-
image: "button",
|
|
229
|
-
checkbox: "checkbox",
|
|
230
|
-
radio: "radio",
|
|
231
|
-
range: "slider",
|
|
232
|
-
search: "searchbox",
|
|
233
|
-
number: "spinbutton",
|
|
234
|
-
text: "textbox",
|
|
235
|
-
email: "textbox",
|
|
236
|
-
tel: "textbox",
|
|
237
|
-
url: "textbox",
|
|
238
|
-
password: "textbox"
|
|
239
|
-
};
|
|
240
|
-
var CAPTURED_ATTRIBUTES = [
|
|
241
|
-
"id",
|
|
242
|
-
"class",
|
|
243
|
-
"name",
|
|
244
|
-
"data-testid",
|
|
245
|
-
"placeholder",
|
|
246
|
-
"alt",
|
|
247
|
-
"title",
|
|
248
|
-
"aria-label",
|
|
249
|
-
"aria-labelledby",
|
|
250
|
-
"aria-level",
|
|
251
|
-
"role",
|
|
252
|
-
"type",
|
|
253
|
-
"href",
|
|
254
|
-
"multiple"
|
|
255
|
-
];
|
|
256
|
-
function resolveAriaRole(attrs) {
|
|
257
|
-
const explicit = attrs.attributes["role"];
|
|
258
|
-
if (explicit) return explicit;
|
|
259
|
-
const tag = attrs.tagName;
|
|
260
|
-
if (!tag) return null;
|
|
261
|
-
if (tag === "input") {
|
|
262
|
-
const type = (attrs.attributes["type"] ?? "text").toLowerCase();
|
|
263
|
-
return INPUT_TYPE_TO_ROLE[type] ?? "textbox";
|
|
264
|
-
}
|
|
265
|
-
if (tag === "select") {
|
|
266
|
-
return attrs.attributes["multiple"] != null ? "listbox" : "combobox";
|
|
267
|
-
}
|
|
268
|
-
if (tag === "a") {
|
|
269
|
-
return attrs.attributes["href"] != null ? "link" : null;
|
|
270
|
-
}
|
|
271
|
-
return TAG_TO_ROLE[tag] ?? null;
|
|
272
|
-
}
|
|
273
|
-
function headingLevel(attrs, role) {
|
|
274
|
-
if (role !== "heading") return null;
|
|
275
|
-
const tagMatch = attrs.tagName.match(/^h([1-6])$/);
|
|
276
|
-
if (tagMatch) return Number(tagMatch[1]);
|
|
277
|
-
const ariaLevel = attrs.attributes["aria-level"];
|
|
278
|
-
if (ariaLevel && /^\d+$/.test(ariaLevel)) return Number(ariaLevel);
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
var attr = (a, key) => a.attributes[key] || null;
|
|
282
|
-
var escCssAttrValue = (s) => s.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
283
|
-
var isCssSafeId = (id) => /^[A-Za-z][A-Za-z0-9_-]*$/.test(id);
|
|
284
|
-
function classifyCssStability(className) {
|
|
285
|
-
if (/[a-f0-9]{8,}/i.test(className)) return 10;
|
|
286
|
-
if (/^(?:css|sc|emotion|styled)-/i.test(className)) return 15;
|
|
287
|
-
if (/^(bg|text|border|shadow|opacity|font|w-|h-|m[tblrxy]?-|p[tblrxy]?-|flex|grid|gap|rounded|absolute|relative|fixed|sticky|block|inline|hidden|overflow|z-|top-|right-|bottom-|left-|inset-|justify-|items-|self-|content-|order-|col-|row-)/.test(
|
|
288
|
-
className
|
|
289
|
-
))
|
|
290
|
-
return 25;
|
|
291
|
-
if (/__/.test(className) || /--/.test(className)) return 35;
|
|
292
|
-
if (/^[a-z]+(-[a-z]+)+$/.test(className)) return 40;
|
|
293
|
-
if (/^[a-z]+[A-Z][a-zA-Z]+$/.test(className)) return 40;
|
|
294
|
-
if (className.includes("_")) return 15;
|
|
295
|
-
if (/^[a-z]+-[a-z0-9]{5,}$/.test(className) && /[0-9]/.test(className)) return 15;
|
|
296
|
-
return 15;
|
|
297
|
-
}
|
|
298
|
-
function isAutoGenerated(value) {
|
|
299
|
-
if (/^[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12}$/i.test(value)) return true;
|
|
300
|
-
if (/^[a-f0-9]{8,}$/i.test(value)) return true;
|
|
301
|
-
if (/^[a-z]+-\d{4,}$/.test(value)) return true;
|
|
302
|
-
if (/^(tab|panel|input|select|option|dialog|modal|popup|tooltip|menu|listbox|combobox|checkbox|radio|textarea|button|field|label|accordion|collapse|step|slider|toggle|switch|dropdown|overlay|portal|layer)-\d+$/i.test(
|
|
303
|
-
value
|
|
304
|
-
)) {
|
|
305
|
-
return true;
|
|
306
|
-
}
|
|
307
|
-
if (/^(emotion-|styled-|css-|sc-)/.test(value)) return true;
|
|
308
|
-
if (value.startsWith("ng-")) return true;
|
|
309
|
-
if (/^(radix-|headlessui-|mui-|mantine-|chakra-|reka-|bits-|downshift-|react-aria|el-id-)/i.test(value)) return true;
|
|
310
|
-
if (/^:r[0-9a-z]+:$/i.test(value) || /^«r[0-9a-z]+»$/i.test(value)) return true;
|
|
311
|
-
if (/(^|[-_:])v-\d+(-\d+)+$/.test(value) || /(^|[-_:])v-\d+(-\d+)+[-_:]/.test(value)) return true;
|
|
312
|
-
return false;
|
|
313
|
-
}
|
|
314
|
-
var TEST_DATA_ATTRS = /* @__PURE__ */ new Set(["data-test", "data-test-id", "data-qa", "data-qa-id", "data-cy", "data-e2e"]);
|
|
315
|
-
function generateAlternatives(attrs, options = {}) {
|
|
316
|
-
const alts = [];
|
|
317
|
-
const seen = /* @__PURE__ */ new Set();
|
|
318
|
-
const add = (loc) => {
|
|
319
|
-
if (!seen.has(loc.locator)) {
|
|
320
|
-
seen.add(loc.locator);
|
|
321
|
-
alts.push(loc);
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
|
-
const { accessibleName } = attrs;
|
|
325
|
-
const tag = attrs.tagName;
|
|
326
|
-
const role = options.role !== void 0 ? options.role : resolveAriaRole(attrs);
|
|
327
|
-
const counts = attrs.selectorCounts;
|
|
328
|
-
const isUnique = (n) => n == null || n <= 1;
|
|
329
|
-
const ambiguityPenalty = (n) => n != null && n > 1 ? 45 : 0;
|
|
330
|
-
const text = attrs.textContent ? attrs.textContent.replace(/\s+/g, " ").trim() : null;
|
|
331
|
-
const testIdAttribute = options.testIdAttribute || "data-testid";
|
|
332
|
-
const selectable = (name2) => name2.toLowerCase() !== testIdAttribute.toLowerCase();
|
|
333
|
-
const testId = attr(attrs, testIdAttribute);
|
|
334
|
-
if (testId && isUnique(counts?.testId)) {
|
|
335
|
-
add({
|
|
336
|
-
locator: `getByTestId(${quoteJsString(testId)})`,
|
|
337
|
-
method: "getByTestId",
|
|
338
|
-
args: { testId },
|
|
339
|
-
score: 100
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
const level = headingLevel(attrs, role);
|
|
343
|
-
const levelPart = level != null ? `, level: ${level}` : "";
|
|
344
|
-
const withLevel = (base) => level != null ? { ...base, level } : base;
|
|
345
|
-
if (role && accessibleName) {
|
|
346
|
-
add({
|
|
347
|
-
locator: `getByRole(${quoteJsString(role)}, { name: ${quoteJsString(accessibleName)}${levelPart} })`,
|
|
348
|
-
method: "getByRole",
|
|
349
|
-
args: withLevel({ role, name: accessibleName }),
|
|
350
|
-
score: 90 - ambiguityPenalty(counts?.roleName)
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
const ariaLabel = attr(attrs, "aria-label");
|
|
354
|
-
if (role && ariaLabel && ariaLabel !== accessibleName) {
|
|
355
|
-
add({
|
|
356
|
-
locator: `getByRole(${quoteJsString(role)}, { name: ${quoteJsString(ariaLabel)}${levelPart} })`,
|
|
357
|
-
method: "getByRole",
|
|
358
|
-
args: withLevel({ role, name: ariaLabel }),
|
|
359
|
-
score: 85 - ambiguityPenalty(counts?.roleName)
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
if (accessibleName && ["input", "select", "textarea"].includes(tag)) {
|
|
363
|
-
const label = attr(attrs, "aria-label");
|
|
364
|
-
const labelBacked = attrs.hasLabel === void 0 ? true : attrs.hasLabel === true || label === accessibleName;
|
|
365
|
-
if (labelBacked) {
|
|
366
|
-
add({
|
|
367
|
-
locator: `getByLabel(${quoteJsString(accessibleName)})`,
|
|
368
|
-
method: "getByLabel",
|
|
369
|
-
args: { label: accessibleName },
|
|
370
|
-
score: 85
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
const placeholder = attr(attrs, "placeholder");
|
|
375
|
-
if (placeholder) {
|
|
376
|
-
add({
|
|
377
|
-
locator: `getByPlaceholder(${quoteJsString(placeholder)})`,
|
|
378
|
-
method: "getByPlaceholder",
|
|
379
|
-
args: { placeholder },
|
|
380
|
-
score: 80 - ambiguityPenalty(counts?.placeholder)
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
if (text && text.length < 80) {
|
|
384
|
-
add({
|
|
385
|
-
locator: `getByText(${quoteJsString(text)})`,
|
|
386
|
-
method: "getByText",
|
|
387
|
-
args: { text },
|
|
388
|
-
score: 75 - ambiguityPenalty(counts?.text)
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
const id = attr(attrs, "id");
|
|
392
|
-
if (id && selectable("id") && !isAutoGenerated(id) && isUnique(counts?.id)) {
|
|
393
|
-
const selector = isCssSafeId(id) ? `#${id}` : `[id="${escCssAttrValue(id)}"]`;
|
|
394
|
-
add({
|
|
395
|
-
locator: `locator(${quoteJsString(selector)})`,
|
|
396
|
-
method: "locator",
|
|
397
|
-
args: { selector },
|
|
398
|
-
score: 65
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
const name = attr(attrs, "name");
|
|
402
|
-
if (name && selectable("name") && isUnique(counts?.name)) {
|
|
403
|
-
const selector = `[name="${escCssAttrValue(name)}"]`;
|
|
404
|
-
add({
|
|
405
|
-
locator: `locator(${quoteJsString(selector)})`,
|
|
406
|
-
method: "locator",
|
|
407
|
-
args: { selector },
|
|
408
|
-
score: 60
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
const alt = attr(attrs, "alt");
|
|
412
|
-
if (alt) {
|
|
413
|
-
add({
|
|
414
|
-
locator: `getByAltText(${quoteJsString(alt)})`,
|
|
415
|
-
method: "getByAltText",
|
|
416
|
-
args: { text: alt },
|
|
417
|
-
score: 60 - ambiguityPenalty(counts?.alt)
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
const title = attr(attrs, "title");
|
|
421
|
-
if (title) {
|
|
422
|
-
add({
|
|
423
|
-
locator: `getByTitle(${quoteJsString(title)})`,
|
|
424
|
-
method: "getByTitle",
|
|
425
|
-
args: { title },
|
|
426
|
-
score: 50 - ambiguityPenalty(counts?.title)
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
const hasOwnTestId = !!(testId && isUnique(counts?.testId));
|
|
430
|
-
const addAnchoredChains = (leaf, scopedCount, scores) => {
|
|
431
|
-
let testIdAnchorDone = false;
|
|
432
|
-
let idAnchorDone = false;
|
|
433
|
-
let roleAnchorDone = false;
|
|
434
|
-
let dataAnchorDone = false;
|
|
435
|
-
let filterAnchorDone = false;
|
|
436
|
-
for (const anc of attrs.ancestors ?? []) {
|
|
437
|
-
if (scopedCount(anc) !== 1) continue;
|
|
438
|
-
if (!testIdAnchorDone && anc.testId && anc.testIdCount === 1) {
|
|
439
|
-
testIdAnchorDone = true;
|
|
440
|
-
add({
|
|
441
|
-
locator: `getByTestId(${quoteJsString(anc.testId)}).${leaf.expr}`,
|
|
442
|
-
method: leaf.method,
|
|
443
|
-
args: { ...leaf.args, anchorTestId: anc.testId },
|
|
444
|
-
score: scores.testId
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
if (!idAnchorDone && anc.id && selectable("id") && !isAutoGenerated(anc.id) && anc.idCount === 1) {
|
|
448
|
-
idAnchorDone = true;
|
|
449
|
-
const anchorSelector = isCssSafeId(anc.id) ? `#${anc.id}` : `[id="${escCssAttrValue(anc.id)}"]`;
|
|
450
|
-
add({
|
|
451
|
-
locator: `locator(${quoteJsString(anchorSelector)}).${leaf.expr}`,
|
|
452
|
-
method: leaf.method,
|
|
453
|
-
args: { ...leaf.args, anchorSelector },
|
|
454
|
-
score: scores.id
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
if (!dataAnchorDone && anc.dataAttr && selectable(anc.dataAttr.name) && anc.dataAttrCount === 1) {
|
|
458
|
-
dataAnchorDone = true;
|
|
459
|
-
const { name: name2, value } = anc.dataAttr;
|
|
460
|
-
const anchorSelector = `[${name2}="${escCssAttrValue(value)}"]`;
|
|
461
|
-
add({
|
|
462
|
-
locator: `locator(${quoteJsString(anchorSelector)}).${leaf.expr}`,
|
|
463
|
-
method: leaf.method,
|
|
464
|
-
args: { ...leaf.args, anchorSelector },
|
|
465
|
-
score: TEST_DATA_ATTRS.has(name2) ? scores.testData : scores.data
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
const ancestorRole = anc.role || TAG_TO_ROLE[anc.tag] || null;
|
|
469
|
-
if (!roleAnchorDone && ancestorRole && ancestorRole !== leaf.role && anc.roleCount === 1) {
|
|
470
|
-
roleAnchorDone = true;
|
|
471
|
-
add({
|
|
472
|
-
locator: `getByRole(${quoteJsString(ancestorRole)}).${leaf.expr}`,
|
|
473
|
-
method: leaf.method,
|
|
474
|
-
args: { ...leaf.args, anchorRole: ancestorRole },
|
|
475
|
-
score: scores.role
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
if (!filterAnchorDone && ancestorRole && anc.filterText && anc.filterRoleCount === 1) {
|
|
479
|
-
filterAnchorDone = true;
|
|
480
|
-
add({
|
|
481
|
-
locator: `getByRole(${quoteJsString(ancestorRole)}).filter({ hasText: ${quoteJsString(anc.filterText)} }).${leaf.expr}`,
|
|
482
|
-
method: leaf.method,
|
|
483
|
-
args: { ...leaf.args, anchorRole: ancestorRole, anchorHasText: anc.filterText },
|
|
484
|
-
score: scores.filter
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
};
|
|
489
|
-
if (role && !hasOwnTestId) {
|
|
490
|
-
const rolePart = level != null ? `${quoteJsString(role)}, { level: ${level} }` : quoteJsString(role);
|
|
491
|
-
const leafArgs = withLevel({ role });
|
|
492
|
-
addAnchoredChains(
|
|
493
|
-
{ expr: `getByRole(${rolePart})`, method: "getByRole", args: leafArgs, role },
|
|
494
|
-
(anc) => anc.scopedRoleCount,
|
|
495
|
-
{ testId: 72, testData: 70, id: 64, data: 60, role: 55, filter: 53 }
|
|
496
|
-
);
|
|
497
|
-
const pos = attrs.rolePosition;
|
|
498
|
-
if (pos && pos.role === role && (pos.count === 1 || level != null && pos.levelCount === 1)) {
|
|
499
|
-
add({
|
|
500
|
-
locator: `getByRole(${rolePart})`,
|
|
501
|
-
method: "getByRole",
|
|
502
|
-
args: leafArgs,
|
|
503
|
-
score: 58
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
} else if (!role && text && text.length < 80 && !hasOwnTestId) {
|
|
507
|
-
addAnchoredChains(
|
|
508
|
-
{ expr: `getByText(${quoteJsString(text)})`, method: "getByText", args: { text }, role: null },
|
|
509
|
-
(anc) => anc.scopedTextCount,
|
|
510
|
-
{ testId: 68, testData: 66, id: 60, data: 56, role: 51, filter: 49 }
|
|
511
|
-
);
|
|
512
|
-
}
|
|
513
|
-
const clsStr = attr(attrs, "class");
|
|
514
|
-
if (clsStr) {
|
|
515
|
-
const countsClasses = counts?.classes;
|
|
516
|
-
const classes = clsStr.split(/\s+/).filter((c) => c.length > 1 && /^[A-Za-z_-][A-Za-z0-9_-]*$/.test(c) && isUnique(countsClasses?.[c])).map((cls) => ({ cls, score: classifyCssStability(cls) })).sort((a, b) => b.score - a.score).slice(0, 3);
|
|
517
|
-
for (const { cls, score } of classes) {
|
|
518
|
-
add({
|
|
519
|
-
locator: `locator(${quoteJsString(`.${cls}`)})`,
|
|
520
|
-
method: "locator",
|
|
521
|
-
args: { selector: `.${cls}` },
|
|
522
|
-
score
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
return alts.sort((a, b) => b.score - a.score);
|
|
527
|
-
}
|
|
528
|
-
function approximateAccessibleName(attrs) {
|
|
529
|
-
const a = attrs.attributes;
|
|
530
|
-
const labelText = attrs.labelText || null;
|
|
531
|
-
if (a["aria-labelledby"] && labelText) return labelText;
|
|
532
|
-
const ariaLabel = a["aria-label"];
|
|
533
|
-
if (ariaLabel) return ariaLabel;
|
|
534
|
-
if (["input", "select", "textarea"].includes(attrs.tagName)) {
|
|
535
|
-
if (labelText) return labelText;
|
|
536
|
-
} else if (attrs.textContent) {
|
|
537
|
-
return attrs.textContent;
|
|
538
|
-
}
|
|
539
|
-
const title = a["title"];
|
|
540
|
-
if (title) return title;
|
|
541
|
-
const placeholder = a["placeholder"];
|
|
542
|
-
if (placeholder) return placeholder;
|
|
543
|
-
return null;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
// src/internal/capture/locator-healing.ts
|
|
547
|
-
function dedupeSnapshotsByLocation(snaps) {
|
|
548
|
-
const lastWithElement = /* @__PURE__ */ new Map();
|
|
549
|
-
const lastAny = /* @__PURE__ */ new Map();
|
|
550
|
-
snaps.forEach((s, i) => {
|
|
551
|
-
if (!s.location) return;
|
|
552
|
-
lastAny.set(s.location, i);
|
|
553
|
-
if (s.element) lastWithElement.set(s.location, i);
|
|
554
|
-
});
|
|
555
|
-
return snaps.filter((s, i) => {
|
|
556
|
-
if (!s.location) return true;
|
|
557
|
-
return (lastWithElement.get(s.location) ?? lastAny.get(s.location)) === i;
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
var LOCATOR_METHODS = [...LOCATOR_BUILDER_METHODS];
|
|
561
|
-
var CHAIN_METHODS = [
|
|
562
|
-
"first",
|
|
563
|
-
"nth",
|
|
564
|
-
"last",
|
|
565
|
-
"filter",
|
|
566
|
-
"visible",
|
|
567
|
-
"and",
|
|
568
|
-
"or",
|
|
569
|
-
"locator",
|
|
570
|
-
"getByRole",
|
|
571
|
-
"getByTestId",
|
|
572
|
-
"getByText",
|
|
573
|
-
"getByLabel",
|
|
574
|
-
"getByPlaceholder",
|
|
575
|
-
"getByAltText",
|
|
576
|
-
"getByTitle"
|
|
577
|
-
];
|
|
578
|
-
var ACTION_METHODS = [
|
|
579
|
-
"click",
|
|
580
|
-
"fill",
|
|
581
|
-
"check",
|
|
582
|
-
"uncheck",
|
|
583
|
-
"selectOption",
|
|
584
|
-
"dblclick",
|
|
585
|
-
"tap",
|
|
586
|
-
"hover",
|
|
587
|
-
"press",
|
|
588
|
-
"type",
|
|
589
|
-
"pressSequentially",
|
|
590
|
-
"clear",
|
|
591
|
-
"setInputFiles",
|
|
592
|
-
"dragTo",
|
|
593
|
-
"focus",
|
|
594
|
-
"blur",
|
|
595
|
-
"scrollIntoViewIfNeeded",
|
|
596
|
-
"dispatchEvent",
|
|
597
|
-
"selectText",
|
|
598
|
-
// Not an action, but a successful waitFor proves the element resolved — the
|
|
599
|
-
// closest capture hook available for assertion-style usage of a locator.
|
|
600
|
-
"waitFor"
|
|
601
|
-
];
|
|
602
|
-
var LOCATOR_CREATING_CHAINS = new Set(LOCATOR_METHODS);
|
|
603
|
-
var EXPECT_METHOD = "_expect";
|
|
604
|
-
var EXPECT_CAPTURE_EXPRESSIONS = /* @__PURE__ */ new Set([
|
|
605
|
-
"to.be.attached",
|
|
606
|
-
"to.be.checked",
|
|
607
|
-
"to.be.disabled",
|
|
608
|
-
"to.be.editable",
|
|
609
|
-
"to.be.empty",
|
|
610
|
-
"to.be.enabled",
|
|
611
|
-
"to.be.focused",
|
|
612
|
-
"to.be.in.viewport",
|
|
613
|
-
"to.be.readonly",
|
|
614
|
-
"to.be.visible",
|
|
615
|
-
"to.contain.class",
|
|
616
|
-
"to.contain.text",
|
|
617
|
-
"to.have.accessible.description",
|
|
618
|
-
"to.have.accessible.error.message",
|
|
619
|
-
"to.have.accessible.name",
|
|
620
|
-
"to.have.attribute",
|
|
621
|
-
"to.have.attribute.value",
|
|
622
|
-
"to.have.class",
|
|
623
|
-
"to.have.css",
|
|
624
|
-
"to.have.id",
|
|
625
|
-
"to.have.js.property",
|
|
626
|
-
"to.have.role",
|
|
627
|
-
"to.have.text",
|
|
628
|
-
"to.have.value",
|
|
629
|
-
"to.match.aria"
|
|
630
|
-
]);
|
|
631
|
-
function extractAccessibleName(ariaSnapshot) {
|
|
632
|
-
if (!ariaSnapshot) return null;
|
|
633
|
-
const match = ariaSnapshot.match(/- \w+ "([^"]+)"/);
|
|
634
|
-
if (match) return match[1];
|
|
635
|
-
return null;
|
|
636
|
-
}
|
|
637
|
-
var FORM_FIELD_TAGS = /* @__PURE__ */ new Set(["input", "select", "textarea"]);
|
|
638
|
-
var NAME_FROM_CONTENT_ROLES = /* @__PURE__ */ new Set([
|
|
639
|
-
"button",
|
|
640
|
-
"cell",
|
|
641
|
-
"checkbox",
|
|
642
|
-
"columnheader",
|
|
643
|
-
"gridcell",
|
|
644
|
-
"heading",
|
|
645
|
-
"link",
|
|
646
|
-
"menuitem",
|
|
647
|
-
"menuitemcheckbox",
|
|
648
|
-
"menuitemradio",
|
|
649
|
-
"option",
|
|
650
|
-
"radio",
|
|
651
|
-
"row",
|
|
652
|
-
"rowheader",
|
|
653
|
-
"switch",
|
|
654
|
-
"tab",
|
|
655
|
-
"tooltip",
|
|
656
|
-
"treeitem"
|
|
657
|
-
]);
|
|
658
|
-
var PROBE_TEXT_CAP = 80;
|
|
659
|
-
var PROBE_LABEL_TEXT_CAP = 120;
|
|
660
|
-
function exactAccessibleName(attrs, role) {
|
|
661
|
-
if (attrs.attributes["aria-labelledby"]) return null;
|
|
662
|
-
const ariaLabel = attrs.attributes["aria-label"];
|
|
663
|
-
if (ariaLabel) return ariaLabel;
|
|
664
|
-
if (FORM_FIELD_TAGS.has(attrs.tagName)) {
|
|
665
|
-
const labelText = attrs.labelText;
|
|
666
|
-
return labelText && labelText.length < PROBE_LABEL_TEXT_CAP ? labelText : null;
|
|
667
|
-
}
|
|
668
|
-
if (role && NAME_FROM_CONTENT_ROLES.has(role)) {
|
|
669
|
-
const text = attrs.textContent;
|
|
670
|
-
return text && text.length < PROBE_TEXT_CAP ? text : null;
|
|
671
|
-
}
|
|
672
|
-
return null;
|
|
673
|
-
}
|
|
674
|
-
var NAME_BASED_METHODS = /* @__PURE__ */ new Set([
|
|
675
|
-
"getByText",
|
|
676
|
-
"getByRole",
|
|
677
|
-
"getByLabel",
|
|
678
|
-
"getByPlaceholder",
|
|
679
|
-
"getByTitle",
|
|
680
|
-
"getByAltText"
|
|
681
|
-
]);
|
|
682
|
-
var SUGG_TEXT_ROLES = /* @__PURE__ */ new Set([
|
|
683
|
-
"button",
|
|
684
|
-
"link",
|
|
685
|
-
"heading",
|
|
686
|
-
"menuitem",
|
|
687
|
-
"tab",
|
|
688
|
-
"option",
|
|
689
|
-
"cell",
|
|
690
|
-
"columnheader",
|
|
691
|
-
"rowheader",
|
|
692
|
-
"gridcell",
|
|
693
|
-
"treeitem",
|
|
694
|
-
"listitem",
|
|
695
|
-
"checkbox",
|
|
696
|
-
"radio",
|
|
697
|
-
"switch"
|
|
698
|
-
]);
|
|
699
|
-
var SUGG_FIELD_ROLES = /* @__PURE__ */ new Set(["textbox", "combobox", "searchbox", "spinbutton", "slider"]);
|
|
700
|
-
function failedNameAndRole(failed) {
|
|
701
|
-
if (failed.method === "getByRole") {
|
|
702
|
-
const role = typeof failed.args[0] === "string" ? failed.args[0] : null;
|
|
703
|
-
const opts = failed.args[1];
|
|
704
|
-
const name = opts && typeof opts.name === "string" ? opts.name : null;
|
|
705
|
-
const level = opts && typeof opts.level === "number" ? opts.level : null;
|
|
706
|
-
return { role, name, level };
|
|
707
|
-
}
|
|
708
|
-
const first = failed.args.find((a) => typeof a === "string");
|
|
709
|
-
return { role: null, name: typeof first === "string" ? first : null, level: null };
|
|
710
|
-
}
|
|
711
|
-
function renderFailing(failed) {
|
|
712
|
-
const { role, name } = failedNameAndRole(failed);
|
|
713
|
-
if (failed.method === "getByRole") {
|
|
714
|
-
return name ? `getByRole(${quoteJsString(role ?? "")}, { name: ${quoteJsString(name)} })` : `getByRole(${quoteJsString(role ?? "")})`;
|
|
715
|
-
}
|
|
716
|
-
return `${failed.method}(${quoteJsString(name ?? "")})`;
|
|
717
|
-
}
|
|
718
|
-
function freshSuggestions(candidate, failedMethod) {
|
|
719
|
-
const out = [];
|
|
720
|
-
const role = candidate.role;
|
|
721
|
-
const name = candidate.name;
|
|
722
|
-
const push = (s) => {
|
|
723
|
-
if (!out.includes(s)) out.push(s);
|
|
724
|
-
};
|
|
725
|
-
const levelPart = candidate.level != null ? `, level: ${candidate.level}` : "";
|
|
726
|
-
const roleLoc = `getByRole(${quoteJsString(role)}, { name: ${quoteJsString(name)}${levelPart} })`;
|
|
727
|
-
const textLoc = `getByText(${quoteJsString(name)})`;
|
|
728
|
-
const labelLoc = `getByLabel(${quoteJsString(name)})`;
|
|
729
|
-
if (failedMethod === "getByText" && SUGG_TEXT_ROLES.has(role)) push(textLoc);
|
|
730
|
-
if (failedMethod === "getByLabel" && SUGG_FIELD_ROLES.has(role)) push(labelLoc);
|
|
731
|
-
push(roleLoc);
|
|
732
|
-
if (SUGG_TEXT_ROLES.has(role)) push(textLoc);
|
|
733
|
-
else if (SUGG_FIELD_ROLES.has(role)) push(labelLoc);
|
|
734
|
-
return out;
|
|
735
|
-
}
|
|
736
|
-
function suggestLocatorsFromAria(failed, ariaSnapshot) {
|
|
737
|
-
if (!ariaSnapshot || !NAME_BASED_METHODS.has(failed.method)) return null;
|
|
738
|
-
const { role, name, level } = failedNameAndRole(failed);
|
|
739
|
-
if (!name) return null;
|
|
740
|
-
const candidates = parseAriaCandidates(ariaSnapshot);
|
|
741
|
-
if (candidates.length === 0) return null;
|
|
742
|
-
const fingerprint = { role, name, level };
|
|
743
|
-
if (fingerprintPresent(fingerprint, candidates)) return null;
|
|
744
|
-
const best = matchRenamedElement(fingerprint, candidates)?.candidate;
|
|
745
|
-
if (!best || !best.name) return null;
|
|
746
|
-
const suggestions = freshSuggestions({ role: best.role, name: best.name, level: best.level }, failed.method);
|
|
747
|
-
if (suggestions.length === 0) return null;
|
|
748
|
-
return { failing: renderFailing(failed), suggestions };
|
|
749
|
-
}
|
|
750
|
-
function framePath(file, windows = process.platform === "win32") {
|
|
751
|
-
if (!file.startsWith("file://")) return file;
|
|
752
|
-
try {
|
|
753
|
-
return (0, import_node_url.fileURLToPath)(file, { windows });
|
|
754
|
-
} catch {
|
|
755
|
-
return null;
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
function callSitePath(file, cwd = process.cwd(), windows = process.platform === "win32") {
|
|
759
|
-
const local = framePath(file, windows);
|
|
760
|
-
if (local === null) return null;
|
|
761
|
-
const paths = windows ? path.win32 : path.posix;
|
|
762
|
-
return paths.relative(cwd, local).split(paths.sep).join("/");
|
|
763
|
-
}
|
|
764
|
-
function captureCallerLocation(stack = new Error().stack ?? "") {
|
|
765
|
-
const lines = stack.split("\n");
|
|
766
|
-
let prevWasCaptureModule = false;
|
|
767
|
-
let selfFile = null;
|
|
768
|
-
for (let i = 1; i < lines.length; i++) {
|
|
769
|
-
const line = lines[i].trim();
|
|
770
|
-
if (!line.startsWith("at")) continue;
|
|
771
|
-
const m = line.match(/^at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);
|
|
772
|
-
if (!m) {
|
|
773
|
-
prevWasCaptureModule = false;
|
|
774
|
-
continue;
|
|
775
|
-
}
|
|
776
|
-
const file = m[2] ? framePath(m[2]) : null;
|
|
777
|
-
if (!file || file.startsWith("node:") || !/\.[a-z]+$/i.test(file)) {
|
|
778
|
-
prevWasCaptureModule = false;
|
|
779
|
-
continue;
|
|
780
|
-
}
|
|
781
|
-
if (selfFile === null || file === selfFile) {
|
|
782
|
-
selfFile ??= file;
|
|
783
|
-
prevWasCaptureModule = /[\\/]locator-healing\.[a-z]+$/i.test(file);
|
|
784
|
-
continue;
|
|
785
|
-
}
|
|
786
|
-
if (/[\\/]locator-healing\.[a-z]+$/i.test(file)) {
|
|
787
|
-
prevWasCaptureModule = true;
|
|
788
|
-
continue;
|
|
789
|
-
}
|
|
790
|
-
if (prevWasCaptureModule && /[\\/](?:capture-)?fixtures\.[a-z]+$/i.test(file)) {
|
|
791
|
-
prevWasCaptureModule = false;
|
|
792
|
-
continue;
|
|
793
|
-
}
|
|
794
|
-
if (/[\\/]node_modules[\\/]/.test(file)) {
|
|
795
|
-
prevWasCaptureModule = false;
|
|
796
|
-
continue;
|
|
797
|
-
}
|
|
798
|
-
let rel = file;
|
|
799
|
-
try {
|
|
800
|
-
rel = callSitePath(file) ?? file;
|
|
801
|
-
} catch {
|
|
802
|
-
}
|
|
803
|
-
return `${rel}:${m[3]}:${m[4]}`;
|
|
804
|
-
}
|
|
805
|
-
return null;
|
|
806
|
-
}
|
|
807
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
808
|
-
0 && (module.exports = {
|
|
809
|
-
ACTION_METHODS,
|
|
810
|
-
CAPTURED_ATTRIBUTES,
|
|
811
|
-
CHAIN_METHODS,
|
|
812
|
-
EXPECT_CAPTURE_EXPRESSIONS,
|
|
813
|
-
EXPECT_METHOD,
|
|
814
|
-
FORM_FIELD_TAGS,
|
|
815
|
-
INPUT_TYPE_TO_ROLE,
|
|
816
|
-
LOCATOR_CREATING_CHAINS,
|
|
817
|
-
LOCATOR_METHODS,
|
|
818
|
-
TAG_TO_ROLE,
|
|
819
|
-
approximateAccessibleName,
|
|
820
|
-
callSitePath,
|
|
821
|
-
captureCallerLocation,
|
|
822
|
-
classifyCssStability,
|
|
823
|
-
dedupeSnapshotsByLocation,
|
|
824
|
-
exactAccessibleName,
|
|
825
|
-
extractAccessibleName,
|
|
826
|
-
framePath,
|
|
827
|
-
generateAlternatives,
|
|
828
|
-
headingLevel,
|
|
829
|
-
isAutoGenerated,
|
|
830
|
-
renderFailing,
|
|
831
|
-
resolveAriaRole,
|
|
832
|
-
suggestLocatorsFromAria
|
|
833
|
-
});
|