@dev-blinq/cucumber_client 1.0.1225-dev → 1.0.1227-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
 
@@ -933,6 +933,11 @@ class BVTRecorder {
933
933
  }
934
934
  const role = window.getAriaRole(el);
935
935
  const label = window.getElementAccessibleName(el, false) || window.getElementAccessibleName(el, true) || role || "";
936
+ const attrs2 = {};
937
+ for (var att, i = 0, atts = el.attributes, n = atts.length; i < n; i++) {
938
+ const att = atts[i];
939
+ attrs2[att.nodeName] = att.nodeValue;
940
+ }
936
941
  return {
937
942
  role,
938
943
  label,
@@ -956,6 +961,7 @@ class BVTRecorder {
956
961
  checked: el.checked,
957
962
  innerText: el.innerText,
958
963
  },
964
+ allAttributes: attrs2,
959
965
  };
960
966
  }
961
967
  handleEvent(e) {
@@ -58,6 +58,9 @@ for (let i = 0; i < scenarioReport.stepsProgress.length; i++) {
58
58
  page.addCucumberStep(keyword, step.cucumberLine, methodName, step.recording.steps.length);
59
59
 
60
60
  page.removeUnusedElements();
61
+ if (generateCodeResult.locatorsMetadata) {
62
+ page.addLocatorsMetadata(generateCodeResult.locatorsMetadata);
63
+ }
61
64
  await page.save();
62
65
  set.add(page.sourceFileName);
63
66
  }
@@ -497,6 +497,10 @@ this.imports[2].node.source.value
497
497
  if (config && config.locatorsMetadataDir) {
498
498
  // if config.locatorsMetadataDir is set, use it to create the file path
499
499
  locatorsMetadataFileName = path.join(config.locatorsMetadataDir, path.basename(locatorsMetadataFileName));
500
+ // check if the directory exists, if not create it
501
+ if (!existsSync(path.dirname(locatorsMetadataFileName))) {
502
+ mkdirSync(path.dirname(locatorsMetadataFileName), { recursive: true });
503
+ }
500
504
  }
501
505
  let metadata = {};
502
506
  // try to read the file to metadata, protect with try catch
@@ -62,6 +62,12 @@ const _isCodeGenerationStep = (step) => {
62
62
  }
63
63
  return false;
64
64
  };
65
+ // Note: this function is used to exclude a key from an object
66
+ // Please move it to utils and use it as a reusable function ...
67
+ function excludeKey(obj, keyToRemove) {
68
+ const { [keyToRemove]: _, ...rest } = obj;
69
+ return rest;
70
+ }
65
71
  const splitToLocatorsGroups = (locators) => {
66
72
  const no_text = locators.locators.filter((locator) => locator.mode === "NO_TEXT");
67
73
  const ignore_digit = locators.locators.filter((locator) => locator.mode === "IGNORE_DIGIT");
@@ -131,7 +137,8 @@ const _generateCodeFromCommand = (step, elements, userData) => {
131
137
  if (!elementIdentifier) {
132
138
  elementIdentifier = findElementIdentifier(node, step, userData, elements);
133
139
  }
134
- elements[elementIdentifier] = locatorObject;
140
+ const withoutAllStrategyLocators = excludeKey(locatorObject, "allStrategyLocators");
141
+ elements[elementIdentifier] = withoutAllStrategyLocators;
135
142
  elementsChanged = true;
136
143
  }
137
144
  let optionElement = null;
@@ -655,6 +655,7 @@ class LocalAgent {
655
655
 
656
656
  let page = agent.project.getPage(agent.pageName, true);
657
657
  const generateCodeResult = generateCode(recording, page, userData, agent.project.rootFolder, methodName);
658
+
658
659
  if (generateCodeResult.simple === true) {
659
660
  agent.sendDone("generateStepCode", null);
660
661
  break;
@@ -707,6 +708,9 @@ class LocalAgent {
707
708
  cucumberStep: agent.cucumberStep,
708
709
  },
709
710
  });
711
+ if (generateCodeResult.locatorsMetadata) {
712
+ page.addLocatorsMetadata(generateCodeResult.locatorsMetadata);
713
+ }
710
714
  await page.save();
711
715
  agent.scenarioReport.updateLastStep({
712
716
  recording: command.data.recording,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1225-dev",
3
+ "version": "1.0.1227-dev",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "@babel/traverse": "^7.27.1",
27
27
  "@babel/types": "^7.27.1",
28
28
  "@cucumber/tag-expressions": "^6.1.1",
29
- "@dev-blinq/cucumber-js": "1.0.172-dev",
29
+ "@dev-blinq/cucumber-js": "1.0.173-dev",
30
30
  "@faker-js/faker": "^8.1.0",
31
31
  "automation_model": "1.0.737-dev",
32
32
  "axios": "^1.7.4",