@zohodesk/testinglibrary 0.1.8-bdd-30.1 → 0.1.8-bdd-30.2

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.
Files changed (40) hide show
  1. package/.babelrc +18 -18
  2. package/.eslintrc.js +31 -31
  3. package/.prettierrc +5 -5
  4. package/README.md +17 -17
  5. package/bin/cli.js +2 -2
  6. package/build/bdd-poc/core-runner/createCallbacksMap.js +11 -8
  7. package/build/bdd-poc/core-runner/{intialize.js → initializeMaps.js} +1 -1
  8. package/build/bdd-poc/core-runner/main.js +7 -7
  9. package/build/bdd-poc/core-runner/stepRunner.js +8 -2
  10. package/build/bdd-poc/errors/throwError.js +6 -1
  11. package/build/bdd-poc/gherkin-parser/createTestTemplate.js +8 -8
  12. package/build/bdd-poc/gherkin-parser/cucumber/{cucumberSynatxParser.js → cucumberSyntaxParser.js} +4 -4
  13. package/build/bdd-poc/gherkin-parser/cucumber/data-driven/dataSourceMap.js +16 -16
  14. package/build/bdd-poc/gherkin-parser/stepsDefinition/extractTestInputs.js +18 -17
  15. package/build/bdd-poc/gherkin-parser/stepsDefinition/parserStepsArguments.js +5 -6
  16. package/build/bdd-poc/snippets/stepsnippets.js +2 -2
  17. package/build/bdd-poc/utils/stringManipulation.js +11 -8
  18. package/build/core/playwright/readConfigFile.js +30 -30
  19. package/build/core/playwright/setup/config-creator.js +9 -9
  20. package/build/core/playwright/setup/config-utils.js +7 -7
  21. package/build/index.d.ts +13 -13
  22. package/build/parser/sample.feature +34 -34
  23. package/build/parser/sample.spec.js +18 -18
  24. package/build/parser/verifier.js +2 -3
  25. package/build/setup-folder-structure/reportEnhancement/addonScript.html +23 -24
  26. package/build/setup-folder-structure/samples/auth-setup-sample.js +72 -72
  27. package/build/setup-folder-structure/samples/authUsers-sample.json +8 -8
  28. package/build/setup-folder-structure/samples/env-config-sample.json +20 -20
  29. package/build/setup-folder-structure/samples/git-ignore.sample.js +36 -36
  30. package/build/setup-folder-structure/samples/uat-config-sample.js +44 -44
  31. package/build/utils/PathProviderOfConfig.js +25 -0
  32. package/build/utils/cliArgsToObject.js +25 -25
  33. package/build/utils/fileUtils.js +10 -0
  34. package/changelog.md +131 -131
  35. package/jest.config.js +63 -63
  36. package/npm-shrinkwrap.json +5994 -5994
  37. package/package.json +56 -56
  38. package/playwright.config.js +112 -112
  39. package/build/bdd-poc/config/pathConfig.js +0 -26
  40. /package/build/bdd-poc/gherkin-parser/cucumber/{cucumber.js → invokerOfCucumberParser.js} +0 -0
