ff-dom 1.0.15 → 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.
@@ -478,22 +478,17 @@ const getElementsFromHTML = (name, desc, type, locators, isShared, projectId, pr
478
478
  }
479
479
  }
480
480
  let uniqueLocators = new Map();
481
- finalLocators.forEach((loc) => {
482
- if (loc.isRecorded === 'Y') {
483
- finalLocators = finalLocators.map((obj) => ({
484
- ...obj,
485
- value: String(obj.value).replace(/"/g, "'"),
486
- }));
481
+ finalLocators.forEach((obj) => {
482
+ let val = obj.value;
483
+ if (obj.isRecorded === 'Y' && val) {
484
+ val = String(val).replace(/"/g, "'").replace(/\\'/g, "'");
487
485
  }
488
- });
489
- finalLocators.forEach((loc) => {
490
- if (loc.isRecorded === "N") {
491
- uniqueLocators.set(loc.value, loc);
492
- }
493
- else {
494
- if (!uniqueLocators.has(loc.value)) {
495
- uniqueLocators.set(loc.value, loc);
496
- }
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 });
497
492
  }
498
493
  });
499
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.15",
3
+ "version": "1.0.16",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -624,21 +624,19 @@ const getElementsFromHTML = (
624
624
  }
625
625
 
626
626
  let uniqueLocators = new Map();
627
- finalLocators.forEach((loc) => {
628
- if (loc.isRecorded === 'Y') {
629
- finalLocators = finalLocators.map((obj) => ({
630
- ...obj,
631
- value: String(obj.value).replace(/"/g, "'"),
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, "'");
633
632
  }
634
- });
635
- finalLocators.forEach((loc) => {
636
- if (loc.isRecorded === "N") {
637
- uniqueLocators.set(loc.value, loc);
638
- } else {
639
- if (!uniqueLocators.has(loc.value)) {
640
- uniqueLocators.set(loc.value, loc);
641
- }
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 });
642
640
  }
643
641
  });
644
642