@dev-blinq/cucumber_client 1.0.1222-dev → 1.0.1224-dev
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.
|
@@ -459,7 +459,7 @@ class BVTRecorder {
|
|
|
459
459
|
getAction: (e) => {
|
|
460
460
|
consumeEvent(e);
|
|
461
461
|
},
|
|
462
|
-
getInterestedElement: () => {},
|
|
462
|
+
getInterestedElement: () => { },
|
|
463
463
|
hoverOutlineStyle: "",
|
|
464
464
|
});
|
|
465
465
|
|
|
@@ -474,7 +474,7 @@ class BVTRecorder {
|
|
|
474
474
|
};
|
|
475
475
|
},
|
|
476
476
|
getAction: () => null,
|
|
477
|
-
getInterestedElement: () => {},
|
|
477
|
+
getInterestedElement: () => { },
|
|
478
478
|
hoverOutlineStyle: "",
|
|
479
479
|
});
|
|
480
480
|
|
|
@@ -489,7 +489,7 @@ class BVTRecorder {
|
|
|
489
489
|
};
|
|
490
490
|
},
|
|
491
491
|
getAction: () => null,
|
|
492
|
-
getInterestedElement: () => {},
|
|
492
|
+
getInterestedElement: () => { },
|
|
493
493
|
hoverOutlineStyle: "",
|
|
494
494
|
});
|
|
495
495
|
|
|
@@ -928,6 +928,8 @@ class BVTRecorder {
|
|
|
928
928
|
// }
|
|
929
929
|
|
|
930
930
|
lastInputId = el.dataset.inputId;
|
|
931
|
+
|
|
932
|
+
el.__locators = this.getLocatorsObject(el);
|
|
931
933
|
}
|
|
932
934
|
const role = window.getAriaRole(el);
|
|
933
935
|
const label = window.getElementAccessibleName(el, false) || window.getElementAccessibleName(el, true) || role || "";
|
|
@@ -1098,6 +1100,7 @@ class BVTRecorder {
|
|
|
1098
1100
|
improviseLocators: false,
|
|
1099
1101
|
mustIncludeCSSChain: true,
|
|
1100
1102
|
root: commonParent,
|
|
1103
|
+
noCSSId: true,
|
|
1101
1104
|
});
|
|
1102
1105
|
locators.forEach((locator) => {
|
|
1103
1106
|
locator.text = text;
|
|
@@ -1218,7 +1221,8 @@ class BVTRecorder {
|
|
|
1218
1221
|
action: action.details,
|
|
1219
1222
|
element: this.getElementDetails(actionElement, eventName),
|
|
1220
1223
|
isPopupCloseClick: this.isPopupCloseEvent(e),
|
|
1221
|
-
...this.getLocatorsObject(actionElement),
|
|
1224
|
+
// ...this.getLocatorsObject(actionElement),
|
|
1225
|
+
...(actionElement.__locators ?? this.getLocatorsObject(actionElement)),
|
|
1222
1226
|
frame: this.getFrameDetails(),
|
|
1223
1227
|
statistics: {
|
|
1224
1228
|
time: `${performance.measure("command-received", "command-send").duration.toFixed(2)} ms`,
|
|
@@ -29,6 +29,8 @@ const getMatchingElements = (selector, options = {}) => {
|
|
|
29
29
|
return window.__injectedScript.querySelectorAll(window.__injectedScript.parseSelector(selector), root);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
window.getMatchingElements = getMatchingElements;
|
|
33
|
+
|
|
32
34
|
const getPWSelectors = (element, options = {}) => {
|
|
33
35
|
const selectors = [];
|
|
34
36
|
const exludeText = options?.excludeText || false;
|
|
@@ -147,7 +149,25 @@ const getElementLocators = (element, options) => {
|
|
|
147
149
|
.map((item) => {
|
|
148
150
|
return item;
|
|
149
151
|
});
|
|
150
|
-
|
|
152
|
+
if (result.nonUnique.length === 0) {
|
|
153
|
+
// find slector with min score
|
|
154
|
+
let minScore = Infinity;
|
|
155
|
+
let minSelector = null;
|
|
156
|
+
for (const locator of pw_locators) {
|
|
157
|
+
if (locator.score < minScore) {
|
|
158
|
+
minScore = locator.score;
|
|
159
|
+
minSelector = locator.selector;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (minSelector) {
|
|
163
|
+
result.nonUnique.push({
|
|
164
|
+
css: minSelector,
|
|
165
|
+
priority: 2,
|
|
166
|
+
elements: getMatchingElements(minSelector, options),
|
|
167
|
+
score: minScore,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
151
171
|
return result;
|
|
152
172
|
};
|
|
153
173
|
|
|
@@ -337,6 +357,7 @@ function generateUniqueCSSSelector(element, options) {
|
|
|
337
357
|
const root = options?.root || window.document;
|
|
338
358
|
const separator = options?.separator || " > ";
|
|
339
359
|
const isUnique = options?.isunique || ((selector) => getMatchingElements(selector, options).length === 1);
|
|
360
|
+
const noCSSId = options?.noCSSId || false;
|
|
340
361
|
|
|
341
362
|
if (!(element instanceof Element)) return null;
|
|
342
363
|
|
|
@@ -344,7 +365,7 @@ function generateUniqueCSSSelector(element, options) {
|
|
|
344
365
|
|
|
345
366
|
let selector = "";
|
|
346
367
|
const id = element.getAttribute("id");
|
|
347
|
-
if (id && !/\d/.test(id)) {
|
|
368
|
+
if (id && !/\d/.test(id) && (!noCSSId)) {
|
|
348
369
|
selector = "#" + cssEscape(id);
|
|
349
370
|
if (isUnique(selector)) return selector;
|
|
350
371
|
}
|