@dev-blinq/cucumber_client 1.0.1222-dev → 1.0.1223-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 || "";
@@ -1218,7 +1220,8 @@ class BVTRecorder {
1218
1220
  action: action.details,
1219
1221
  element: this.getElementDetails(actionElement, eventName),
1220
1222
  isPopupCloseClick: this.isPopupCloseEvent(e),
1221
- ...this.getLocatorsObject(actionElement),
1223
+ // ...this.getLocatorsObject(actionElement),
1224
+ ...(actionElement.__locators ?? this.getLocatorsObject(actionElement)),
1222
1225
  frame: this.getFrameDetails(),
1223
1226
  statistics: {
1224
1227
  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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1222-dev",
3
+ "version": "1.0.1223-dev",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",