@dev-blinq/cucumber_client 1.0.1506-dev → 1.0.1508-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.
@@ -332,20 +332,28 @@ const _parameterizeLocators = (locators, replacementFromValue, replacementToValu
332
332
  }
333
333
  return locators;
334
334
  };
335
- const parameterizeLocators = ({ cmd, locs, isValueVariable, isTextVariable, parametersMap }) => {
335
+ const parameterizeLocators = ({ cmd, locs, isValueVariable, isTargetValueVariable, parametersMap }) => {
336
336
  if (isValueVariable) {
337
337
  const variable = cmd.value.slice(1, -1);
338
- const val = parametersMap[variable];
339
- const replacementFromValue = val.trim();
340
- const replacementToValue = `{${variable}}`;
341
- locs = _parameterizeLocators(locs, replacementFromValue, replacementToValue);
342
- }
343
- if (isTextVariable) {
344
- const variable = cmd.text.slice(1, -1);
345
- const val = parametersMap[variable];
346
- const replacementFromValue = val.trim();
347
- const replacementToValue = `{${variable}}`;
348
- locs = _parameterizeLocators(locs, replacementFromValue, replacementToValue);
338
+ // const val = parametersMap[variable];
339
+ if (typeof cmd.text === "string") {
340
+ const replacementFromValue = cmd.text.trim().replace(/\s+/, " ") ?? "" // val.trim();
341
+ if (replacementFromValue.length > 0) {
342
+ const replacementToValue = `{${variable}}`;
343
+ locs = _parameterizeLocators(locs, replacementFromValue, replacementToValue);
344
+ }
345
+ }
346
+ }
347
+ if (isTargetValueVariable) {
348
+ const variable = cmd.targetValue.slice(1, -1);
349
+ // const val = parametersMap[variable];
350
+ if (typeof cmd.targetText === "string") {
351
+ const replacementFromValue = cmd.targetText.trim().replace(/\s+/, " ") ?? "" // val.trim();
352
+ if (replacementFromValue.length > 0) {
353
+ const replacementToValue = `{${variable}}`;
354
+ locs = _parameterizeLocators(locs, replacementFromValue, replacementToValue);
355
+ }
356
+ }
349
357
  }
350
358
  return locs;
351
359
  };
@@ -372,13 +380,13 @@ export const toRecordingStep = (cmd, parametersMap) => {
372
380
  locatorsObject.element_name = element_name;
373
381
 
374
382
  const isValueVariable = isVariable(cmd.value);
375
- const isTextVariable = isVariable(cmd.text);
383
+ const isTargetValueVariable = isVariable(cmd.targetValue);
376
384
  const allStrategyLocators = JSON.parse(JSON.stringify(cmd?.allStrategyLocators ?? null));
377
385
  step.locators = locatorsObject;
378
386
  step.allStrategyLocators = allStrategyLocators;
379
387
  step.isLocatorsAssigned = true;
380
388
 
381
- if (!isValueVariable && !isTextVariable) {
389
+ if (!isValueVariable && !isTargetValueVariable) {
382
390
  return step;
383
391
  }
384
392
 
@@ -393,7 +401,7 @@ export const toRecordingStep = (cmd, parametersMap) => {
393
401
  cmd,
394
402
  locs,
395
403
  isValueVariable,
396
- isTextVariable,
404
+ isTargetValueVariable,
397
405
  parametersMap,
398
406
  });
399
407
  locatorsObject.locators = locs;
@@ -412,7 +420,7 @@ export const toRecordingStep = (cmd, parametersMap) => {
412
420
  cmd,
413
421
  locs: locators,
414
422
  isValueVariable,
415
- isTextVariable,
423
+ isTargetValueVariable,
416
424
  parametersMap,
417
425
  });
418
426
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1506-dev",
3
+ "version": "1.0.1508-dev",
4
4
  "description": " ",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",