package/.babelrc CHANGED
@@ -1,19 +1,19 @@
1
- {
2
- "presets": [
3
- [
4
- "@babel/preset-env",
5
- {
6
- "targets": {
7
- "node": "14"
8
- },
9
- "exclude": ["@babel/plugin-transform-destructuring"]
10
- }
11
- ]
12
- ],
13
- "plugins": [
14
- ["@babel/plugin-transform-runtime"]
15
- ],
16
- "ignore": [
17
- "./src/setup-folder-structure/samples"
18
- ]
1
+ {
2
+ "presets": [
3
+ [
4
+ "@babel/preset-env",
5
+ {
6
+ "targets": {
7
+ "node": "14"
8
+ },
9
+ "exclude": ["@babel/plugin-transform-destructuring"]
10
+ }
11
+ ]
12
+ ],
13
+ "plugins": [
14
+ ["@babel/plugin-transform-runtime"]
15
+ ],
16
+ "ignore": [
17
+ "./src/setup-folder-structure/samples"
18
+ ]
19
19
  }
package/.eslintrc.js CHANGED
@@ -1,31 +1,31 @@
1
- module.exports = {
2
- "env": {
3
- "node": true,
4
- "es2021": true
5
- },
6
- "extends": "eslint:recommended",
7
- "overrides": [
8
- {
9
- "env": {
10
- "node": true
11
- },
12
- "files": [
13
- ".eslintrc.{js,cjs}"
14
- ],
15
- "parserOptions": {
16
- "sourceType": "script"
17
- }
18
- }
19
- ],
20
- "parserOptions": {
21
- "ecmaVersion": "latest",
22
- "sourceType": "module"
23
- },
24
- "rules": {
25
- "indent": ["error", 2, { "SwitchCase": 1 }],
26
- "no-empty-pattern": "off",
27
- "comma-dangle": ["error", "never"],
28
- "curly": ["error"],
29
- "brace-style": "error"
30
- }
31
- }
1
+ module.exports = {
2
+ "env": {
3
+ "node": true,
4
+ "es2021": true
5
+ },
6
+ "extends": "eslint:recommended",
7
+ "overrides": [
8
+ {
9
+ "env": {
10
+ "node": true
11
+ },
12
+ "files": [
13
+ ".eslintrc.{js,cjs}"
14
+ ],
15
+ "parserOptions": {
16
+ "sourceType": "script"
17
+ }
18
+ }
19
+ ],
20
+ "parserOptions": {
21
+ "ecmaVersion": "latest",
22
+ "sourceType": "module"
23
+ },
24
+ "rules": {
25
+ "indent": ["error", 2, { "SwitchCase": 1 }],
26
+ "no-empty-pattern": "off",
27
+ "comma-dangle": ["error", "never"],
28
+ "curly": ["error"],
29
+ "brace-style": "error"
30
+ }
31
+ }
package/.prettierrc CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "trailingComma": "none",
3
- "singleQuote": true,
4
- "arrowParens": "avoid",
5
- "jsxSingleQuote": true
1
+ {
2
+ "trailingComma": "none",
3
+ "singleQuote": true,
4
+ "arrowParens": "avoid",
5
+ "jsxSingleQuote": true
6
6
  }
package/README.md CHANGED
@@ -1,18 +1,18 @@
1
- # Testing Framework
2
-
3
- ## Framework that abstracts the configuration for playwright and Jest
4
-
5
- - Playwright
6
- - Jest
7
-
8
- ## Cli
9
-
10
- ## Feature Supported
11
-
12
- ### Run TestCase
13
-
14
- - npm run test
15
- ### Generate Report
16
-
17
- - npm run report
1
+ # Testing Framework
2
+
3
+ ## Framework that abstracts the configuration for playwright and Jest
4
+
5
+ - Playwright
6
+ - Jest
7
+
8
+ ## Cli
9
+
10
+ ## Feature Supported
11
+
12
+ ### Run TestCase
13
+
14
+ - npm run test
15
+ ### Generate Report
16
+
17
+ - npm run report
18
18
 
package/bin/cli.js CHANGED
@@ -1,3 +1,3 @@
1
- #!/usr/bin/env node
2
-
1
+ #!/usr/bin/env node
2
+
3
3
  require('../build/lib/cli');
@@ -5,20 +5,23 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.createStepsCallBack = createStepsCallBack;
8
- var _fastGlob = require("fast-glob");
9
8
  var _path = _interopRequireDefault(require("path"));
10
- var _pathConfig = require("../config/pathConfig");
11
- /**
12
- * @function
13
- * @name stepFileMap - Create a Map of step description as key and callBacks as value
9
+ var _PathProviderOfConfig = require("../../utils/PathProviderOfConfig");
10
+ var _logger = require("../../utils/logger");
11
+ var _throwError = require("../errors/throwError");
12
+ var _fileUtils = require("../../utils/fileUtils");
13
+ /**
14
+ * @function
15
+ * @name stepFileMap - Create a Map of step description as key and callBacks as value
14
16
  */
15
17
 
16
18
  async function createStepsCallBack() {
17
- const actualSpecPattern = (0, _pathConfig.getStepFilePath)();
18
- await (0, _fastGlob.globSync)(actualSpecPattern, {
19
+ const actualSpecPattern = (0, _PathProviderOfConfig.getStepFilePath)();
20
+ const specFilePathsGlob = await (0, _fileUtils.getFilesFromGivenPattern)(actualSpecPattern, {
19
21
  dot: true,
20
22
  cwd: process.cwd()
21
- }).forEach(FilePath => {
23
+ });
24
+ specFilePathsGlob.forEach(FilePath => {
22
25
  const specFilePath = _path.default.resolve(process.cwd(), FilePath);
23
26
  // Executing spec file to store description and callbacks && Esm Pattern && invoke call
24
27
  require(specFilePath);
@@ -10,6 +10,6 @@ async function createGlobalMaps() {
10
10
  // globalStepMap = stores (description callback)
11
11
  globalThis.globalStepMap = new Map();
12
12
  (0, _createCallbacksMap.createStepsCallBack)();
13
- // globalTestDataMap For feature Files (parser testdata map)
13
+ // globalTestDataMap For feature Files (parser testData map)
14
14
  globalThis.globalTestDataMap = await (0, _dataSourceMap.createTestDataMap)();
15
15
  }
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.preProcessGherkin = preProcessGherkin;
7
7
  var _createTestTemplate = require("../gherkin-parser/createTestTemplate");
8
- /**
9
- * @function
10
- * @name createCucumber - start generating Step Files
8
+ /**
9
+ * @function
10
+ * @name createCucumber - start generating Step Files
11
11
  */
12
12
 
13
13
  function preProcessGherkin() {
14
14
  (0, _createTestTemplate.gherkinParser)();
15
15
  }
16
16
 
17
- /**
18
- * feature relates - gherkin
19
- * steps related - gherkin step
20
- * developer written - step file
17
+ /**
18
+ * feature relates - gherkin
19
+ * steps related - gherkin step
20
+ * developer written - step file
21
21
  */
@@ -5,6 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createNativeBDD = createNativeBDD;
7
7
  var _logger = require("../../utils/logger");
8
+ /**
9
+ * @global
10
+ * @type {Map}
11
+ * @name {globalTestData} - Stores key as description and value as test data of that description
12
+ * @name {globalStepMap} - Stores key as description and value as callback of that description
13
+ */
8
14
  const $And = description => {
9
15
  const stepFunction = globalStepMap.get(description);
10
16
  if (stepFunction === undefined) {
@@ -77,8 +83,8 @@ function getScenarioTable(stepArguments, description, argument) {
77
83
  globalTestDataMap.set(description, Object.assign({}, duplicateInput));
78
84
  return extracted;
79
85
  }
80
- /**
81
- * get method input but not get it assign and extract
86
+ /**
87
+ * get method input but not get it assign and extract
82
88
  */
83
89
 
84
90
  const $Given = $And;
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.throwFilesNotFoundError = throwFilesNotFoundError;
6
7
  exports.throwNotImplementError = throwNotImplementError;
7
8
  exports.throwProperStepImplementError = throwProperStepImplementError;
8
9
  var _logger = require("../../utils/logger");
@@ -14,13 +15,17 @@ function throwNotImplementError(step, stepInSpec, keyword) {
14
15
  \n }
15
16
  `);
16
17
  }
17
- function throwProperStepImplementError(filePath, description = "", options = null) {
18
+ function throwProperStepImplementError(filePath, description = '', options = null) {
18
19
  return _logger.Logger.log(_logger.Logger.FAILURE_TYPE, `
19
20
  \n Page Fixtures and Test Data are Not Used is Steps :(
20
21
  \n File : ${filePath}
21
22
  \n MisMatch Steps Pattern !
22
23
  `);
23
24
  }
25
+ function throwFilesNotFoundError(errorMessage = null, filePath = null) {
26
+ _logger.Logger.log(_logger.Logger.FAILURE_TYPE, errorMessage);
27
+ process.exit(1);
28
+ }
24
29
 
25
30
  // name conversion
26
31
  // Error info (friendly error msg) and action to solve that issue
@@ -5,30 +5,30 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.gherkinParser = gherkinParser;
8
- var _fastGlob = _interopRequireDefault(require("fast-glob"));
9
8
  var _path = _interopRequireDefault(require("path"));
10
- var _cucumberSynatxParser = require("./cucumber/cucumberSynatxParser");
9
+ var _cucumberSyntaxParser = require("./cucumber/cucumberSyntaxParser");
11
10
  var _generateStep = require("./stepsDefinition/generateStep");
12
11
  var _fileUtils = require("../../utils/fileUtils");
13
- var _pathConfig = require("../config/pathConfig");
12
+ var _PathProviderOfConfig = require("../../utils/PathProviderOfConfig");
14
13
  var _parserStepsArguments = require("./stepsDefinition/parserStepsArguments");
15
14
  // import { createStepDataMap } from './extractTestInputs';
16
15
 
17
16
  async function gherkinParser() {
18
17
  await (0, _parserStepsArguments.createStepArgumentsMap)();
19
- const featureFilePattern = (0, _pathConfig.getFeatureFilePath)();
18
+ const featureFilePattern = (0, _PathProviderOfConfig.getFeatureFilePath)();
20
19
  const featureFileFolderPath = _path.default.resolve(process.cwd(), 'uat', '.feature-gen');
21
20
  if (!(0, _fileUtils.checkIfFileExists)(featureFileFolderPath)) {
22
21
  (0, _fileUtils.createFolderSync)(featureFileFolderPath, {
23
22
  recursive: true
24
23
  });
25
24
  }
26
- _fastGlob.default.globSync(featureFilePattern, {
25
+ const featureFilePathsGlob = await (0, _fileUtils.getFilesFromGivenPattern)(featureFilePattern, {
27
26
  dot: true,
28
27
  cwd: process.cwd()
29
- }).forEach(filePath => {
30
- const featurefilePath = _path.default.resolve(process.cwd(), filePath);
31
- const parsedFeatureContent = (0, _cucumberSynatxParser.parseFeature)((0, _fileUtils.readFileContents)(featurefilePath, 'utf-8'));
28
+ });
29
+ featureFilePathsGlob.forEach(filePath => {
30
+ const featureFilePath = _path.default.resolve(process.cwd(), filePath);
31
+ const parsedFeatureContent = (0, _cucumberSyntaxParser.parseFeature)((0, _fileUtils.readFileContents)(featureFilePath, 'utf-8'));
32
32
  const fileName = _path.default.basename(filePath).replace('.feature', '.spec.js');
33
33
  generateStepFiles(parsedFeatureContent, fileName, filePath);
34
34
  });
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.parseFeature = parseFeature;
8
8
  exports.testDataExtraction = testDataExtraction;
9
- var _cucumber = _interopRequireDefault(require("./cucumber"));
9
+ var _invokerOfCucumberParser = _interopRequireDefault(require("./invokerOfCucumberParser"));
10
10
  function parseFeature(featureFileContent) {
11
11
  var _gherkinDocument$feat;
12
- var gherkinDocument = (0, _cucumber.default)(featureFileContent);
12
+ var gherkinDocument = (0, _invokerOfCucumberParser.default)(featureFileContent);
13
13
  var currentFeature = {
14
- feature: "",
14
+ feature: '',
15
15
  featureTags: [],
16
16
  scenarios: [],
17
17
  featureBackGround: []
@@ -22,7 +22,7 @@ function parseFeature(featureFileContent) {
22
22
  gherkinDocument.feature.children.forEach($scenario => {
23
23
  var _$scenario$scenario, _$scenario$scenario2, _$scenario$scenario3, _$scenario$scenario4;
24
24
  var scenarioSteps = {
25
- scenarioDescription: "",
25
+ scenarioDescription: '',
26
26
  steps: [],
27
27
  tablebody: false,
28
28
  tableheader: false,
@@ -5,24 +5,24 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.createTestDataMap = createTestDataMap;
8
- var _fastGlob = _interopRequireDefault(require("fast-glob"));
9
8
  var _generateStep = require("../../stepsDefinition/generateStep");
10
9
  var _fileUtils = require("../../../../utils/fileUtils");
11
10
  var _path = _interopRequireDefault(require("path"));
12
- var _cucumber = _interopRequireDefault(require("../cucumber"));
13
- var _pathConfig = require("../../../config/pathConfig");
14
- var _cucumberSynatxParser = require("../cucumberSynatxParser");
11
+ var _invokerOfCucumberParser = _interopRequireDefault(require("../invokerOfCucumberParser"));
12
+ var _PathProviderOfConfig = require("../../../../utils/PathProviderOfConfig");
13
+ var _cucumberSyntaxParser = require("../cucumberSyntaxParser");
15
14
  function createTestDataMap() {
16
15
  var exampleSteps = [];
17
- const globalTestdata = new Map();
18
- const testDataFeatureFilePath = (0, _pathConfig.getFeatureFilePath)();
19
- return new Promise(resolve => {
20
- _fastGlob.default.globSync(testDataFeatureFilePath, {
16
+ const testData = new Map();
17
+ const testDataFeatureFilePath = (0, _PathProviderOfConfig.getFeatureFilePath)();
18
+ return new Promise(async resolve => {
19
+ const testData = await (0, _fileUtils.getFilesFromGivenPattern)(testDataFeatureFilePath, {
21
20
  dot: true,
22
21
  cwd: process.cwd()
23
- }).forEach(filePath => {
22
+ });
23
+ testData.forEach(filePath => {
24
24
  var body, header;
25
- var gherkinDocument = (0, _cucumber.default)((0, _fileUtils.readFileContents)(_path.default.resolve(process.cwd(), filePath), 'utf-8'));
25
+ var gherkinDocument = (0, _invokerOfCucumberParser.default)((0, _fileUtils.readFileContents)(_path.default.resolve(process.cwd(), filePath), 'utf-8'));
26
26
  gherkinDocument.feature.children.forEach($scenario => {
27
27
  var _$scenario$scenario, _$scenario$scenario3, _$scenario$scenario4;
28
28
  if ($scenario !== null && $scenario !== void 0 && $scenario.background) {
@@ -63,7 +63,7 @@ function createTestDataMap() {
63
63
  $currentStep.dataTableStep = dataTableStep;
64
64
  $currentStep.steptable = true;
65
65
  }
66
- globalTestdata.set(convertedStep, Object.assign({}, $currentStep));
66
+ testData.set(convertedStep, Object.assign({}, $currentStep));
67
67
  });
68
68
  }
69
69
  if ($scenario.background && typeof $scenario.background === Object) {
@@ -92,16 +92,16 @@ function createTestDataMap() {
92
92
  return exampleHead.value;
93
93
  });
94
94
  });
95
- const inputParameter = (0, _cucumberSynatxParser.testDataExtraction)(header, body);
95
+ const inputParameter = (0, _cucumberSyntaxParser.testDataExtraction)(header, body);
96
96
  exampleSteps.forEach(step => {
97
97
  $currentExampleSteps.inputParameter = Object.assign([], inputParameter);
98
98
  $currentExampleSteps.scenarioTable = true;
99
- globalTestdata.set(step, Object.assign({}, $currentExampleSteps));
99
+ testData.set(step, Object.assign({}, $currentExampleSteps));
100
100
  });
101
101
  }
102
102
  });
103
103
  });
104
- resolve(globalTestdata);
104
+ resolve(testData);
105
105
  });
106
106
  }
107
107
 
@@ -149,7 +149,7 @@ function createTestDataMap() {
149
149
  // $currentStep.steptable = true;
150
150
  // }
151
151
 
152
- // $globalTestdata.set(convertedStep, Object.assign({}, $currentStep));
152
+ // $testData.set(convertedStep, Object.assign({}, $currentStep));
153
153
  // });
154
154
  // }
155
155
 
@@ -188,7 +188,7 @@ function createTestDataMap() {
188
188
  // inputParameter
189
189
  // );
190
190
  // $currentExampleSteps.scenarioTable = true;
191
- // $globalTestdata.set(step, Object.assign({}, $currentExampleSteps));
191
+ // $testData.set(step, Object.assign({}, $currentExampleSteps));
192
192
  // });
193
193
  // }
194
194
  // });
@@ -8,17 +8,18 @@ exports.createStepDataMap = createStepDataMap;
8
8
  var _fastGlob = _interopRequireDefault(require("fast-glob"));
9
9
  var _fileUtils = require("../../../utils/fileUtils");
10
10
  var _path = _interopRequireDefault(require("path"));
11
- var _pathConfig = require("../../config/pathConfig");
11
+ var _PathProviderOfConfig = require("../../../utils/PathProviderOfConfig");
12
12
  var _throwError = require("../../errors/throwError");
13
13
  // globalThis.testDataMap = new Map();
14
14
  function createStepDataMap() {
15
- const stepFilePath = (0, _pathConfig.getStepFilePath)();
15
+ const stepFilePath = (0, _PathProviderOfConfig.getStepFilePath)();
16
16
  const processedSpecFile = [];
17
- return new Promise(resolve => {
18
- _fastGlob.default.globSync(stepFilePath, {
17
+ return new Promise(async resolve => {
18
+ const stepMap = await (0, _fileUtils.getFilesFromGivenPattern)(stepFilePath, {
19
19
  dot: true,
20
20
  cwd: process.cwd()
21
- }).forEach(filePath => {
21
+ });
22
+ stepMap.forEach(filePath => {
22
23
  processedSpecFile.push(extractPageFixtures(filePath));
23
24
  });
24
25
  Promise.all(processedSpecFile);
@@ -28,24 +29,24 @@ function createStepDataMap() {
28
29
  function extractPageFixtures(filePath) {
29
30
  const code = (0, _fileUtils.readFileContents)(_path.default.resolve(process.cwd(), filePath), 'utf-8');
30
31
  code.split('\n').forEach(step => {
31
- const trimmedStep = step.trim();
32
- if (trimmedStep.startsWith('Given') || trimmedStep.startsWith('When') || trimmedStep.startsWith('Then') || trimmedStep.startsWith('And') || trimmedStep.startsWith('Step')) {
33
- var sortedSpecInput = extractInputFrmStep(trimmedStep, filePath);
34
- testDataMap.set(extractDescriptionFrmStep(trimmedStep), sortedSpecInput);
32
+ const stepHavingFunctionArgs = step.trim();
33
+ if (stepHavingFunctionArgs.startsWith('Given') || stepHavingFunctionArgs.startsWith('When') || stepHavingFunctionArgs.startsWith('Then') || stepHavingFunctionArgs.startsWith('And') || stepHavingFunctionArgs.startsWith('Step')) {
34
+ var sortedSpecInput = extractInputFrmStep(stepHavingFunctionArgs, filePath);
35
+ testDataMap.set(extractDescriptionFromStepImplementation(stepHavingFunctionArgs), sortedSpecInput);
35
36
  }
36
37
  });
37
38
  }
38
- function extractInputFrmStep(trimmedStep, filePath) {
39
+ function extractInputFrmStep(filterStepArgs, filePath) {
39
40
  var _inputNames$split;
40
- var toRemovePattern = trimmedStep.match(/async\s*\(([^)]*)\)/)[1].match(/{(.*?)}/);
41
- var inputNames = trimmedStep.match(/async\s*\(([^)]*)\)/)[1].replace(toRemovePattern[0], "$null") || [];
41
+ var destructedObjectsAndFixturesInArguments = filterStepArgs.match(/async\s*\(([^)]*)\)/)[1].match(/{(.*?)}/);
42
+ var inputNames = filterStepArgs.match(/async\s*\(([^)]*)\)/)[1].replace(destructedObjectsAndFixturesInArguments[0], '$null') || [];
42
43
  var filteredInputs = (_inputNames$split = inputNames.split(',')) === null || _inputNames$split === void 0 ? void 0 : _inputNames$split.slice(1);
43
44
  if (filteredInputs.length) {
44
45
  filteredInputs = filteredInputs.map(input => `"${input}"`);
45
46
  }
46
47
  try {
47
48
  return {
48
- stepPageFixtureName: trimmedStep.split(' ').slice(1).join('').match(/\((.*?)\)/)[1].match(/\{(.*?)\}/g).pop() || [false].pop(),
49
+ stepPageFixtureName: filterStepArgs.split(' ').slice(1).join('').match(/\((.*?)\)/)[1].match(/\{(.*?)\}/g).pop() || [false].pop(),
49
50
  stepInputKey: filteredInputs
50
51
  };
51
52
  } catch (error) {
@@ -57,12 +58,12 @@ function extractInputFrmStep(trimmedStep, filePath) {
57
58
 
58
59
  // regex seperation
59
60
 
60
- function extractDescriptionFrmStep(trimmedStep) {
61
+ function extractDescriptionFromStepImplementation(stepHavingFunctionArgs) {
61
62
  var refactoredDescription;
62
- if (trimmedStep.match(/\((.*?)\)/g).pop().split('').indexOf(`'`) === 1) {
63
- refactoredDescription = trimmedStep.replace(new RegExp(`'`, 'g'), `;`).match(/;(.*?);/).pop().replace(new RegExp(';', 'g'), ' ').trim();
63
+ if (stepHavingFunctionArgs.match(/\((.*?)\)/g).pop().split('').indexOf(`'`) === 1) {
64
+ refactoredDescription = stepHavingFunctionArgs.replace(new RegExp(`'`, 'g'), `;`).match(/;(.*?);/).pop().replace(new RegExp(';', 'g'), ' ').trim();
64
65
  } else {
65
- refactoredDescription = trimmedStep.replace(new RegExp(`"`, 'g'), `;`).match(/;(.*?);/).pop().replace(new RegExp(';', 'g'), ' ').trim();
66
+ refactoredDescription = stepHavingFunctionArgs.replace(new RegExp(`"`, 'g'), `;`).match(/;(.*?);/).pop().replace(new RegExp(';', 'g'), ' ').trim();
66
67
  }
67
68
  return refactoredDescription;
68
69
  }
@@ -1,21 +1,20 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.createStepArgumentsMap = createStepArgumentsMap;
8
7
  var _acorn = require("acorn");
9
8
  var _fileUtils = require("../../../utils/fileUtils");
10
- var _fastGlob = _interopRequireDefault(require("fast-glob"));
11
- var _pathConfig = require("../../config/pathConfig");
9
+ var _PathProviderOfConfig = require("../../../utils/PathProviderOfConfig");
12
10
  globalThis.testDataMap = new Map();
13
- function createStepArgumentsMap() {
11
+ async function createStepArgumentsMap() {
14
12
  var $promise = [];
15
- _fastGlob.default.globSync((0, _pathConfig.getStepFilePath)(), {
13
+ const stepArgumentMap = await (0, _fileUtils.getFilesFromGivenPattern)((0, _PathProviderOfConfig.getStepFilePath)(), {
16
14
  dot: true,
17
15
  cwd: process.cwd()
18
- }).forEach(filePath => {
16
+ });
17
+ stepArgumentMap.forEach(filePath => {
19
18
  $promise.push(parseNodeAST((0, _fileUtils.readFileContents)(filePath)));
20
19
  });
21
20
  Promise.all($promise);
@@ -59,6 +59,6 @@ function createTestFormat(testCases, relativeFilePath, $tags = ' ', options = nu
59
59
  `;
60
60
  }
61
61
 
62
- /**
63
- * test templete else snippet
62
+ /**
63
+ * test templete else snippet
64
64
  */
@@ -4,22 +4,25 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.avoidDuplicate = avoidDuplicate;
7
- exports.filePathPattern = filePathPattern;
7
+ exports.convertUnixPathToWindowsPath = convertUnixPathToWindowsPath;
8
8
  exports.removeAll = removeAll;
9
- function removeAll(InputString, toRemove, regex = undefined, options = null) {
9
+ var _getFilePath = require("../../utils/getFilePath");
10
+ function removeAll(inputString, patternsToReplace, regex = undefined) {
11
+ var replacedOutputString;
10
12
  if (regex) {
11
- InputString = InputString.replace(regex, '').trim();
13
+ inputString = inputString.replace(regex, '').trim();
12
14
  }
13
- toRemove.forEach(ele => {
14
- InputString = InputString.replace(ele, '').trim();
15
+ patternsToReplace.forEach(ele => {
16
+ inputString = inputString.replace(ele, '').trim();
15
17
  });
16
- return InputString;
18
+ replacedOutputString = inputString;
19
+ return replacedOutputString;
17
20
  }
18
21
  function avoidDuplicate(arrayOfInputs) {
19
22
  return [...new Set(arrayOfInputs)];
20
23
  }
21
- function filePathPattern(filePath, isWindows = true) {
22
- if (isWindows) {
24
+ function convertUnixPathToWindowsPath(filePath) {
25
+ if (_getFilePath.isWindows) {
23
26
  return filePath.split('\\').join('/');
24
27
  }
25
28
  return filePath;
@@ -57,40 +57,40 @@ function combineDefaultConfigWithUserConfig(userConfiguration) {
57
57
  };
58
58
  }
59
59
 
60
- /**
61
- * @typedef {Object|null} viewportConfig
62
- * @property {number} width - width of the viewport
63
- * @property {number} height - height of the viewport
60
+ /**
61
+ * @typedef {Object|null} viewportConfig
62
+ * @property {number} width - width of the viewport
63
+ * @property {number} height - height of the viewport
64
64
  */
65
65
 
66
- /**
67
- * Represents the user configuration object.
68
- * @typedef {Object} UserConfig
69
- * @property {string} headless - Headless Browsers mode.
70
- * @property {number} trace - trace for test cases.
71
- * @property {boolean} video - video for test cases,
72
- * @property {boolean} debug - debug mode
73
- * @property {string} mode: mode in which the test cases needs to run
74
- * @property {boolean} isAuthMode - Auth Mode. config whether authentication step needed before running test cases
75
- * @property {string} authFilePath - File Path where the cookies stored
76
- * @property {any} browsers: List of browsers
77
- * @property {string} openReportOn: default Option value (never, on-failure and always)
78
- * @property {any} reportPath : directory where report is generate
79
- * @property {boolean} bddMode: Feature files needs to be processed
80
- * @property {number} expectTimeout: time in milliseconds which the expect condition should fail
81
- * @property {number} testTimeout: time in milliseconds which the test should fail
82
- * @property {Object} additionalPages: custom pages configuration
83
- * @property {string} featureFilesFolder: folder name under which feature-files will be placed. Default is feature-files
84
- * @property {string} stepDefinitionsFolder: folder name under which step implementations will be placed. Default is steps
85
- * @property {viewportConfig} viewport: viewport configuration for the browser. Default is { width: 1280, height: 720 }
86
- * @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
87
- * @property {Array} editionOrder: Order in the form of larger editions in the back. Edition with the most privelages should be last
66
+ /**
67
+ * Represents the user configuration object.
68
+ * @typedef {Object} UserConfig
69
+ * @property {string} headless - Headless Browsers mode.
70
+ * @property {number} trace - trace for test cases.
71
+ * @property {boolean} video - video for test cases,
72
+ * @property {boolean} debug - debug mode
73
+ * @property {string} mode: mode in which the test cases needs to run
74
+ * @property {boolean} isAuthMode - Auth Mode. config whether authentication step needed before running test cases
75
+ * @property {string} authFilePath - File Path where the cookies stored
76
+ * @property {any} browsers: List of browsers
77
+ * @property {string} openReportOn: default Option value (never, on-failure and always)
78
+ * @property {any} reportPath : directory where report is generate
79
+ * @property {boolean} bddMode: Feature files needs to be processed
80
+ * @property {number} expectTimeout: time in milliseconds which the expect condition should fail
81
+ * @property {number} testTimeout: time in milliseconds which the test should fail
82
+ * @property {Object} additionalPages: custom pages configuration
83
+ * @property {string} featureFilesFolder: folder name under which feature-files will be placed. Default is feature-files
84
+ * @property {string} stepDefinitionsFolder: folder name under which step implementations will be placed. Default is steps
85
+ * @property {viewportConfig} viewport: viewport configuration for the browser. Default is { width: 1280, height: 720 }
86
+ * @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
87
+ * @property {Array} editionOrder: Order in the form of larger editions in the back. Edition with the most privelages should be last
88
88
  */
89
89
 
90
- /**
91
- * Generates a configuration object from a file, if it exists.
92
- *
93
- * @returns {UserConfig}
90
+ /**
91
+ * Generates a configuration object from a file, if it exists.
92
+ *
93
+ * @returns {UserConfig}
94
94
  */
95
95
  function generateConfigFromFile() {
96
96
  const filePath = _path.default.resolve(process.cwd(), fileName);