@dev-blinq/cucumber_client 1.0.1456-dev → 1.0.1458-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.
@@ -32,7 +32,14 @@ class PromisifiedSocketServer {
32
32
  }
33
33
  this.socket.emit("response", { id, value: response, roomId, socketId });
34
34
  } catch (error) {
35
- socketLogger.error("Error handling request", { event, input, id, roomId, socketId, error: error instanceof Error ? `${error.message}\n${error.stack}` : error });
35
+ socketLogger.error("Error handling request", {
36
+ event,
37
+ input,
38
+ id,
39
+ roomId,
40
+ socketId,
41
+ error: error instanceof Error ? `${error.message}\n${error.stack}` : error,
42
+ });
36
43
  this.socket.emit("response", {
37
44
  id,
38
45
  error: {
@@ -320,7 +320,7 @@ export class BVTStepRunner {
320
320
  codePage,
321
321
  projectDir: this.projectDir,
322
322
  stepsDefinitions,
323
- parametersMap
323
+ parametersMap,
324
324
  });
325
325
  if (codePage) {
326
326
  await codePage.save(stepDefsFilePath);
@@ -309,14 +309,7 @@ const _toRecordingStep = (cmd) => {
309
309
  };
310
310
 
311
311
  function getBestStrategy(allStrategyLocators) {
312
- const orderedPriorities = [
313
- "custom",
314
- "context",
315
- "basic",
316
- "text_with_index",
317
- "ignore_digit",
318
- "no_text",
319
- ];
312
+ const orderedPriorities = ["custom", "context", "basic", "text_with_index", "ignore_digit", "no_text"];
320
313
  for (const strategy of orderedPriorities) {
321
314
  if (allStrategyLocators[strategy] && allStrategyLocators[strategy].length > 0) {
322
315
  return strategy;
@@ -325,7 +318,6 @@ function getBestStrategy(allStrategyLocators) {
325
318
  return null;
326
319
  }
327
320
 
328
-
329
321
  const _parameterizeLocators = (locators, replacementFromValue, replacementToValue) => {
330
322
  for (const loc of locators) {
331
323
  if (loc?.css?.includes(replacementFromValue)) {
@@ -339,27 +331,24 @@ const _parameterizeLocators = (locators, replacementFromValue, replacementToValu
339
331
  }
340
332
  }
341
333
  return locators;
342
- }
343
- const parameterizeLocators = ({
344
- cmd, locs, isValueVariable, isTextVariable,
345
- parametersMap
346
- }) => {
334
+ };
335
+ const parameterizeLocators = ({ cmd, locs, isValueVariable, isTextVariable, parametersMap }) => {
347
336
  if (isValueVariable) {
348
337
  const variable = cmd.value.slice(1, -1);
349
338
  const val = parametersMap[variable];
350
339
  const replacementFromValue = val.trim();
351
- const replacementToValue = `{${variable}}`
340
+ const replacementToValue = `{${variable}}`;
352
341
  locs = _parameterizeLocators(locs, replacementFromValue, replacementToValue);
353
342
  }
354
343
  if (isTextVariable) {
355
344
  const variable = cmd.text.slice(1, -1);
356
345
  const val = parametersMap[variable];
357
346
  const replacementFromValue = val.trim();
358
- const replacementToValue = `{${variable}}`
347
+ const replacementToValue = `{${variable}}`;
359
348
  locs = _parameterizeLocators(locs, replacementFromValue, replacementToValue);
360
349
  }
361
- return locs
362
- }
350
+ return locs;
351
+ };
363
352
 
364
353
  //TODO: IMPORTAN
365
354
  export const toRecordingStep = (cmd, parametersMap) => {
@@ -380,6 +369,10 @@ export const toRecordingStep = (cmd, parametersMap) => {
380
369
  if (!locatorsObject) return step;
381
370
  const isValueVariable = isVariable(cmd.value);
382
371
  const isTextVariable = isVariable(cmd.text);
372
+ const allStrategyLocators = JSON.parse(JSON.stringify(cmd?.allStrategyLocators ?? null));
373
+ step.locators = locatorsObject;
374
+ step.allStrategyLocators = allStrategyLocators;
375
+ step.isLocatorsAssigned = true;
383
376
 
384
377
  if (!isValueVariable && !isTextVariable) {
385
378
  return step;
@@ -387,9 +380,8 @@ export const toRecordingStep = (cmd, parametersMap) => {
387
380
 
388
381
  if (isValueVariable) {
389
382
  step.dataSource = "parameters";
390
- step.dataKey = convertToIdentifier(cmd.value.slice(1, -1))
383
+ step.dataKey = convertToIdentifier(cmd.value.slice(1, -1));
391
384
  }
392
- const allStrategyLocators = JSON.parse(JSON.stringify(cmd?.allStrategyLocators ?? null));
393
385
 
394
386
  if (!allStrategyLocators) {
395
387
  let locs = locatorsObject.locators;
@@ -398,12 +390,12 @@ export const toRecordingStep = (cmd, parametersMap) => {
398
390
  locs,
399
391
  isValueVariable,
400
392
  isTextVariable,
401
- parametersMap
393
+ parametersMap,
402
394
  });
403
395
  locatorsObject.locators = locs;
404
396
  return {
405
397
  ...step,
406
- locators: locatorsObject
398
+ locators: locatorsObject,
407
399
  };
408
400
  }
409
401
 
@@ -417,7 +409,7 @@ export const toRecordingStep = (cmd, parametersMap) => {
417
409
  locs: locators,
418
410
  isValueVariable,
419
411
  isTextVariable,
420
- parametersMap
412
+ parametersMap,
421
413
  });
422
414
  }
423
415
 
@@ -427,9 +419,9 @@ export const toRecordingStep = (cmd, parametersMap) => {
427
419
  ...step,
428
420
  locators: locatorsObject,
429
421
  allStrategyLocators,
430
- isLocatorsAssigned: true
422
+ isLocatorsAssigned: true,
431
423
  };
432
- }
424
+ };
433
425
 
434
426
  export const toMethodName = (str) => {
435
427
  // Remove any non-word characters (excluding underscore) and trim spaces
@@ -854,7 +846,14 @@ export async function updateStepDefinitions({ scenario, featureName, projectDir
854
846
  const stepDefsFilePath = locateDefinitionPath(featureFolder, pageName);
855
847
  // path.join(stepDefinitionFolderPath, pageName + "_page.mjs");
856
848
  let codePage = getCodePage(stepDefsFilePath);
857
- codePage = await saveRecording({ step, cucumberStep, codePage, projectDir, stepsDefinitions, parametersMap: scenario.parametersMap });
849
+ codePage = await saveRecording({
850
+ step,
851
+ cucumberStep,
852
+ codePage,
853
+ projectDir,
854
+ stepsDefinitions,
855
+ parametersMap: scenario.parametersMap,
856
+ });
858
857
  if (!codePage) {
859
858
  continue;
860
859
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1456-dev",
3
+ "version": "1.0.1458-dev",
4
4
  "description": " ",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",