@zohodesk/testinglibrary 0.1.8-bdd-30 → 0.1.8-bdd-26.1
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/config/pathConfig.js +3 -7
- package/build/bdd-poc/core-runner/exportMethods.js +7 -9
- package/build/bdd-poc/core-runner/main.js +5 -11
- package/build/bdd-poc/core-runner/stepDefinitions.js +157 -0
- package/build/bdd-poc/core-runner/stepRunner.js +16 -89
- package/build/bdd-poc/errors/throwError.js +1 -4
- package/build/bdd-poc/index.js +5 -5
- package/build/bdd-poc/{gherkin-parser/cucumber/cucumberSynatxParser.js → test/cucumber/featureFileParer.js} +4 -5
- package/build/bdd-poc/{gherkin-parser/stepsDefinition → test/stepGenerate}/extractTestInputs.js +0 -3
- package/build/bdd-poc/{gherkin-parser/stepsDefinition/parserStepsArguments.js → test/stepGenerate/parserSteps.js} +21 -19
- package/build/bdd-poc/{gherkin-parser/createTestTemplate.js → test/stepGenerate/stepFileGenerate.js} +15 -15
- package/build/bdd-poc/{snippets → test/stepGenerate}/stepsnippets.js +12 -15
- package/build/bdd-poc/{gherkin-parser/cucumber/data-driven/dataSourceMap.js → test/testData.js} +26 -12
- package/build/bdd-poc/{gherkin-parser/stepsDefinition/generateStep.js → test/testStructure.js} +10 -10
- package/build/core/playwright/setup/config-creator.js +6 -13
- package/build/core/playwright/test-runner.js +1 -3
- package/build/index.d.ts +0 -1
- package/build/index.js +4 -6
- package/package.json +1 -1
- package/playwright.config.js +1 -1
- package/build/bdd-poc/core-runner/createCallbacksMap.js +0 -26
- package/build/bdd-poc/core-runner/intialize.js +0 -15
- /package/build/bdd-poc/{gherkin-parser/cucumber/cucumber.js → test/cucumber/parserCucumber.js} +0 -0
- /package/build/bdd-poc/{gherkin-parser → test}/tagsHandle.js +0 -0
|
@@ -15,12 +15,8 @@ const {
|
|
|
15
15
|
stepDefinitionsFolder
|
|
16
16
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
17
17
|
function getFeatureFilePath() {
|
|
18
|
-
return (0, _stringManipulation.filePathPattern)(_path.default.resolve(process.cwd(), 'uat', 'modules', '**', featureFilesFolder
|
|
18
|
+
return (0, _stringManipulation.filePathPattern)(_path.default.resolve(process.cwd(), 'uat', 'modules', '**', '**', featureFilesFolder, '**', '**', '**', '**', '**', '*.feature'), _getFilePath.isWindows);
|
|
19
19
|
}
|
|
20
20
|
function getStepFilePath() {
|
|
21
|
-
return (0, _stringManipulation.filePathPattern)(_path.default.resolve(process.cwd(), 'uat', 'modules', '**', stepDefinitionsFolder
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* loosly coupled and repo context
|
|
26
|
-
*/
|
|
21
|
+
return (0, _stringManipulation.filePathPattern)(_path.default.resolve(process.cwd(), 'uat', 'modules', '**', '**', stepDefinitionsFolder, '**', '**', '**', '**', '**', '*.spec.js'), _getFilePath.isWindows);
|
|
22
|
+
}
|
|
@@ -4,21 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createBdd = createBdd;
|
|
7
|
-
|
|
7
|
+
function Given(description, callback) {
|
|
8
8
|
globalStepMap.set(description, callback);
|
|
9
|
-
}
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const But = Step;
|
|
9
|
+
}
|
|
10
|
+
const Then = Given;
|
|
11
|
+
const When = Given;
|
|
12
|
+
const And = Given;
|
|
13
|
+
const Step = Given;
|
|
15
14
|
function createBdd() {
|
|
16
15
|
return {
|
|
17
16
|
Given,
|
|
18
17
|
When,
|
|
19
18
|
Then,
|
|
20
19
|
And,
|
|
21
|
-
Step
|
|
22
|
-
But
|
|
20
|
+
Step
|
|
23
21
|
};
|
|
24
22
|
}
|
|
@@ -3,19 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var
|
|
6
|
+
exports.createCucumberBDD = createCucumberBDD;
|
|
7
|
+
var _stepFileGenerate = require("../test/stepGenerate/stepFileGenerate");
|
|
8
8
|
/**
|
|
9
9
|
* @function
|
|
10
10
|
* @name createCucumber - start generating Step Files
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
function
|
|
14
|
-
(0,
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* feature relates - gherkin
|
|
19
|
-
* steps related - gherkin step
|
|
20
|
-
* developer written - step file
|
|
21
|
-
*/
|
|
13
|
+
function createCucumberBDD() {
|
|
14
|
+
(0, _stepFileGenerate.generateSpecFiles)();
|
|
15
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createNativeBDD = createNativeBDD;
|
|
7
|
+
var _logger = require("../../utils/logger");
|
|
8
|
+
function $Given(description) {
|
|
9
|
+
const stepFunction = globalStepMap.get(description);
|
|
10
|
+
if (stepFunction === undefined) {
|
|
11
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Missing Steps Implementation - ${description}`);
|
|
12
|
+
process.exit(0);
|
|
13
|
+
}
|
|
14
|
+
return function (pages, ...argument) {
|
|
15
|
+
const stepTestData = getTestData(description, argument);
|
|
16
|
+
return stepFunction(pages, ...stepTestData);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
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);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Both Input and Step Table Passed*/
|
|
27
|
+
if (stepArguments.input && stepArguments.steptable) {
|
|
28
|
+
const stepInput = Object.values(stepArguments.currentArgument) || [null];
|
|
29
|
+
return [...stepInput, stepArguments.dataTableStep];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Input Passed */
|
|
33
|
+
if (stepArguments.input) {
|
|
34
|
+
return Object.values(stepArguments.currentArgument) || [];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** StepTable Passed */
|
|
38
|
+
if (stepArguments.steptable) {
|
|
39
|
+
return [stepArguments.dataTableStep];
|
|
40
|
+
}
|
|
41
|
+
/** Scenario Table Passed */
|
|
42
|
+
|
|
43
|
+
if (stepArguments.scenarioTable) {
|
|
44
|
+
var exceedParam = stepArguments.inputParameter[0];
|
|
45
|
+
const extracted = argument.map(element => {
|
|
46
|
+
return exceedParam[element.trim()];
|
|
47
|
+
});
|
|
48
|
+
const duplicateInput = Object.assign({}, stepArguments);
|
|
49
|
+
const extractInput = duplicateInput.inputParameter.shift();
|
|
50
|
+
duplicateInput.inputParameter.push(extractInput);
|
|
51
|
+
globalTestdata.set(description, Object.assign({}, duplicateInput));
|
|
52
|
+
return extracted;
|
|
53
|
+
}
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// function getStepTable(stepInput){
|
|
58
|
+
// return {
|
|
59
|
+
// dataTable:() => {
|
|
60
|
+
// return stepInput.dataTableStep;
|
|
61
|
+
// }
|
|
62
|
+
// }
|
|
63
|
+
// }
|
|
64
|
+
|
|
65
|
+
const $When = $Given;
|
|
66
|
+
const $And = $Given;
|
|
67
|
+
const $Then = $Given;
|
|
68
|
+
const $Step = $Given;
|
|
69
|
+
function createNativeBDD() {
|
|
70
|
+
return {
|
|
71
|
+
$Given,
|
|
72
|
+
$When,
|
|
73
|
+
$And,
|
|
74
|
+
$Then,
|
|
75
|
+
$Step
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// "use strict";
|
|
80
|
+
|
|
81
|
+
// Object.defineProperty(exports, "__esModule", {
|
|
82
|
+
// value: true
|
|
83
|
+
// });
|
|
84
|
+
// exports.createNativeBDD = createNativeBDD;
|
|
85
|
+
// var _logger = require("../../utils/logger");
|
|
86
|
+
// function $Given(description) {
|
|
87
|
+
// const stepFunction = globalStepMap.get(description);
|
|
88
|
+
// if (stepFunction === undefined) {
|
|
89
|
+
// _logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Missing Steps Implementation - ${description}`);
|
|
90
|
+
// process.exit(0);
|
|
91
|
+
// }
|
|
92
|
+
// return function (pages, ...argument) {
|
|
93
|
+
// const stepTestData = getTestData(description, argument);
|
|
94
|
+
// return stepFunction(pages, ...stepTestData);
|
|
95
|
+
// };
|
|
96
|
+
// }
|
|
97
|
+
// function getTestData(description, argument) {
|
|
98
|
+
// console.log(globalTestdata.get(description))
|
|
99
|
+
// const stepArguments = globalTestdata.get(description);
|
|
100
|
+
// if (stepArguments === undefined) {
|
|
101
|
+
// _logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Missing Step - ${description}`);
|
|
102
|
+
// process.exit(0);
|
|
103
|
+
// }
|
|
104
|
+
|
|
105
|
+
// /** Both Input and Step Table Passed*/
|
|
106
|
+
// if (stepArguments.input && stepArguments.steptable) {
|
|
107
|
+
// const stepInput = Object.values(stepArguments.currentArgument) || [null];
|
|
108
|
+
// return [...stepInput, getStepTable(stepArguments.dataTableStep)];
|
|
109
|
+
// }
|
|
110
|
+
|
|
111
|
+
// /** Input Passed */
|
|
112
|
+
// if (stepArguments.input) {
|
|
113
|
+
// return Object.values(stepArguments.currentArgument) || [];
|
|
114
|
+
// }
|
|
115
|
+
|
|
116
|
+
// /** StepTable Passed */
|
|
117
|
+
// if (stepArguments.steptable) {
|
|
118
|
+
// return [getStepTable(stepArguments)];
|
|
119
|
+
// }
|
|
120
|
+
// /** Scenario Table Passed */
|
|
121
|
+
|
|
122
|
+
// if (stepArguments.scenarioTable) {
|
|
123
|
+
// // console.log('Enter Into Scenario....')
|
|
124
|
+
// // console.log('aaaaaaaaaaaaaaaaa',argument)
|
|
125
|
+
// var exceedParam = stepArguments.inputParameter[0];
|
|
126
|
+
// const extracted = argument.map(element => {
|
|
127
|
+
// return exceedParam[element.trim()];
|
|
128
|
+
// });
|
|
129
|
+
// console.log('$$$$$$$$$$',extracted)
|
|
130
|
+
// const duplicateInput = Object.assign({}, stepArguments);
|
|
131
|
+
// const extractInput = duplicateInput.inputParameter.shift();
|
|
132
|
+
// duplicateInput.inputParameter.push(extractInput);
|
|
133
|
+
// globalTestdata.set(description, Object.assign({}, duplicateInput));
|
|
134
|
+
// return extracted;
|
|
135
|
+
// }
|
|
136
|
+
// return [];
|
|
137
|
+
// }
|
|
138
|
+
// function getStepTable(stepInput) {
|
|
139
|
+
// return {
|
|
140
|
+
// dataTable: () => {
|
|
141
|
+
// return [stepInput.dataTableStep];
|
|
142
|
+
// }
|
|
143
|
+
// };
|
|
144
|
+
// }
|
|
145
|
+
// const $When = $Given;
|
|
146
|
+
// const $And = $Given;
|
|
147
|
+
// const $Then = $Given;
|
|
148
|
+
// const $Step = $Given;
|
|
149
|
+
// function createNativeBDD() {
|
|
150
|
+
// return {
|
|
151
|
+
// $Given,
|
|
152
|
+
// $When,
|
|
153
|
+
// $And,
|
|
154
|
+
// $Then,
|
|
155
|
+
// $Step
|
|
156
|
+
// };
|
|
157
|
+
// }
|
|
@@ -1,98 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (stepFunction === undefined) {
|
|
11
|
-
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Missing Steps Implementation - ${description}`);
|
|
12
|
-
process.exit(0);
|
|
13
|
-
}
|
|
14
|
-
return function (pages, ...argument) {
|
|
15
|
-
const stepTestData = filterTestData(description, argument);
|
|
16
|
-
return stepFunction(pages, ...stepTestData);
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
function filterTestData(description, argument) {
|
|
20
|
-
const stepArguments = globalTestDataMap.get(description);
|
|
21
|
-
if (stepArguments === undefined) {
|
|
22
|
-
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Missing Step - ${description}`);
|
|
23
|
-
process.exit(0);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** Both Input and Step Table Passed*/
|
|
27
|
-
if (stepArguments.input && stepArguments.steptable) {
|
|
28
|
-
const stepInput = getInputs(stepArguments);
|
|
29
|
-
return [...stepInput, getStepTable(stepArguments)];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** Input Passed */
|
|
33
|
-
if (stepArguments.input) {
|
|
34
|
-
return getInputs(stepArguments);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** StepTable Passed */
|
|
38
|
-
if (stepArguments.steptable) {
|
|
39
|
-
return getStepTable(stepArguments);
|
|
40
|
-
}
|
|
41
|
-
/** Scenario Table Passed */
|
|
42
|
-
|
|
43
|
-
if (stepArguments.scenarioTable) {
|
|
44
|
-
return getScenarioTable(stepArguments, description, argument);
|
|
45
|
-
// var exceedParam = stepArguments.inputParameter[0];
|
|
46
|
-
// const extracted = argument.map(element => {
|
|
47
|
-
// return exceedParam[element.trim()];
|
|
48
|
-
// });
|
|
49
|
-
|
|
50
|
-
// const duplicateInput = Object.assign({}, stepArguments);
|
|
51
|
-
// const extractInput = duplicateInput.inputParameter.shift();
|
|
52
|
-
// duplicateInput.inputParameter.push(extractInput);
|
|
53
|
-
// globalTestDataMap.set(description, Object.assign({}, duplicateInput));
|
|
54
|
-
// return extracted;
|
|
55
|
-
}
|
|
56
|
-
return [];
|
|
57
|
-
}
|
|
58
|
-
function getInputs(stepArguments) {
|
|
59
|
-
return Object.values(stepArguments.currentArgument) || [null];
|
|
60
|
-
}
|
|
61
|
-
function getStepTable(stepArguments) {
|
|
62
|
-
const dataTable = {
|
|
63
|
-
raw: () => {
|
|
64
|
-
return stepArguments.dataTableStep || [];
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
return [dataTable];
|
|
68
|
-
}
|
|
69
|
-
function getScenarioTable(stepArguments, description, argument) {
|
|
70
|
-
var exceedParam = stepArguments.inputParameter[0];
|
|
71
|
-
const extracted = argument.map(element => {
|
|
72
|
-
return exceedParam[element.trim()];
|
|
73
|
-
});
|
|
74
|
-
const duplicateInput = Object.assign({}, stepArguments);
|
|
75
|
-
const extractInput = duplicateInput.inputParameter.shift();
|
|
76
|
-
duplicateInput.inputParameter.push(extractInput);
|
|
77
|
-
globalTestDataMap.set(description, Object.assign({}, duplicateInput));
|
|
78
|
-
return extracted;
|
|
79
|
-
}
|
|
7
|
+
exports.createStepCallBack = createStepCallBack;
|
|
8
|
+
var _fastGlob = require("fast-glob");
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
var _pathConfig = require("../config/pathConfig");
|
|
80
11
|
/**
|
|
81
|
-
*
|
|
12
|
+
* @function
|
|
13
|
+
* @name stepFileMap - Create a Map of step description as key and callBacks as value
|
|
82
14
|
*/
|
|
83
15
|
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
$And,
|
|
94
|
-
$Then,
|
|
95
|
-
$Step,
|
|
96
|
-
$But
|
|
97
|
-
};
|
|
16
|
+
async function createStepCallBack() {
|
|
17
|
+
const actualSpecPattern = (0, _pathConfig.getStepFilePath)();
|
|
18
|
+
await (0, _fastGlob.globSync)(actualSpecPattern, {
|
|
19
|
+
dot: true,
|
|
20
|
+
cwd: process.cwd()
|
|
21
|
+
}).forEach(FilePath => {
|
|
22
|
+
const specFilePath = _path.default.resolve(process.cwd(), FilePath);
|
|
23
|
+
require(specFilePath);
|
|
24
|
+
});
|
|
98
25
|
}
|
package/build/bdd-poc/index.js
CHANGED
|
@@ -9,18 +9,18 @@ Object.defineProperty(exports, "createBdd", {
|
|
|
9
9
|
return _exportMethods.createBdd;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "createCucumberBDD", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _main.createCucumberBDD;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
18
|
+
Object.defineProperty(exports, "createNativeBDD", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function () {
|
|
21
|
-
return
|
|
21
|
+
return _stepDefinitions.createNativeBDD;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
var _exportMethods = require("./core-runner/exportMethods");
|
|
25
|
-
var
|
|
25
|
+
var _stepDefinitions = require("./core-runner/stepDefinitions");
|
|
26
26
|
var _main = require("./core-runner/main");
|
|
@@ -5,11 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.parseFeature = parseFeature;
|
|
8
|
-
|
|
9
|
-
var _cucumber = _interopRequireDefault(require("./cucumber"));
|
|
8
|
+
var _parserCucumber = _interopRequireDefault(require("./parserCucumber"));
|
|
10
9
|
function parseFeature(featureFileContent) {
|
|
11
10
|
var _gherkinDocument$feat;
|
|
12
|
-
var gherkinDocument = (0,
|
|
11
|
+
var gherkinDocument = (0, _parserCucumber.default)(featureFileContent);
|
|
13
12
|
var currentFeature = {
|
|
14
13
|
feature: "",
|
|
15
14
|
featureTags: [],
|
|
@@ -22,7 +21,7 @@ function parseFeature(featureFileContent) {
|
|
|
22
21
|
gherkinDocument.feature.children.forEach($scenario => {
|
|
23
22
|
var _$scenario$scenario, _$scenario$scenario2, _$scenario$scenario3, _$scenario$scenario4;
|
|
24
23
|
var scenarioSteps = {
|
|
25
|
-
|
|
24
|
+
scenariodescription: "",
|
|
26
25
|
steps: [],
|
|
27
26
|
tablebody: false,
|
|
28
27
|
tableheader: false,
|
|
@@ -30,7 +29,7 @@ function parseFeature(featureFileContent) {
|
|
|
30
29
|
scenarioTags: [],
|
|
31
30
|
background: []
|
|
32
31
|
};
|
|
33
|
-
scenarioSteps.
|
|
32
|
+
scenarioSteps.scenariodescription = (_$scenario$scenario = $scenario.scenario) === null || _$scenario$scenario === void 0 ? void 0 : _$scenario$scenario.name;
|
|
34
33
|
|
|
35
34
|
/** If Feature Has Background it will Assign to Scenario Background of Feature */
|
|
36
35
|
if ($scenario !== null && $scenario !== void 0 && $scenario.background) {
|
package/build/bdd-poc/{gherkin-parser/stepsDefinition → test/stepGenerate}/extractTestInputs.js
RENAMED
|
@@ -54,9 +54,6 @@ function extractInputFrmStep(trimmedStep, filePath) {
|
|
|
54
54
|
process.exit(0);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
// regex seperation
|
|
59
|
-
|
|
60
57
|
function extractDescriptionFrmStep(trimmedStep) {
|
|
61
58
|
var refactoredDescription;
|
|
62
59
|
if (trimmedStep.match(/\((.*?)\)/g).pop().split('').indexOf(`'`) === 1) {
|
|
@@ -4,31 +4,21 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.traverseASTstep = traverseASTstep;
|
|
8
8
|
var _acorn = require("acorn");
|
|
9
9
|
var _fileUtils = require("../../../utils/fileUtils");
|
|
10
10
|
var _fastGlob = _interopRequireDefault(require("fast-glob"));
|
|
11
11
|
var _pathConfig = require("../../config/pathConfig");
|
|
12
12
|
globalThis.testDataMap = new Map();
|
|
13
|
-
function createStepArgumentsMap() {
|
|
14
|
-
var $promise = [];
|
|
15
|
-
_fastGlob.default.globSync((0, _pathConfig.getStepFilePath)(), {
|
|
16
|
-
dot: true,
|
|
17
|
-
cwd: process.cwd()
|
|
18
|
-
}).forEach(filePath => {
|
|
19
|
-
$promise.push(parseNodeAST((0, _fileUtils.readFileContents)(filePath)));
|
|
20
|
-
});
|
|
21
|
-
Promise.all($promise);
|
|
22
|
-
}
|
|
23
13
|
async function extractFixtureFrmNode(node) {
|
|
24
14
|
var stepText;
|
|
25
15
|
return await new Promise(resolve => {
|
|
26
|
-
if ((node === null || node === void 0 ? void 0 : node.type) == 'ExpressionStatement' || (node === null || node === void 0 ? void 0 : node.type) == 'ArrowFunctionExpression') {
|
|
16
|
+
if ((node === null || node === void 0 ? void 0 : node.type) == 'ExpressionStatement' || (node === null || node === void 0 ? void 0 : node.type) == 'CallExpression' || (node === null || node === void 0 ? void 0 : node.type) == 'ArrowFunctionExpression') {
|
|
27
17
|
extractFixtureFrmNode(node.expression);
|
|
28
18
|
}
|
|
29
19
|
if ((node === null || node === void 0 ? void 0 : node.type) == 'CallExpression') {
|
|
30
20
|
if (node.arguments[0].type == 'Literal') {
|
|
31
|
-
stepText = node.arguments[0].
|
|
21
|
+
stepText = node.arguments[0].raw;
|
|
32
22
|
}
|
|
33
23
|
if (node.arguments[1].type == 'ArrowFunctionExpression') {
|
|
34
24
|
let callbackInputs = [];
|
|
@@ -36,6 +26,9 @@ async function extractFixtureFrmNode(node) {
|
|
|
36
26
|
node.arguments[1].params.forEach(input => {
|
|
37
27
|
if (input.type == 'ObjectPattern') {
|
|
38
28
|
fixtures = getPageFixture(input.properties);
|
|
29
|
+
if (fixtures.includes('page')) {
|
|
30
|
+
fixtures.push('page');
|
|
31
|
+
}
|
|
39
32
|
}
|
|
40
33
|
if (input.type == 'Identifier') {
|
|
41
34
|
callbackInputs.push(input.name);
|
|
@@ -51,20 +44,29 @@ async function extractFixtureFrmNode(node) {
|
|
|
51
44
|
});
|
|
52
45
|
}
|
|
53
46
|
function combineAllFixture(fixturesArray) {
|
|
47
|
+
if (!fixturesArray.includes('page')) {
|
|
48
|
+
fixturesArray.push('page');
|
|
49
|
+
}
|
|
54
50
|
if (fixturesArray.length === 1) {
|
|
55
51
|
return `{${fixturesArray}}`;
|
|
56
52
|
}
|
|
57
53
|
const lastFixture = fixturesArray.pop();
|
|
58
54
|
const allFixture = fixturesArray.join(',');
|
|
59
|
-
if (fixturesArray.length === 1) {
|
|
60
|
-
return `{${allFixture},${lastFixture}}`;
|
|
61
|
-
}
|
|
62
55
|
return `{${allFixture}${lastFixture}}`;
|
|
63
56
|
}
|
|
64
|
-
function
|
|
57
|
+
function traverseASTstep() {
|
|
58
|
+
var $promise = [];
|
|
59
|
+
_fastGlob.default.globSync((0, _pathConfig.getStepFilePath)(), {
|
|
60
|
+
dot: true,
|
|
61
|
+
cwd: process.cwd()
|
|
62
|
+
}).forEach(filePath => {
|
|
63
|
+
$promise.push(nodeAST((0, _fileUtils.readFileContents)(filePath)));
|
|
64
|
+
});
|
|
65
|
+
Promise.all($promise);
|
|
66
|
+
}
|
|
67
|
+
function nodeAST(stepContent) {
|
|
65
68
|
const options = {
|
|
66
|
-
ecmaVersion: 2020
|
|
67
|
-
sourceType: 'module'
|
|
69
|
+
ecmaVersion: 2020
|
|
68
70
|
};
|
|
69
71
|
const $node = (0, _acorn.parse)(stepContent, options).body;
|
|
70
72
|
$node.forEach(node => {
|
package/build/bdd-poc/{gherkin-parser/createTestTemplate.js → test/stepGenerate/stepFileGenerate.js}
RENAMED
|
@@ -4,18 +4,23 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.generateSpecFiles = generateSpecFiles;
|
|
8
8
|
var _fastGlob = _interopRequireDefault(require("fast-glob"));
|
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var _fileUtils = require("
|
|
13
|
-
var _pathConfig = require("
|
|
14
|
-
var
|
|
10
|
+
var _featureFileParer = require("../cucumber/featureFileParer");
|
|
11
|
+
var _testStructure = require("../testStructure");
|
|
12
|
+
var _fileUtils = require("../../../utils/fileUtils");
|
|
13
|
+
var _pathConfig = require("../../config/pathConfig");
|
|
14
|
+
var _parserSteps = require("./parserSteps");
|
|
15
15
|
// import { createStepDataMap } from './extractTestInputs';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
function stepFileCreation(parsedFeatureContent, stepFilename, featureFilePath) {
|
|
18
|
+
const stepsFilePath = _path.default.resolve(process.cwd(), 'uat', '.feature-gen', stepFilename);
|
|
19
|
+
const stepsSnippets = (0, _testStructure.testSnippet)(parsedFeatureContent, featureFilePath);
|
|
20
|
+
(0, _fileUtils.writeFileContents)(stepsFilePath, stepsSnippets);
|
|
21
|
+
}
|
|
22
|
+
async function generateSpecFiles() {
|
|
23
|
+
await (0, _parserSteps.traverseASTstep)();
|
|
19
24
|
const featureFilePattern = (0, _pathConfig.getFeatureFilePath)();
|
|
20
25
|
const featureFileFolderPath = _path.default.resolve(process.cwd(), 'uat', '.feature-gen');
|
|
21
26
|
if (!(0, _fileUtils.checkIfFileExists)(featureFileFolderPath)) {
|
|
@@ -28,13 +33,8 @@ async function gherkinParser() {
|
|
|
28
33
|
cwd: process.cwd()
|
|
29
34
|
}).forEach(filePath => {
|
|
30
35
|
const featurefilePath = _path.default.resolve(process.cwd(), filePath);
|
|
31
|
-
const parsedFeatureContent = (0,
|
|
36
|
+
const parsedFeatureContent = (0, _featureFileParer.parseFeature)((0, _fileUtils.readFileContents)(featurefilePath, 'utf-8'));
|
|
32
37
|
const fileName = _path.default.basename(filePath).replace('.feature', '.spec.js');
|
|
33
|
-
|
|
38
|
+
stepFileCreation(parsedFeatureContent, fileName, filePath);
|
|
34
39
|
});
|
|
35
|
-
}
|
|
36
|
-
function generateStepFiles(parsedFeatureContent, stepFilename, featureFilePath) {
|
|
37
|
-
const stepsFilePath = _path.default.resolve(process.cwd(), 'uat', '.feature-gen', stepFilename);
|
|
38
|
-
const testSnippet = (0, _generateStep.createTestSnippet)(parsedFeatureContent, featureFilePath);
|
|
39
|
-
(0, _fileUtils.writeFileContents)(stepsFilePath, testSnippet);
|
|
40
40
|
}
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
6
|
+
exports.testCase = testCase;
|
|
7
|
+
exports.testFile = testFile;
|
|
8
|
+
exports.testStep = testStep;
|
|
9
|
+
exports.testSuite = testSuite;
|
|
9
10
|
const TESTING_LIBRARY = '@zohodesk/testinglibrary';
|
|
10
11
|
function stepReportHandle(Steps, Example) {
|
|
11
12
|
var _steps = [...Steps];
|
|
@@ -18,21 +19,21 @@ function stepReportHandle(Steps, Example) {
|
|
|
18
19
|
});
|
|
19
20
|
return [...resultSteps.split(medium)];
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
return `await test.step('${keyword.trim()}:${stepDescription.replace(new RegExp(`'`, 'g'),
|
|
22
|
+
function testStep(keyword, description, pageFixtureUsed_Step, testData, stepDescription, options) {
|
|
23
|
+
return `await test.step('${keyword.trim()}:${stepDescription.replace(new RegExp(`'`, 'g'), " ")}',async() => {
|
|
23
24
|
await $${keyword}("${description}")(${pageFixtureUsed_Step},${testData})
|
|
24
25
|
})`;
|
|
25
26
|
}
|
|
26
27
|
function testSuite(description, scenariotestBlock, tags, options = null) {
|
|
27
|
-
return `\ntest.describe("${description.replace(new RegExp('"', 'g'), '')}${tags.join(
|
|
28
|
+
return `\ntest.describe("${description.replace(new RegExp('"', 'g'), '')}${tags.join(" ")}", () => {
|
|
28
29
|
${scenariotestBlock}
|
|
29
30
|
})`;
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function testCase(steps, examples, description, pageFixtures, tags, option) {
|
|
32
33
|
if (examples.length >= 1) {
|
|
33
34
|
const exmapleScenario = examples.map(($ele, index) => {
|
|
34
35
|
var exampleDescription = Object.values($ele).map(val => {
|
|
35
|
-
return val.concat(
|
|
36
|
+
return val.concat(" ");
|
|
36
37
|
});
|
|
37
38
|
let avoidRepetitionDescription = `Example : ${index + 1} - `.concat(exampleDescription.join(''));
|
|
38
39
|
return testBlock(avoidRepetitionDescription, stepReportHandle(steps, examples[index]), pageFixtures);
|
|
@@ -46,7 +47,7 @@ function testBlock(description, steps, pageFixtures) {
|
|
|
46
47
|
${steps.join(`\n\t`)}
|
|
47
48
|
})`;
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
+
function testFile(testCase, relativeFilePath, $tags = " ", options = null) {
|
|
50
51
|
return ` // ${relativeFilePath}
|
|
51
52
|
import { test, createNativeBDD } from "${TESTING_LIBRARY}";
|
|
52
53
|
const {$Given,$When,$Then,$And} = createNativeBDD()
|
|
@@ -55,10 +56,6 @@ function createTestFormat(testCases, relativeFilePath, $tags = ' ', options = nu
|
|
|
55
56
|
$tags: ({}, use, testInfo) => use(${JSON.stringify($tags)}
|
|
56
57
|
[testInfo.titlePath.slice(2).join("|")] || [])
|
|
57
58
|
})
|
|
58
|
-
${
|
|
59
|
+
${testCase.join('')}
|
|
59
60
|
`;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* test templete else snippet
|
|
64
|
-
*/
|
|
61
|
+
}
|
package/build/bdd-poc/{gherkin-parser/cucumber/data-driven/dataSourceMap.js → test/testData.js}
RENAMED
|
@@ -4,15 +4,14 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.testDataCreation = testDataCreation;
|
|
8
8
|
var _fastGlob = _interopRequireDefault(require("fast-glob"));
|
|
9
|
-
var
|
|
10
|
-
var _fileUtils = require("
|
|
9
|
+
var _testStructure = require("./testStructure");
|
|
10
|
+
var _fileUtils = require("../../utils/fileUtils");
|
|
11
11
|
var _path = _interopRequireDefault(require("path"));
|
|
12
|
-
var
|
|
13
|
-
var _pathConfig = require("
|
|
14
|
-
|
|
15
|
-
function createTestDataMap() {
|
|
12
|
+
var _parserCucumber = _interopRequireDefault(require("./cucumber/parserCucumber"));
|
|
13
|
+
var _pathConfig = require("../config/pathConfig");
|
|
14
|
+
function testDataCreation() {
|
|
16
15
|
var exampleSteps = [];
|
|
17
16
|
const globalTestdata = new Map();
|
|
18
17
|
const testDataFeatureFilePath = (0, _pathConfig.getFeatureFilePath)();
|
|
@@ -22,7 +21,7 @@ function createTestDataMap() {
|
|
|
22
21
|
cwd: process.cwd()
|
|
23
22
|
}).forEach(filePath => {
|
|
24
23
|
var body, header;
|
|
25
|
-
var gherkinDocument = (0,
|
|
24
|
+
var gherkinDocument = (0, _parserCucumber.default)((0, _fileUtils.readFileContents)(_path.default.resolve(process.cwd(), filePath), 'utf-8'));
|
|
26
25
|
gherkinDocument.feature.children.forEach($scenario => {
|
|
27
26
|
var _$scenario$scenario, _$scenario$scenario3, _$scenario$scenario4;
|
|
28
27
|
if ($scenario !== null && $scenario !== void 0 && $scenario.background) {
|
|
@@ -46,7 +45,7 @@ function createTestDataMap() {
|
|
|
46
45
|
const {
|
|
47
46
|
convertedStep,
|
|
48
47
|
currentArgument
|
|
49
|
-
} = (0,
|
|
48
|
+
} = (0, _testStructure.extractStepArgument)(step.text);
|
|
50
49
|
if (Object.values(currentArgument).length && !$scenario.scenario.examples.length) {
|
|
51
50
|
$currentStep.currentArgument = currentArgument;
|
|
52
51
|
$currentStep.input = true;
|
|
@@ -82,7 +81,7 @@ function createTestDataMap() {
|
|
|
82
81
|
steptable: false,
|
|
83
82
|
scenarioTable: false
|
|
84
83
|
};
|
|
85
|
-
exampleSteps = $scenario.scenario.steps.map(element => (0,
|
|
84
|
+
exampleSteps = $scenario.scenario.steps.map(element => (0, _testStructure.extractStepArgument)(element.text).convertedStep);
|
|
86
85
|
(_$scenario$scenario5 = $scenario.scenario) === null || _$scenario$scenario5 === void 0 || _$scenario$scenario5.examples.map(example => {
|
|
87
86
|
var _example$tableHeader;
|
|
88
87
|
body = example === null || example === void 0 ? void 0 : example.tableBody.map(cell => {
|
|
@@ -92,7 +91,7 @@ function createTestDataMap() {
|
|
|
92
91
|
return exampleHead.value;
|
|
93
92
|
});
|
|
94
93
|
});
|
|
95
|
-
const inputParameter =
|
|
94
|
+
const inputParameter = testDataExtraction(header, body);
|
|
96
95
|
exampleSteps.forEach(step => {
|
|
97
96
|
$currentExampleSteps.inputParameter = Object.assign([], inputParameter);
|
|
98
97
|
$currentExampleSteps.scenarioTable = true;
|
|
@@ -104,8 +103,23 @@ function createTestDataMap() {
|
|
|
104
103
|
resolve(globalTestdata);
|
|
105
104
|
});
|
|
106
105
|
}
|
|
106
|
+
function testDataExtraction(tableHeader, tableBody) {
|
|
107
|
+
const result = [];
|
|
108
|
+
if (tableBody && tableHeader) {
|
|
109
|
+
tableBody.forEach(array => {
|
|
110
|
+
const obj = {};
|
|
111
|
+
array.forEach((item, index) => {
|
|
112
|
+
obj[`${tableHeader[index].replace(/\s/g, '')}`] = item;
|
|
113
|
+
});
|
|
114
|
+
result.push(obj);
|
|
115
|
+
});
|
|
116
|
+
} else {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
return [...result];
|
|
120
|
+
}
|
|
107
121
|
|
|
108
122
|
// handle length of example
|
|
109
123
|
// if($scenario?.background){
|
|
110
|
-
// $scenario.scenario = $scenario.background
|
|
124
|
+
// $scenario.scenario = $scenario.background
|
|
111
125
|
// }
|
package/build/bdd-poc/{gherkin-parser/stepsDefinition/generateStep.js → test/testStructure.js}
RENAMED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.createTestSnippet = createTestSnippet;
|
|
7
6
|
exports.extractStepArgument = extractStepArgument;
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
7
|
+
exports.testSnippet = testSnippet;
|
|
8
|
+
var _logger = require("../../utils/logger");
|
|
9
|
+
var _throwError = require("../errors/throwError");
|
|
10
|
+
var _stringManipulation = require("../utils/stringManipulation");
|
|
11
|
+
var _stepsnippets = require("./stepGenerate/stepsnippets");
|
|
12
|
+
function testSnippet(parsedFeature, featureFilePath) {
|
|
12
13
|
var currentScenarios = [];
|
|
13
14
|
var $tags = {};
|
|
14
15
|
parsedFeature.scenarios.forEach(scenario => {
|
|
@@ -17,7 +18,7 @@ function createTestSnippet(parsedFeature, featureFilePath) {
|
|
|
17
18
|
const resultedStep = scenarioSnippet(scenario);
|
|
18
19
|
currentScenarios.push(resultedStep);
|
|
19
20
|
});
|
|
20
|
-
return (0, _stepsnippets.
|
|
21
|
+
return (0, _stepsnippets.testFile)(currentScenarios, featureFilePath, $tags);
|
|
21
22
|
}
|
|
22
23
|
function extractStepArgument(step) {
|
|
23
24
|
var testInputs = [];
|
|
@@ -43,7 +44,6 @@ function scenarioSnippet(scenario) {
|
|
|
43
44
|
var currentInputs = [];
|
|
44
45
|
/** To Add BackGround As Steps */
|
|
45
46
|
if ((scenario === null || scenario === void 0 || (_scenario$background = scenario.background) === null || _scenario$background === void 0 ? void 0 : _scenario$background.length) >= 1) {
|
|
46
|
-
/** if Background will run every scenario (add in before Given, when, Then) */
|
|
47
47
|
/** Destructed Should be Background will first remaining Step behind */
|
|
48
48
|
scenario.steps = [...scenario.background, ...scenario.steps];
|
|
49
49
|
}
|
|
@@ -59,11 +59,11 @@ function scenarioSnippet(scenario) {
|
|
|
59
59
|
process.exit(0);
|
|
60
60
|
}
|
|
61
61
|
currentInputs.push(pageFixtureUsed_Step.stepPageFixtureName);
|
|
62
|
-
currentStep.push((0, _stepsnippets.
|
|
62
|
+
currentStep.push((0, _stepsnippets.testStep)(step.keyword, convertedStep, pageFixtureUsed_Step.stepPageFixtureName, pageFixtureUsed_Step.stepInputKey.join(','), step.stepDescription));
|
|
63
63
|
return;
|
|
64
64
|
});
|
|
65
65
|
const pageFixtures = pageFixtureFilter(currentInputs);
|
|
66
|
-
return (0, _stepsnippets.
|
|
66
|
+
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);
|
|
67
67
|
}
|
|
68
68
|
function pageFixtureFilter(pageFixturesArray) {
|
|
69
69
|
var pageInputs = [];
|
|
@@ -87,6 +87,6 @@ function tagHandleFixture(scenario) {
|
|
|
87
87
|
return tagsObjects;
|
|
88
88
|
}
|
|
89
89
|
return {
|
|
90
|
-
[scenario.
|
|
90
|
+
[scenario.scenariodescription]: scenario.scenarioTags
|
|
91
91
|
};
|
|
92
92
|
}
|
|
@@ -9,10 +9,8 @@ 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
|
|
13
|
-
|
|
14
|
-
// import { createStepsCallBack } from '../../../bdd-poc/core-runner/createCallbacksMap';
|
|
15
|
-
|
|
12
|
+
var _testData = require("../../../bdd-poc/test/testData");
|
|
13
|
+
var _stepRunner = require("../../../bdd-poc/core-runner/stepRunner");
|
|
16
14
|
const {
|
|
17
15
|
browsers,
|
|
18
16
|
trace,
|
|
@@ -51,16 +49,11 @@ const testOptions = (0, _configUtils.getTestUseOptions)({
|
|
|
51
49
|
* Playwright configuration object
|
|
52
50
|
*
|
|
53
51
|
* @returns {import('@playwright/test').PlaywrightTestConfig}
|
|
54
|
-
|
|
52
|
+
*/
|
|
55
53
|
async function getPlaywrightConfig() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
* expose from bdd parser (From module to core module)
|
|
60
|
-
*/
|
|
61
|
-
// globalThis.globalStepMap = new Map();
|
|
62
|
-
// createStepsCallBack();
|
|
63
|
-
// globalThis.globalTestDataMap = await createTestDataMap();
|
|
54
|
+
globalThis.globalStepMap = new Map();
|
|
55
|
+
(0, _stepRunner.createStepCallBack)();
|
|
56
|
+
globalThis.globalTestdata = await (0, _testData.testDataCreation)();
|
|
64
57
|
return {
|
|
65
58
|
testDir,
|
|
66
59
|
outputDir: _path.default.join(process.cwd(), 'uat', 'test-results'),
|
|
@@ -15,7 +15,6 @@ var _readConfigFile = require("./readConfigFile");
|
|
|
15
15
|
var _rootPath = require("../../utils/rootPath");
|
|
16
16
|
var _tagProcessor = require("./tag-processor");
|
|
17
17
|
var _bddPoc = require("../../bdd-poc");
|
|
18
|
-
// import { createGlobalMaps } from '../../bdd-poc/core-runner/intialize';
|
|
19
18
|
// import { allowedTags } from '../../bdd-poc/test/tagsHandle';
|
|
20
19
|
|
|
21
20
|
function parseUserArgs() {
|
|
@@ -128,8 +127,7 @@ function main() {
|
|
|
128
127
|
const configPath = (0, _readConfigFile.isUserConfigFileAvailable)() ? require.resolve('./setup/config-creator.js') : require.resolve('../../../playwright.config.js');
|
|
129
128
|
let promises = [];
|
|
130
129
|
if (bddMode) {
|
|
131
|
-
promises.push((0, _bddPoc.
|
|
132
|
-
// promises.push(createGlobalMaps());
|
|
130
|
+
promises.push((0, _bddPoc.createCucumberBDD)());
|
|
133
131
|
}
|
|
134
132
|
const args = ['test', '--config', configPath].concat(playwrightArgs);
|
|
135
133
|
Promise.all(promises).then(() => runPlaywright(command, args)).catch(err => {
|
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -35,13 +35,11 @@ const {
|
|
|
35
35
|
Given,
|
|
36
36
|
Then,
|
|
37
37
|
When,
|
|
38
|
-
And
|
|
39
|
-
Step,
|
|
40
|
-
But
|
|
38
|
+
And
|
|
41
39
|
} = (0, _bddPoc.createBdd)();
|
|
42
|
-
exports.But = But;
|
|
43
|
-
exports.Step = Step;
|
|
44
40
|
exports.And = And;
|
|
45
41
|
exports.When = When;
|
|
46
42
|
exports.Then = Then;
|
|
47
|
-
exports.Given = Given;
|
|
43
|
+
exports.Given = Given;
|
|
44
|
+
const Step = exports.Step = Then;
|
|
45
|
+
const But = exports.But = Then;
|
package/package.json
CHANGED
package/playwright.config.js
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createStepsCallBack = createStepsCallBack;
|
|
8
|
-
var _fastGlob = require("fast-glob");
|
|
9
|
-
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
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
async function createStepsCallBack() {
|
|
17
|
-
const actualSpecPattern = (0, _pathConfig.getStepFilePath)();
|
|
18
|
-
await (0, _fastGlob.globSync)(actualSpecPattern, {
|
|
19
|
-
dot: true,
|
|
20
|
-
cwd: process.cwd()
|
|
21
|
-
}).forEach(FilePath => {
|
|
22
|
-
const specFilePath = _path.default.resolve(process.cwd(), FilePath);
|
|
23
|
-
// Executing spec file to store description and callbacks && Esm Pattern && invoke call
|
|
24
|
-
require(specFilePath);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createGlobalMaps = createGlobalMaps;
|
|
7
|
-
var _createCallbacksMap = require("./createCallbacksMap");
|
|
8
|
-
var _dataSourceMap = require("../gherkin-parser/cucumber/data-driven/dataSourceMap");
|
|
9
|
-
async function createGlobalMaps() {
|
|
10
|
-
// globalStepMap = stores (description callback)
|
|
11
|
-
globalThis.globalStepMap = new Map();
|
|
12
|
-
(0, _createCallbacksMap.createStepsCallBack)();
|
|
13
|
-
// globalTestDataMap For feature Files (parser testdata map)
|
|
14
|
-
globalThis.globalTestDataMap = await (0, _dataSourceMap.createTestDataMap)();
|
|
15
|
-
}
|
/package/build/bdd-poc/{gherkin-parser/cucumber/cucumber.js → test/cucumber/parserCucumber.js}
RENAMED
|
File without changes
|
|
File without changes
|