@zohodesk/testinglibrary 0.1.8-stb-bdd-v12 → 0.1.8-stb-bdd-v14n

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.
@@ -5,6 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createCucumberBDD = createCucumberBDD;
7
7
  var _stepFileGenerate = require("../test/stepGenerate/stepFileGenerate");
8
- async function createCucumberBDD() {
9
- await (0, _stepFileGenerate.generateSpecFiles)();
8
+ /**
9
+ * @function
10
+ * @name createCucumber - start generating Step Files
11
+ */
12
+
13
+ function createCucumberBDD() {
14
+ (0, _stepFileGenerate.generateSpecFiles)();
10
15
  }
@@ -4,41 +4,62 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createNativeBDD = createNativeBDD;
7
+ var _logger = require("../../utils/logger");
7
8
  function $Given(description) {
8
9
  const stepFunction = globalStepMap.get(description);
9
10
  if (stepFunction === undefined) {
10
- process.exit(1);
11
+ _logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Missing Steps Implementation - ${description}`);
12
+ process.exit(0);
11
13
  }
12
14
  return function (pages, ...argument) {
13
- const finalInput = getInputArray(description, argument);
14
- return stepFunction(pages, ...finalInput);
15
+ const stepTestData = getTestData(description, argument);
16
+ return stepFunction(pages, ...stepTestData);
15
17
  };
16
18
  }
17
- function getInputArray(description, argument) {
18
- const specInput = globalTestdata.get(description);
19
- if (specInput.input && specInput.steptable) {
20
- const stepInput = Object.values(specInput.currentArgument).pop() || 'null';
21
- return [stepInput, specInput.dataTableStep];
19
+ function getTestData(description, argument) {
20
+ const stepArguments = globalTestdata.get(description);
21
+ if (stepArguments === undefined) {
22
+ _logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Missing Step - ${description}`);
23
+ process.exit(0);
22
24
  }
23
- if (specInput.input) {
24
- return Object.values(specInput.currentArgument) || [];
25
+
26
+ /** Both Input and Step Table Passed*/
27
+ if (stepArguments.input && stepArguments.steptable) {
28
+ const stepInput = Object.values(stepArguments.currentArgument).pop() || 'null';
29
+ return [stepInput, stepArguments.dataTableStep];
30
+ }
31
+
32
+ /** Input Passed */
33
+ if (stepArguments.input) {
34
+ return Object.values(stepArguments.currentArgument) || [];
25
35
  }
26
- if (specInput.steptable) {
27
- return [specInput.dataTableStep];
36
+
37
+ /** StepTable Passed */
38
+ if (stepArguments.steptable) {
39
+ return getStepTable(stepArguments);
28
40
  }
29
- if (specInput.scenarioTable) {
30
- var exceedParam = specInput.inputParameter[0];
41
+ /** Scenario Table Passed */
42
+
43
+ if (stepArguments.scenarioTable) {
44
+ var exceedParam = stepArguments.inputParameter[0];
31
45
  const extracted = argument.map(element => {
32
46
  return exceedParam[element];
33
47
  });
34
- const duplicate = Object.assign({}, specInput);
35
- const extractInput = duplicate.inputParameter.shift();
36
- duplicate.inputParameter.push(extractInput);
37
- globalTestdata.set(description, Object.assign({}, duplicate));
48
+ const duplicateInput = Object.assign({}, stepArguments);
49
+ const extractInput = duplicateInput.inputParameter.shift();
50
+ duplicateInput.inputParameter.push(extractInput);
51
+ globalTestdata.set(description, Object.assign({}, duplicateInput));
38
52
  return extracted;
39
53
  }
40
54
  return [];
41
55
  }
56
+ function getStepTable(stepInput) {
57
+ return {
58
+ dataTable: () => {
59
+ return [stepInput.dataTableStep];
60
+ }
61
+ };
62
+ }
42
63
  const $When = $Given;
43
64
  const $And = $Given;
44
65
  const $Then = $Given;
@@ -4,11 +4,16 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.stepFileMap = stepFileMap;
7
+ exports.createStepCallBack = createStepCallBack;
8
8
  var _fastGlob = require("fast-glob");
9
9
  var _path = _interopRequireDefault(require("path"));
10
10
  var _pathConfig = require("../config/pathConfig");
11
- async function stepFileMap() {
11
+ /**
12
+ * @function
13
+ * @name stepFileMap - Create a Map of step description as key and callBacks as value
14
+ */
15
+
16
+ async function createStepCallBack() {
12
17
  const actualSpecPattern = (0, _pathConfig.getStepFilePath)();
13
18
  await (0, _fastGlob.globSync)(actualSpecPattern, {
14
19
  dot: true,
@@ -30,6 +30,8 @@ function parseFeature(featureFileContent) {
30
30
  background: []
31
31
  };
32
32
  scenarioSteps.scenariodescription = (_$scenario$scenario = $scenario.scenario) === null || _$scenario$scenario === void 0 ? void 0 : _$scenario$scenario.name;
33
+
34
+ /** If Feature Has Background it will Assign to Scenario Background of Feature */
33
35
  if ($scenario !== null && $scenario !== void 0 && $scenario.background) {
34
36
  isBackgroundExist = $scenario.background.steps.map(element => {
35
37
  return {
@@ -39,12 +41,12 @@ function parseFeature(featureFileContent) {
39
41
  });
40
42
  return;
41
43
  }
42
- (_$scenario$scenario2 = $scenario.scenario) === null || _$scenario$scenario2 === void 0 || _$scenario$scenario2.examples.map(example => {
43
- var _example$tableHeader;
44
- scenarioSteps.tablebody = example === null || example === void 0 ? void 0 : example.tableBody.map(cell => {
45
- return cell === null || cell === void 0 ? void 0 : cell.cells.map(example => example.value);
44
+ (_$scenario$scenario2 = $scenario.scenario) === null || _$scenario$scenario2 === void 0 || _$scenario$scenario2.examples.map($example => {
45
+ var _$example$tableHeader;
46
+ scenarioSteps.tablebody = $example === null || $example === void 0 ? void 0 : $example.tableBody.map(exampleBody => {
47
+ return exampleBody === null || exampleBody === void 0 ? void 0 : exampleBody.cells.map(example => example.value);
46
48
  });
47
- scenarioSteps.tableheader = example === null || example === void 0 || (_example$tableHeader = example.tableHeader) === null || _example$tableHeader === void 0 ? void 0 : _example$tableHeader.cells.map(exampleHead => {
49
+ scenarioSteps.tableheader = $example === null || $example === void 0 || (_$example$tableHeader = $example.tableHeader) === null || _$example$tableHeader === void 0 ? void 0 : _$example$tableHeader.cells.map(exampleHead => {
48
50
  return exampleHead.value;
49
51
  });
50
52
  });
@@ -54,25 +56,25 @@ function parseFeature(featureFileContent) {
54
56
  scenarioSteps.examples = false;
55
57
  }
56
58
  scenarioSteps.scenarioTags = (_$scenario$scenario3 = $scenario.scenario) === null || _$scenario$scenario3 === void 0 ? void 0 : _$scenario$scenario3.tags.map(tag => tag.name);
57
- const _scenarioDescription = $scenario === null || $scenario === void 0 || (_$scenario$scenario4 = $scenario.scenario) === null || _$scenario$scenario4 === void 0 ? void 0 : _$scenario$scenario4.steps.map(step => {
59
+ scenarioSteps.steps = $scenario === null || $scenario === void 0 || (_$scenario$scenario4 = $scenario.scenario) === null || _$scenario$scenario4 === void 0 ? void 0 : _$scenario$scenario4.steps.map(step => {
58
60
  return {
59
61
  stepDescription: step.text,
60
62
  keyword: step.keyword
61
63
  };
62
64
  });
63
- scenarioSteps.steps = _scenarioDescription;
64
65
  scenarioSteps.background = isBackgroundExist || [];
65
66
  currentFeature.scenarios.push(scenarioSteps);
66
67
  });
68
+ /** Background is one of Scenario in Scenario Array. That The First Scenario is Background in Feature*/
67
69
  currentFeature.featureBackGround = currentFeature.scenarios[0].background;
68
70
  return currentFeature;
69
71
  }
70
72
  function testDataExtraction(tableHeader, tableBody) {
71
73
  const result = [];
72
74
  if (tableBody && tableHeader) {
73
- tableBody.forEach(array => {
75
+ tableBody.forEach(tableCells => {
74
76
  const InputObject = {};
75
- array.forEach((item, index) => {
77
+ tableCells.forEach((item, index) => {
76
78
  InputObject[`<${tableHeader[index]}>`] = item;
77
79
  });
78
80
  result.push(InputObject);
@@ -4,13 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.readStepFile = readStepFile;
7
+ 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
11
  var _pathConfig = require("../../config/pathConfig");
12
- globalThis.inputsParamterMap = new Map();
13
- function readStepFile() {
12
+ globalThis.testDataMap = new Map();
13
+ function createStepDataMap() {
14
14
  const stepFilePath = (0, _pathConfig.getStepFilePath)();
15
15
  const processedSpecFile = [];
16
16
  return new Promise(resolve => {
@@ -18,19 +18,19 @@ function readStepFile() {
18
18
  dot: true,
19
19
  cwd: process.cwd()
20
20
  }).forEach(filePath => {
21
- processedSpecFile.push(extractBrowserObjects(filePath));
21
+ processedSpecFile.push(extractPageFixtures(filePath));
22
22
  });
23
23
  Promise.all(processedSpecFile);
24
- resolve(inputsParamterMap);
24
+ resolve(testDataMap);
25
25
  });
26
26
  }
27
- function extractBrowserObjects(filePath) {
27
+ function extractPageFixtures(filePath) {
28
28
  const code = (0, _fileUtils.readFileContents)(_path.default.resolve(process.cwd(), filePath), 'utf-8');
29
29
  code.split('\n').forEach(step => {
30
30
  const trimmedStep = step.trim();
31
31
  if (trimmedStep.startsWith('Given') || trimmedStep.startsWith('When') || trimmedStep.startsWith('Then') || trimmedStep.startsWith('And') || trimmedStep.startsWith('Step')) {
32
32
  var sortedSpecInput = trimmedStep.split(' ').slice(1).join('').match(/\((.*?)\)/)[1].match(/\{(.*?)\}/g) || [];
33
- inputsParamterMap.set(trimmedStep.replace(/"/g, `'`).match(/'(.*?)'/g).pop(), sortedSpecInput.pop());
33
+ testDataMap.set(trimmedStep.replace(/"/g, `'`).match(/'(.*?)'/g).pop(), sortedSpecInput.pop());
34
34
  }
35
35
  });
36
36
  }
@@ -12,17 +12,17 @@ var _testStructure = require("../testStructure");
12
12
  var _fileUtils = require("../../../utils/fileUtils");
13
13
  var _extractTestInputs = require("./extractTestInputs");
14
14
  var _pathConfig = require("../../config/pathConfig");
15
- function stepFileCreation(featureContent, stepFilename, featureFilePath) {
15
+ function stepFileCreation(parsedFeatureContent, stepFilename, featureFilePath) {
16
16
  const stepsFilePath = _path.default.resolve(process.cwd(), 'uat', '.feature-gen', stepFilename);
17
- const stepsSnippets = (0, _testStructure.testSnippet)(featureContent, featureFilePath);
17
+ const stepsSnippets = (0, _testStructure.testSnippet)(parsedFeatureContent, featureFilePath);
18
18
  (0, _fileUtils.writeFileContents)(stepsFilePath, stepsSnippets);
19
19
  }
20
20
  async function generateSpecFiles() {
21
- await (0, _extractTestInputs.readStepFile)();
21
+ await (0, _extractTestInputs.createStepDataMap)();
22
22
  const featureFilePattern = (0, _pathConfig.getFeatureFilePath)();
23
- const generatedFolderPath = _path.default.resolve(process.cwd(), 'uat', '.feature-gen');
24
- if (!(0, _fileUtils.checkIfFileExists)(generatedFolderPath)) {
25
- (0, _fileUtils.createFolderSync)(generatedFolderPath, {
23
+ const featureFileFolderPath = _path.default.resolve(process.cwd(), 'uat', '.feature-gen');
24
+ if (!(0, _fileUtils.checkIfFileExists)(featureFileFolderPath)) {
25
+ (0, _fileUtils.createFolderSync)(featureFileFolderPath, {
26
26
  recursive: true
27
27
  });
28
28
  }
@@ -31,8 +31,8 @@ async function generateSpecFiles() {
31
31
  cwd: process.cwd()
32
32
  }).forEach(filePath => {
33
33
  const featurefilePath = _path.default.resolve(process.cwd(), filePath);
34
- const featureContent = (0, _featureFileParer.parseFeature)((0, _fileUtils.readFileContents)(featurefilePath, 'utf-8'));
34
+ const parsedFeatureContent = (0, _featureFileParer.parseFeature)((0, _fileUtils.readFileContents)(featurefilePath, 'utf-8'));
35
35
  const fileName = _path.default.basename(filePath).replace('.feature', '.spec.js');
36
- stepFileCreation(featureContent, fileName, filePath);
36
+ stepFileCreation(parsedFeatureContent, fileName, filePath);
37
37
  });
38
38
  }
@@ -19,9 +19,9 @@ function stepReportHandle(Steps, Example) {
19
19
  });
20
20
  return [...resultSteps.split(medium)];
21
21
  }
22
- function testStep(keyword, description, browserObject, testData, stepDescription, options) {
22
+ function testStep(keyword, description, pageFixtureUsed_Step, testData, stepDescription, options) {
23
23
  return `await test.step('${keyword.trim()} : ${stepDescription}',async() => {
24
- await $${keyword}('${description}')(${browserObject},${testData})
24
+ await $${keyword}('${description}')(${pageFixtureUsed_Step},${testData})
25
25
  })`;
26
26
  }
27
27
  function testSuite(description, scenariotestBlock, tags, options = null) {
@@ -29,25 +29,25 @@ function testSuite(description, scenariotestBlock, tags, options = null) {
29
29
  ${scenariotestBlock}
30
30
  })`;
31
31
  }
32
- function testCase(steps, examples, description, browserObjects, tags, option) {
32
+ function testCase(steps, examples, description, pageFixtures, tags, option) {
33
33
  if (examples.length >= 1) {
34
34
  const exmapleScenario = examples.map(($ele, index) => {
35
35
  var exampleDescription = Object.values($ele).map(val => {
36
36
  return val.concat('-');
37
37
  });
38
38
  let avoidRepitationDescription = exampleDescription.join('').concat(`Example-${index + 1}`);
39
- return testBlock(avoidRepitationDescription, stepReportHandle(steps, examples[index]), browserObjects);
39
+ return testBlock(avoidRepitationDescription, stepReportHandle(steps, examples[index]), pageFixtures);
40
40
  });
41
41
  return testSuite(description, exmapleScenario.join('\n'), tags);
42
42
  }
43
- return testSuite(`${description}-title`, testBlock(description, steps, browserObjects), tags);
43
+ return testSuite(`${description}-title`, testBlock(description, steps, pageFixtures), tags);
44
44
  }
45
- function testBlock(description, steps, browserObjects) {
46
- return `\ntest("${description}", async({${browserObjects.join(',')}}) => {
45
+ function testBlock(description, steps, pageFixtures) {
46
+ return `\ntest("${description}", async({${pageFixtures.join(',')}}) => {
47
47
  ${steps.join(`\n\t`)}
48
48
  })`;
49
49
  }
50
- function testFile(testCase, relativeFilePath, $tags, backgroundScenario = " ", options = null) {
50
+ function testFile(testCase, relativeFilePath, $tags = " ", options = null) {
51
51
  return ` // ${relativeFilePath}
52
52
  import { test, createNativeBDD } from "${TESTING_LIBRARY}";
53
53
  const {$Given,$When,$Then,$And} = createNativeBDD()
@@ -56,7 +56,6 @@ function testFile(testCase, relativeFilePath, $tags, backgroundScenario = " ", o
56
56
  $tags: ({}, use, testInfo) => use(${JSON.stringify($tags)}
57
57
  [testInfo.titlePath.slice(2).join("|")] || [])
58
58
  })
59
- ${backgroundScenario}
60
59
  ${testCase.join('')}
61
60
  `;
62
61
  }
@@ -41,14 +41,14 @@ function testDataCreation() {
41
41
  (_$scenario$scenario = $scenario.scenario) === null || _$scenario$scenario === void 0 || _$scenario$scenario.steps.forEach(step => {
42
42
  var _step$dataTable;
43
43
  const {
44
- refactoredStep,
44
+ convertedStep,
45
45
  currentArgument
46
- } = (0, _testStructure.extactStepArgs)(step.text);
46
+ } = (0, _testStructure.extractStepArgument)(step.text);
47
47
  if (Object.values(currentArgument).length && !$scenario.scenario.examples.length) {
48
48
  $currentScenario.currentArgument = currentArgument;
49
49
  $currentScenario.input = true;
50
50
  } else {
51
- globalTestdata.set(refactoredStep, {});
51
+ globalTestdata.set(convertedStep, {});
52
52
  }
53
53
  const dataTableStep = [];
54
54
  step === null || step === void 0 || (_step$dataTable = step.dataTable) === null || _step$dataTable === void 0 || _step$dataTable.rows.forEach(cell => {
@@ -59,14 +59,14 @@ function testDataCreation() {
59
59
  $currentScenario.dataTableStep = dataTableStep;
60
60
  $currentScenario.steptable = true;
61
61
  }
62
- globalTestdata.set(refactoredStep, Object.assign({}, $currentScenario));
62
+ globalTestdata.set(convertedStep, Object.assign({}, $currentScenario));
63
63
  });
64
64
  if (typeof $scenario.background === Object) {
65
65
  return;
66
66
  }
67
67
  if ((_$scenario$scenario2 = $scenario.scenario) !== null && _$scenario$scenario2 !== void 0 && (_$scenario$scenario2 = _$scenario$scenario2.examples) !== null && _$scenario$scenario2 !== void 0 && _$scenario$scenario2.length) {
68
68
  var _$scenario$scenario3;
69
- exampleSteps = $scenario.scenario.steps.map(element => (0, _testStructure.extactStepArgs)(element.text).refactoredStep);
69
+ exampleSteps = $scenario.scenario.steps.map(element => (0, _testStructure.extractStepArgument)(element.text).convertedStep);
70
70
  (_$scenario$scenario3 = $scenario.scenario) === null || _$scenario$scenario3 === void 0 || _$scenario$scenario3.examples.map(example => {
71
71
  var _example$tableHeader;
72
72
  body = example === null || example === void 0 ? void 0 : example.tableBody.map(cell => {
@@ -3,36 +3,37 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.extactStepArgs = extactStepArgs;
6
+ exports.extractStepArgument = extractStepArgument;
7
7
  exports.testSnippet = testSnippet;
8
+ var _logger = require("../../utils/logger");
8
9
  var _stringManipulation = require("../utils/stringManipulation");
9
10
  var _stepsnippets = require("./stepGenerate/stepsnippets");
10
- function testSnippet(featureContent, featureFilePath) {
11
+ function testSnippet(parsedFeature, featureFilePath) {
11
12
  var currentScenarios = [];
12
13
  var $tags = {};
13
- featureContent.scenarios.forEach(scenario => {
14
- scenario.scenarioTags = [...scenario.scenarioTags, ...featureContent.featureTags];
15
- $tags = Object.assign($tags, handleInputTags(scenario));
16
- const _constructStep = scenarioSnippet(scenario);
17
- currentScenarios.push(_constructStep);
14
+ parsedFeature.scenarios.forEach(scenario => {
15
+ scenario.scenarioTags = [...scenario.scenarioTags, ...parsedFeature.featureTags];
16
+ $tags = Object.assign($tags, tagHandleFixture(scenario));
17
+ const resultedStep = scenarioSnippet(scenario);
18
+ currentScenarios.push(resultedStep);
18
19
  });
19
20
  return (0, _stepsnippets.testFile)(currentScenarios, featureFilePath, $tags);
20
21
  }
21
- function extactStepArgs(step) {
22
- var inputParam = [];
22
+ function extractStepArgument(step) {
23
+ var testInputs = [];
23
24
  var currentArgument = {};
24
- var refactoredStep = step.replace(/"([^"]+)"/g, (match, word) => {
25
+ var convertedStep = step.replace(/"([^"]+)"/g, (match, word) => {
25
26
  if (!isNaN(Number(word))) {
26
- inputParam.push(word.toString());
27
+ testInputs.push(word.toString());
27
28
  return '{int}';
28
29
  } else {
29
- inputParam.push(word.toString());
30
+ testInputs.push(word.toString());
30
31
  return '{string}';
31
32
  }
32
33
  });
33
- currentArgument = inputParam.map(inputs => `"${(0, _stringManipulation.removeAll)(inputs, ['<', '>'], /\s/g)}"`);
34
+ currentArgument = testInputs.map(inputs => `"${(0, _stringManipulation.removeAll)(inputs, ['<', '>'], /\s/g)}"`);
34
35
  return {
35
- refactoredStep,
36
+ convertedStep,
36
37
  currentArgument
37
38
  };
38
39
  }
@@ -40,43 +41,49 @@ function scenarioSnippet(scenario) {
40
41
  var _scenario$background;
41
42
  var currentStep = [];
42
43
  var currentInputs = [];
43
- // To Add BackGround As Steps :
44
+ /** To Add BackGround As Steps */
44
45
  if ((scenario === null || scenario === void 0 || (_scenario$background = scenario.background) === null || _scenario$background === void 0 ? void 0 : _scenario$background.length) >= 1) {
46
+ /** Destructed Should be Background will first remaining Step behind */
45
47
  scenario.steps = [...scenario.background, ...scenario.steps];
46
48
  }
47
49
  scenario.steps.forEach(step => {
48
50
  var {
49
- refactoredStep,
51
+ convertedStep,
50
52
  currentArgument
51
- } = extactStepArgs(step.stepDescription);
52
- var input = inputsParamterMap.get(`'${refactoredStep}'`);
53
- currentInputs.push(input);
54
- currentStep.push((0, _stepsnippets.testStep)(step.keyword, refactoredStep, input, currentArgument.join(','), step.stepDescription));
53
+ } = extractStepArgument(step.stepDescription);
54
+ var pageFixtureUsed_Step = testDataMap.get(`'${convertedStep}'`) || null;
55
+ /** Step Implementation Check (Walk Through Approach)*/
56
+ if (!pageFixtureUsed_Step) {
57
+ _logger.Logger.log(_logger.Logger.FAILURE_TYPE, `${step.scenariodescription} Not Implemented`);
58
+ process.exit(0);
59
+ }
60
+ currentInputs.push(pageFixtureUsed_Step);
61
+ currentStep.push((0, _stepsnippets.testStep)(step.keyword, convertedStep, pageFixtureUsed_Step, currentArgument.join(','), step.stepDescription));
55
62
  return;
56
63
  });
57
- const pageObject = browserObjectHandle(currentInputs);
58
- return (0, _stepsnippets.testCase)(currentStep, scenario === null || scenario === void 0 ? void 0 : scenario.examples, scenario === null || scenario === void 0 ? void 0 : scenario.scenariodescription, pageObject, scenario.scenarioTags);
64
+ const pageFixtures = pageFixtureFilter(currentInputs);
65
+ return (0, _stepsnippets.testCase)(currentStep, scenario === null || scenario === void 0 ? void 0 : scenario.examples, scenario === null || scenario === void 0 ? void 0 : scenario.scenariodescription, pageFixtures, scenario.scenarioTags);
59
66
  }
60
- function browserObjectHandle(arrayofBrowserObjects) {
61
- var browserInputs = [];
62
- arrayofBrowserObjects.forEach(pageObject => {
63
- browserInputs = [...browserInputs, ...(0, _stringManipulation.removeAll)(pageObject, ['{', '}']).split(',')];
67
+ function pageFixtureFilter(pageFixturesArray) {
68
+ var pageInputs = [];
69
+ pageFixturesArray.forEach(pages => {
70
+ pageInputs = [...pageInputs, ...(0, _stringManipulation.removeAll)(pages, ['{', '}']).split(',')];
64
71
  });
65
- return (0, _stringManipulation.avoidDuplicate)(browserInputs);
72
+ return (0, _stringManipulation.avoidDuplicate)(pageInputs);
66
73
  }
67
- function handleInputTags(scenario) {
74
+ function tagHandleFixture(scenario) {
68
75
  var _scenario$examples;
69
76
  if (((_scenario$examples = scenario.examples) === null || _scenario$examples === void 0 ? void 0 : _scenario$examples.length) >= 1) {
70
- var _tagsObjects = {};
77
+ var tagsObjects = {};
71
78
  scenario.examples.forEach(($ele, index) => {
72
79
  var exampleDescription = Object.values($ele).map(val => {
73
80
  return val.concat('-');
74
81
  });
75
- Object.assign(_tagsObjects, {
82
+ Object.assign(tagsObjects, {
76
83
  [exampleDescription.join('').concat(`Example-${index + 1}`)]: scenario.scenarioTags
77
84
  });
78
85
  });
79
- return _tagsObjects;
86
+ return tagsObjects;
80
87
  }
81
88
  return {
82
89
  [scenario.scenariodescription]: scenario.scenarioTags
@@ -9,7 +9,7 @@ var _test = require("@playwright/test");
9
9
  var _path = _interopRequireDefault(require("path"));
10
10
  var _readConfigFile = require("../readConfigFile");
11
11
  var _configUtils = require("./config-utils");
12
- var _testDataMap = require("../../../bdd-poc/test/testDataMap");
12
+ var _testData = require("../../../bdd-poc/test/testData");
13
13
  var _stepRunner = require("../../../bdd-poc/core-runner/stepRunner");
14
14
  const {
15
15
  browsers,
@@ -52,8 +52,8 @@ const testOptions = (0, _configUtils.getTestUseOptions)({
52
52
  */
53
53
  async function getPlaywrightConfig() {
54
54
  globalThis.globalStepMap = new Map();
55
- (0, _stepRunner.stepFileMap)();
56
- globalThis.globalTestdata = await (0, _testDataMap.testDataCreation)();
55
+ (0, _stepRunner.createStepCallBack)();
56
+ globalThis.globalTestdata = await (0, _testData.testDataCreation)();
57
57
  return {
58
58
  testDir,
59
59
  outputDir: _path.default.join(process.cwd(), 'uat', 'test-results'),
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.1.8-exp-bdd-v4",
3
+ "version": "0.1.8-stb-bdd-v13",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.1.8-stb-bdd-v12",
3
+ "version": "0.1.8-stb-bdd-v14n",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- function HeavyTask() {
4
- return new Promise(resolve => {
5
- setTimeout(() => {
6
- console.log('Intensive Task Done');
7
- resolve('done');
8
- }, 10000);
9
- });
10
- }
11
- async function intensive() {
12
- await HeavyTask();
13
- }
14
- intensive();
15
- console.log('Breaked ............');
@@ -1,12 +0,0 @@
1
- // const { workerData, Worker } = require('worker_threads')
2
-
3
- // new Worker().performance()
4
-
5
- // const featureFiles = fg.globSync(featureFilePattern, { dot: true, cwd: process.cwd() });
6
-
7
- // // Split the files into chunks for parallel processing
8
- // const chunkSize = Math.ceil(featureFiles.length / os.cpus().length);
9
- // const fileChunks = Array.from({ length: os.cpus().length }, (_, index) =>
10
- // featureFiles.slice(index * chunkSize, (index + 1) * chunkSize)
11
- // );
12
- "use strict";