@dev-blinq/cucumber_client 1.0.1424-dev → 1.0.1426-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.
@@ -150,6 +150,7 @@ class LocatorGenerator {
150
150
  }
151
151
  getTextLocators(element, options) {
152
152
  const injectedScript = this.injectedScript;
153
+ const { textToIgnore = null } = options;
153
154
  const selectorPartLists = this.PW.selectorGenerator.buildTextCandidates(injectedScript, element, options);
154
155
  const result = [];
155
156
  for (const selectorPartList of selectorPartLists) {
@@ -157,6 +158,10 @@ class LocatorGenerator {
157
158
  const tSelectorList = [];
158
159
  for (const selectorPart of selectorPartList) {
159
160
  const { engine, selector } = selectorPart;
161
+ if (textToIgnore && selector.includes(textToIgnore)
162
+ ) {
163
+ continue;
164
+ }
160
165
  if (engine === "css") {
161
166
  tSelectorList.push(selector);
162
167
  } else {
@@ -439,6 +444,10 @@ class LocatorGenerator {
439
444
  const nonUnique = [];
440
445
  try {
441
446
  for (const locator of locators) {
447
+ if (!locator || !locator.css || typeof locator.css !== "string") {
448
+ console.error("Locator must have a valid css selector found: ", locator);
449
+ continue;
450
+ }
442
451
  const elements = this.getMatchingElements(locator.css, options);
443
452
  if (elements.length === 0) {
444
453
  console.warn(`No elements found for locator: ${locator.css}`);
@@ -673,9 +682,11 @@ class LocatorGenerator {
673
682
  const allAncestors = this.dom_Parent.getFullAncestorChainToRoot(element, root);
674
683
  allAncestors.shift(); // remove the element itself from the ancestors
675
684
 
685
+ const cache = new Map();
686
+ const textToIgnore = this.PW.selectorUtils.elementText(cache, element).full.trim();
676
687
  const ancestorLocators = [];
677
688
  for (const ancestor of allAncestors) {
678
- const _locators = locatorGenerator(ancestor, options);
689
+ const _locators = locatorGenerator(ancestor, { ...options, textToIgnore });
679
690
  if (!_locators || !Array.isArray(_locators) || _locators.length === 0) {
680
691
  continue;
681
692
  }
@@ -44,7 +44,10 @@ export class BVTStepRunner {
44
44
 
45
45
  async pauseExecution(cmdId) {
46
46
  if (this.bvtContext.web) {
47
- this.bvtContext.web.pausedCmd = this.liveExecutionMap.get(cmdId);
47
+ this.bvtContext.web.pausedCmd = {
48
+ id: cmdId,
49
+ ...this.liveExecutionMap.get(cmdId),
50
+ };
48
51
  }
49
52
  }
50
53
 
@@ -258,8 +261,8 @@ export class BVTStepRunner {
258
261
 
259
262
  for (const cmdId of cmdIDs) {
260
263
  this.liveExecutionMap.set(cmdId, {
261
- resolve: () => { },
262
- reject: () => { },
264
+ resolve: () => {},
265
+ reject: () => {},
263
266
  });
264
267
  }
265
268
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1424-dev",
3
+ "version": "1.0.1426-dev",
4
4
  "description": " ",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",