@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.
- package/build/bdd-poc/core-runner/main.js +7 -2
- package/build/bdd-poc/core-runner/stepDefinitions.js +39 -18
- package/build/bdd-poc/core-runner/stepRunner.js +7 -2
- package/build/bdd-poc/test/cucumber/featureFileParer.js +11 -9
- package/build/bdd-poc/test/stepGenerate/extractTestInputs.js +7 -7
- package/build/bdd-poc/test/stepGenerate/stepFileGenerate.js +8 -8
- package/build/bdd-poc/test/stepGenerate/stepsnippets.js +8 -9
- package/build/bdd-poc/test/{testDataMap.js → testData.js} +5 -5
- package/build/bdd-poc/test/testStructure.js +38 -31
- package/build/core/playwright/setup/config-creator.js +3 -3
- package/npm-shrinkwrap.json +1 -1
- package/package.json +1 -1
- package/build/bdd-poc/workers/intense.js +0 -15
- package/build/bdd-poc/workers/workernode.js +0 -12
|
@@ -5,6 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createCucumberBDD = createCucumberBDD;
|
|
7
7
|
var _stepFileGenerate = require("../test/stepGenerate/stepFileGenerate");
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
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
|
|
14
|
-
return stepFunction(pages, ...
|
|
15
|
+
const stepTestData = getTestData(description, argument);
|
|
16
|
+
return stepFunction(pages, ...stepTestData);
|
|
15
17
|
};
|
|
16
18
|
}
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
24
|
-
|
|
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
|
-
|
|
27
|
-
|
|
36
|
+
|
|
37
|
+
/** StepTable Passed */
|
|
38
|
+
if (stepArguments.steptable) {
|
|
39
|
+
return getStepTable(stepArguments);
|
|
28
40
|
}
|
|
29
|
-
|
|
30
|
-
|
|
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
|
|
35
|
-
const extractInput =
|
|
36
|
-
|
|
37
|
-
globalTestdata.set(description, Object.assign({},
|
|
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.
|
|
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
|
-
|
|
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
|
|
44
|
-
scenarioSteps.tablebody = example === null || example === void 0 ? void 0 : example.tableBody.map(
|
|
45
|
-
return
|
|
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 || (
|
|
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
|
-
|
|
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(
|
|
75
|
+
tableBody.forEach(tableCells => {
|
|
74
76
|
const InputObject = {};
|
|
75
|
-
|
|
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.
|
|
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.
|
|
13
|
-
function
|
|
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(
|
|
21
|
+
processedSpecFile.push(extractPageFixtures(filePath));
|
|
22
22
|
});
|
|
23
23
|
Promise.all(processedSpecFile);
|
|
24
|
-
resolve(
|
|
24
|
+
resolve(testDataMap);
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
function
|
|
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
|
-
|
|
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(
|
|
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)(
|
|
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.
|
|
21
|
+
await (0, _extractTestInputs.createStepDataMap)();
|
|
22
22
|
const featureFilePattern = (0, _pathConfig.getFeatureFilePath)();
|
|
23
|
-
const
|
|
24
|
-
if (!(0, _fileUtils.checkIfFileExists)(
|
|
25
|
-
(0, _fileUtils.createFolderSync)(
|
|
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
|
|
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(
|
|
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,
|
|
22
|
+
function testStep(keyword, description, pageFixtureUsed_Step, testData, stepDescription, options) {
|
|
23
23
|
return `await test.step('${keyword.trim()} : ${stepDescription}',async() => {
|
|
24
|
-
await $${keyword}('${description}')(${
|
|
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,
|
|
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]),
|
|
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,
|
|
43
|
+
return testSuite(`${description}-title`, testBlock(description, steps, pageFixtures), tags);
|
|
44
44
|
}
|
|
45
|
-
function testBlock(description, steps,
|
|
46
|
-
return `\ntest("${description}", async({${
|
|
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
|
|
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
|
-
|
|
44
|
+
convertedStep,
|
|
45
45
|
currentArgument
|
|
46
|
-
} = (0, _testStructure.
|
|
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(
|
|
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(
|
|
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.
|
|
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.
|
|
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(
|
|
11
|
+
function testSnippet(parsedFeature, featureFilePath) {
|
|
11
12
|
var currentScenarios = [];
|
|
12
13
|
var $tags = {};
|
|
13
|
-
|
|
14
|
-
scenario.scenarioTags = [...scenario.scenarioTags, ...
|
|
15
|
-
$tags = Object.assign($tags,
|
|
16
|
-
const
|
|
17
|
-
currentScenarios.push(
|
|
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
|
|
22
|
-
var
|
|
22
|
+
function extractStepArgument(step) {
|
|
23
|
+
var testInputs = [];
|
|
23
24
|
var currentArgument = {};
|
|
24
|
-
var
|
|
25
|
+
var convertedStep = step.replace(/"([^"]+)"/g, (match, word) => {
|
|
25
26
|
if (!isNaN(Number(word))) {
|
|
26
|
-
|
|
27
|
+
testInputs.push(word.toString());
|
|
27
28
|
return '{int}';
|
|
28
29
|
} else {
|
|
29
|
-
|
|
30
|
+
testInputs.push(word.toString());
|
|
30
31
|
return '{string}';
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
|
-
currentArgument =
|
|
34
|
+
currentArgument = testInputs.map(inputs => `"${(0, _stringManipulation.removeAll)(inputs, ['<', '>'], /\s/g)}"`);
|
|
34
35
|
return {
|
|
35
|
-
|
|
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
|
-
|
|
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
|
-
|
|
51
|
+
convertedStep,
|
|
50
52
|
currentArgument
|
|
51
|
-
} =
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
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
|
|
58
|
-
return (0, _stepsnippets.testCase)(currentStep, scenario === null || scenario === void 0 ? void 0 : scenario.examples, scenario === null || scenario === void 0 ? void 0 : scenario.scenariodescription,
|
|
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
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
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)(
|
|
72
|
+
return (0, _stringManipulation.avoidDuplicate)(pageInputs);
|
|
66
73
|
}
|
|
67
|
-
function
|
|
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
|
|
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(
|
|
82
|
+
Object.assign(tagsObjects, {
|
|
76
83
|
[exampleDescription.join('').concat(`Example-${index + 1}`)]: scenario.scenarioTags
|
|
77
84
|
});
|
|
78
85
|
});
|
|
79
|
-
return
|
|
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
|
|
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.
|
|
56
|
-
globalThis.globalTestdata = await (0,
|
|
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'),
|
package/npm-shrinkwrap.json
CHANGED
package/package.json
CHANGED
|
@@ -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";
|