ff-dom 1.0.14 → 1.0.16

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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getElementsFromHTML = void 0;
4
+ //@ts-nocheck
4
5
  const jsdom_1 = require("jsdom");
5
6
  const isUnique = (xpathResult) => {
6
7
  return xpathResult && xpathResult.snapshotLength === 1;
@@ -477,14 +478,17 @@ const getElementsFromHTML = (name, desc, type, locators, isShared, projectId, pr
477
478
  }
478
479
  }
479
480
  let uniqueLocators = new Map();
480
- finalLocators.forEach((loc) => {
481
- if (loc.isRecorded === "N") {
482
- uniqueLocators.set(loc.value, loc);
481
+ finalLocators.forEach((obj) => {
482
+ let val = obj.value;
483
+ if (obj.isRecorded === 'Y' && val) {
484
+ val = String(val).replace(/"/g, "'").replace(/\\'/g, "'");
483
485
  }
484
- else {
485
- if (!uniqueLocators.has(loc.value)) {
486
- uniqueLocators.set(loc.value, loc);
487
- }
486
+ // filter out redundant/invalid values
487
+ if (!val || val === 'null' || val === "''")
488
+ return;
489
+ // ensure unique entries
490
+ if (!uniqueLocators.has(val)) {
491
+ uniqueLocators.set(val, { ...obj, value: val });
488
492
  }
489
493
  });
490
494
  let ffLoc = Array.from(uniqueLocators.values());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ff-dom",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,3 +1,4 @@
1
+ //@ts-nocheck
1
2
  import { JSDOM, VirtualConsole } from "jsdom";
2
3
 
3
4
  type ElementDetails = {
@@ -623,13 +624,19 @@ const getElementsFromHTML = (
623
624
  }
624
625
 
625
626
  let uniqueLocators = new Map();
626
- finalLocators.forEach((loc) => {
627
- if (loc.isRecorded === "N") {
628
- uniqueLocators.set(loc.value, loc);
629
- } else {
630
- if (!uniqueLocators.has(loc.value)) {
631
- uniqueLocators.set(loc.value, loc);
632
- }
627
+
628
+ finalLocators.forEach((obj) => {
629
+ let val = obj.value;
630
+ if (obj.isRecorded === 'Y' && val) {
631
+ val = String(val).replace(/"/g, "'").replace(/\\'/g, "'");
632
+ }
633
+
634
+ // filter out redundant/invalid values
635
+ if (!val || val === 'null' || val === "''") return;
636
+
637
+ // ensure unique entries
638
+ if (!uniqueLocators.has(val)) {
639
+ uniqueLocators.set(val, { ...obj, value: val });
633
640
  }
634
641
  });
635
642