@dev-blinq/cucumber_client 1.0.1281-stage → 1.0.1282-stage

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.
@@ -50,7 +50,7 @@ const generateApiCode = async (
50
50
  // create new codePage
51
51
  mjsFullPath = path.join(
52
52
  projectDir,
53
- stepsDefinitions.isTemp ? process.env.tempFeaturesFolderPath ?? "__temp_features" : "features",
53
+ stepsDefinitions.isTemp ? (process.env.tempFeaturesFolderPath ?? "__temp_features") : "features",
54
54
  "step_definitions",
55
55
  `api_tests_page.mjs`
56
56
  );
@@ -60,7 +60,7 @@ const generateApiCode = async (
60
60
  if (!codePage) {
61
61
  mjsFullPath = path.join(
62
62
  projectDir,
63
- stepsDefinitions.isTemp ? process.env.tempFeaturesFolderPath ?? "__temp_features" : "features",
63
+ stepsDefinitions.isTemp ? (process.env.tempFeaturesFolderPath ?? "__temp_features") : "features",
64
64
  "step_definitions",
65
65
  `api_tests_page.mjs`
66
66
  );
@@ -41,10 +41,10 @@ const generateTestData = (featureFile) => {
41
41
  try {
42
42
  const fake = faker.helpers.fake(match[0]);
43
43
 
44
- if(fake === match[0]){
44
+ if (fake === match[0]) {
45
45
  continue;
46
46
  }
47
-
47
+
48
48
  otherFakeData.push({
49
49
  var: match[0],
50
50
  fake,
@@ -4,7 +4,13 @@ import { AstBuilder, GherkinClassicTokenMatcher, Parser } from "@cucumber/gherki
4
4
  import { Feature } from "./feature.js";
5
5
  import { StepsDefinitions } from "./steps_definitions.js";
6
6
 
7
- export const projectDocument = (folder, featureName = null, scenarioName = null, supressErrors = false, errors = []) => {
7
+ export const projectDocument = (
8
+ folder,
9
+ featureName = null,
10
+ scenarioName = null,
11
+ supressErrors = false,
12
+ errors = []
13
+ ) => {
8
14
  const uuidFn = () => (23212).toString(16);
9
15
  const builder = new AstBuilder(uuidFn);
10
16
  const matcher = new GherkinClassicTokenMatcher();
@@ -59,4 +65,4 @@ export const projectDocument = (folder, featureName = null, scenarioName = null,
59
65
  // const documents = projectDocument(projectDir, featureName, scenarioName, true, errors);
60
66
  // const args = process.argv.slice(2);
61
67
 
62
- // console.log(JSON.stringify(documents));
68
+ // console.log(JSON.stringify(documents));
@@ -45,7 +45,10 @@ class StepsDefinitions {
45
45
  if (method && expression.keyword && pattern && expression.methodName) {
46
46
  this.steps[pattern] = {
47
47
  // file: path.join(this.isTemp ? "__temp_features" : "features", mjsFile),
48
- file: path.join(this.isTemp ? process.env.tempFeaturesFolderPath ?? "__temp_features" : "features", mjsFile),
48
+ file: path.join(
49
+ this.isTemp ? (process.env.tempFeaturesFolderPath ?? "__temp_features") : "features",
50
+ mjsFile
51
+ ),
49
52
  functionName: expression.methodName,
50
53
  name: pattern,
51
54
  source: this.findKey(method.codePart, "source"),
@@ -56,7 +59,7 @@ class StepsDefinitions {
56
59
  }
57
60
  load(print = true, supressErrors = false, errors = []) {
58
61
  const mjsFiles = findFilesWithExtension(
59
- path.join(this.baseFolder, this.isTemp ? process.env.tempFeaturesFolderPath ?? "__temp_features" : "features"),
62
+ path.join(this.baseFolder, this.isTemp ? (process.env.tempFeaturesFolderPath ?? "__temp_features") : "features"),
60
63
  "mjs"
61
64
  );
62
65
  // console.log({ mjsFiles });
@@ -64,7 +67,7 @@ class StepsDefinitions {
64
67
  const mjsFile = mjsFiles[i];
65
68
  const filePath = path.join(
66
69
  this.baseFolder,
67
- this.isTemp ? process.env.tempFeaturesFolderPath ?? "__temp_features" : "features",
70
+ this.isTemp ? (process.env.tempFeaturesFolderPath ?? "__temp_features") : "features",
68
71
  mjsFile
69
72
  );
70
73
  const codePage = new CodePage(filePath);
@@ -1100,7 +1100,7 @@ class LocalAgent {
1100
1100
  if (this.context && this.context.web) {
1101
1101
  await this.context.web.afterStep(
1102
1102
  {
1103
- attach: (data, mimeType) => { },
1103
+ attach: (data, mimeType) => {},
1104
1104
  },
1105
1105
  this.cucumberStep
1106
1106
  );
@@ -1,37 +1,34 @@
1
- import {
2
- AstBuilder,
3
- GherkinClassicTokenMatcher,
4
- Parser,
5
- } from '@cucumber/gherkin'
6
- import { readFileSync, writeFileSync } from 'fs'
7
- import { loadArgs, showUsage, validateCLIArg } from './cli_helpers.js'
8
- let id =0;
9
- const uuidFn = () => (++id).toString(16)
10
- const builder = new AstBuilder(uuidFn)
11
- const matcher = new GherkinClassicTokenMatcher()
1
+ import { AstBuilder, GherkinClassicTokenMatcher, Parser } from "@cucumber/gherkin";
2
+ import { readFileSync, writeFileSync } from "fs";
3
+ import { loadArgs, showUsage, validateCLIArg } from "./cli_helpers.js";
4
+ let id = 0;
5
+ const uuidFn = () => (++id).toString(16);
6
+ const builder = new AstBuilder(uuidFn);
7
+ const matcher = new GherkinClassicTokenMatcher();
12
8
 
13
- const parser = new Parser(builder, matcher)
9
+ const parser = new Parser(builder, matcher);
14
10
 
15
11
  const parseFeatureFile = (featureFilePath) => {
16
- const source = readFileSync(featureFilePath, 'utf8')
17
- const gherkinDocument = parser.parse(source)
18
- return gherkinDocument
19
- }
12
+ const source = readFileSync(featureFilePath, "utf8");
13
+ const gherkinDocument = parser.parse(source);
14
+ return gherkinDocument;
15
+ };
20
16
 
21
- const args = loadArgs()
22
- const featureFilePath = args[0]
23
- const outputFilePath = args[1]
24
- const usage = 'Usage: node parse_feature_file.js <featureFilePath> [<outputFilePath>] \n\nExample: node parseFeatureFile.js ./features/my.feature ./features/my.feature.json\n\n'
17
+ const args = loadArgs();
18
+ const featureFilePath = args[0];
19
+ const outputFilePath = args[1];
20
+ const usage =
21
+ "Usage: node parse_feature_file.js <featureFilePath> [<outputFilePath>] \n\nExample: node parseFeatureFile.js ./features/my.feature ./features/my.feature.json\n\n";
25
22
  try {
26
- validateCLIArg(featureFilePath, 'featureFilePath')
23
+ validateCLIArg(featureFilePath, "featureFilePath");
27
24
  } catch (error) {
28
- showUsage(error, usage)
25
+ showUsage(error, usage);
29
26
  }
30
- const gherkinDocument = parseFeatureFile(featureFilePath)
27
+ const gherkinDocument = parseFeatureFile(featureFilePath);
31
28
  if (outputFilePath) {
32
- writeFileSync(outputFilePath, JSON.stringify(gherkinDocument, null, 2))
29
+ writeFileSync(outputFilePath, JSON.stringify(gherkinDocument, null, 2));
33
30
  } else {
34
- console.log(JSON.stringify(gherkinDocument, null, 2))
31
+ console.log(JSON.stringify(gherkinDocument, null, 2));
35
32
  }
36
33
 
37
- export { parseFeatureFile }
34
+ export { parseFeatureFile };
@@ -1,3 +1,3 @@
1
1
  {
2
- "baseUrl": "https://google.com"
3
- }
2
+ "baseUrl": "https://google.com"
3
+ }
@@ -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: {
@@ -2,4 +2,4 @@
2
2
 
3
3
  // getImplementedSteps('/Users/yash/Library/Application Support/blinq.io/67d7c7ffb099a8da65d7e204').then((implementedSteps) => {
4
4
  // console.log(JSON.stringify(implementedSteps, null, 2));
5
- // });
5
+ // });
@@ -265,8 +265,8 @@ export class BVTStepRunner {
265
265
 
266
266
  for (const cmdId of cmdIDs) {
267
267
  this.liveExecutionMap.set(cmdId, {
268
- resolve: () => { },
269
- reject: () => { },
268
+ resolve: () => {},
269
+ reject: () => {},
270
270
  });
271
271
  }
272
272
 
@@ -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);
@@ -381,7 +381,6 @@ export class BVTStepRunner {
381
381
  this.#currentStepController = null;
382
382
  global.__BVT_STEP_ABORT_SIGNAL = null;
383
383
 
384
-
385
384
  try {
386
385
  // Clean up temp folder
387
386
  const __temp_features_FolderName = process.env.tempFeaturesFolderPath;
@@ -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) => {
@@ -391,7 +380,7 @@ export const toRecordingStep = (cmd, parametersMap) => {
391
380
 
392
381
  if (isValueVariable) {
393
382
  step.dataSource = "parameters";
394
- step.dataKey = convertToIdentifier(cmd.value.slice(1, -1))
383
+ step.dataKey = convertToIdentifier(cmd.value.slice(1, -1));
395
384
  }
396
385
 
397
386
  if (!allStrategyLocators) {
@@ -401,12 +390,12 @@ export const toRecordingStep = (cmd, parametersMap) => {
401
390
  locs,
402
391
  isValueVariable,
403
392
  isTextVariable,
404
- parametersMap
393
+ parametersMap,
405
394
  });
406
395
  locatorsObject.locators = locs;
407
396
  return {
408
397
  ...step,
409
- locators: locatorsObject
398
+ locators: locatorsObject,
410
399
  };
411
400
  }
412
401
 
@@ -420,7 +409,7 @@ export const toRecordingStep = (cmd, parametersMap) => {
420
409
  locs: locators,
421
410
  isValueVariable,
422
411
  isTextVariable,
423
- parametersMap
412
+ parametersMap,
424
413
  });
425
414
  }
426
415
 
@@ -430,9 +419,9 @@ export const toRecordingStep = (cmd, parametersMap) => {
430
419
  ...step,
431
420
  locators: locatorsObject,
432
421
  allStrategyLocators,
433
- isLocatorsAssigned: true
422
+ isLocatorsAssigned: true,
434
423
  };
435
- }
424
+ };
436
425
 
437
426
  export const toMethodName = (str) => {
438
427
  // Remove any non-word characters (excluding underscore) and trim spaces
@@ -858,7 +847,14 @@ export async function updateStepDefinitions({ scenario, featureName, projectDir
858
847
  const stepDefsFilePath = locateDefinitionPath(featureFolder, pageName);
859
848
  // path.join(stepDefinitionFolderPath, pageName + "_page.mjs");
860
849
  let codePage = getCodePage(stepDefsFilePath);
861
- codePage = await saveRecording({ step, cucumberStep, codePage, projectDir, stepsDefinitions, parametersMap: scenario.parametersMap });
850
+ codePage = await saveRecording({
851
+ step,
852
+ cucumberStep,
853
+ codePage,
854
+ projectDir,
855
+ stepsDefinitions,
856
+ parametersMap: scenario.parametersMap,
857
+ });
862
858
  if (!codePage) {
863
859
  continue;
864
860
  }
@@ -37,7 +37,7 @@ class ScenarioUploadService {
37
37
  },
38
38
  });
39
39
 
40
- if(response.status === 401) {
40
+ if (response.status === 401) {
41
41
  throw new Error("Your trial plan has ended. Cannot upload reports and perform retraining");
42
42
  }
43
43
 
@@ -63,7 +63,7 @@ class ScenarioUploadService {
63
63
  }
64
64
  );
65
65
 
66
- if(response.status === 403) {
66
+ if (response.status === 403) {
67
67
  throw new Error("Your trial plan has ended. Cannot upload reports and perform retraining");
68
68
  }
69
69
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1281-stage",
3
+ "version": "1.0.1282-stage",
4
4
  "description": " ",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -37,9 +37,9 @@
37
37
  "@babel/traverse": "^7.27.1",
38
38
  "@babel/types": "^7.27.1",
39
39
  "@cucumber/tag-expressions": "^6.1.1",
40
- "@dev-blinq/cucumber-js": "1.0.98-stage",
40
+ "@dev-blinq/cucumber-js": "1.0.99-stage",
41
41
  "@faker-js/faker": "^8.1.0",
42
- "automation_model": "1.0.740-stage",
42
+ "automation_model": "1.0.741-stage",
43
43
  "axios": "^1.7.4",
44
44
  "chokidar": "^3.6.0",
45
45
  "create-require": "^1.1.1",