@zohodesk/testinglibrary 0.1.8-stb-bdd-v19 → 0.1.8-stb-bdd-v21
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.
|
@@ -26,7 +26,7 @@ function getTestData(description, argument) {
|
|
|
26
26
|
/** Both Input and Step Table Passed*/
|
|
27
27
|
if (stepArguments.input && stepArguments.steptable) {
|
|
28
28
|
const stepInput = Object.values(stepArguments.currentArgument) || [null];
|
|
29
|
-
return [...stepInput, stepArguments.dataTableStep];
|
|
29
|
+
return [...stepInput, getStepTable(stepArguments.dataTableStep)];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/** Input Passed */
|
|
@@ -36,14 +36,14 @@ function getTestData(description, argument) {
|
|
|
36
36
|
|
|
37
37
|
/** StepTable Passed */
|
|
38
38
|
if (stepArguments.steptable) {
|
|
39
|
-
return getStepTable(stepArguments);
|
|
39
|
+
return [getStepTable(stepArguments)];
|
|
40
40
|
}
|
|
41
41
|
/** Scenario Table Passed */
|
|
42
42
|
|
|
43
43
|
if (stepArguments.scenarioTable) {
|
|
44
44
|
var exceedParam = stepArguments.inputParameter[0];
|
|
45
45
|
const extracted = argument.map(element => {
|
|
46
|
-
return exceedParam[element];
|
|
46
|
+
return exceedParam[element.trim()];
|
|
47
47
|
});
|
|
48
48
|
const duplicateInput = Object.assign({}, stepArguments);
|
|
49
49
|
const extractInput = duplicateInput.inputParameter.shift();
|
|
@@ -72,4 +72,84 @@ function createNativeBDD() {
|
|
|
72
72
|
$Then,
|
|
73
73
|
$Step
|
|
74
74
|
};
|
|
75
|
-
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// "use strict";
|
|
78
|
+
|
|
79
|
+
// Object.defineProperty(exports, "__esModule", {
|
|
80
|
+
// value: true
|
|
81
|
+
// });
|
|
82
|
+
// exports.createNativeBDD = createNativeBDD;
|
|
83
|
+
// var _logger = require("../../utils/logger");
|
|
84
|
+
// function $Given(description) {
|
|
85
|
+
// const stepFunction = globalStepMap.get(description);
|
|
86
|
+
// if (stepFunction === undefined) {
|
|
87
|
+
// _logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Missing Steps Implementation - ${description}`);
|
|
88
|
+
// process.exit(0);
|
|
89
|
+
// }
|
|
90
|
+
// return function (pages, ...argument) {
|
|
91
|
+
// const stepTestData = getTestData(description, argument);
|
|
92
|
+
// return stepFunction(pages, ...stepTestData);
|
|
93
|
+
// };
|
|
94
|
+
// }
|
|
95
|
+
// function getTestData(description, argument) {
|
|
96
|
+
// console.log(globalTestdata.get(description))
|
|
97
|
+
// const stepArguments = globalTestdata.get(description);
|
|
98
|
+
// if (stepArguments === undefined) {
|
|
99
|
+
// _logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Missing Step - ${description}`);
|
|
100
|
+
// process.exit(0);
|
|
101
|
+
// }
|
|
102
|
+
|
|
103
|
+
// /** Both Input and Step Table Passed*/
|
|
104
|
+
// if (stepArguments.input && stepArguments.steptable) {
|
|
105
|
+
// const stepInput = Object.values(stepArguments.currentArgument) || [null];
|
|
106
|
+
// return [...stepInput, getStepTable(stepArguments.dataTableStep)];
|
|
107
|
+
// }
|
|
108
|
+
|
|
109
|
+
// /** Input Passed */
|
|
110
|
+
// if (stepArguments.input) {
|
|
111
|
+
// return Object.values(stepArguments.currentArgument) || [];
|
|
112
|
+
// }
|
|
113
|
+
|
|
114
|
+
// /** StepTable Passed */
|
|
115
|
+
// if (stepArguments.steptable) {
|
|
116
|
+
// return [getStepTable(stepArguments)];
|
|
117
|
+
// }
|
|
118
|
+
// /** Scenario Table Passed */
|
|
119
|
+
|
|
120
|
+
// if (stepArguments.scenarioTable) {
|
|
121
|
+
// // console.log('Enter Into Scenario....')
|
|
122
|
+
// // console.log('aaaaaaaaaaaaaaaaa',argument)
|
|
123
|
+
// var exceedParam = stepArguments.inputParameter[0];
|
|
124
|
+
// const extracted = argument.map(element => {
|
|
125
|
+
// return exceedParam[element.trim()];
|
|
126
|
+
// });
|
|
127
|
+
// console.log('$$$$$$$$$$',extracted)
|
|
128
|
+
// const duplicateInput = Object.assign({}, stepArguments);
|
|
129
|
+
// const extractInput = duplicateInput.inputParameter.shift();
|
|
130
|
+
// duplicateInput.inputParameter.push(extractInput);
|
|
131
|
+
// globalTestdata.set(description, Object.assign({}, duplicateInput));
|
|
132
|
+
// return extracted;
|
|
133
|
+
// }
|
|
134
|
+
// return [];
|
|
135
|
+
// }
|
|
136
|
+
// function getStepTable(stepInput) {
|
|
137
|
+
// return {
|
|
138
|
+
// dataTable: () => {
|
|
139
|
+
// return [stepInput.dataTableStep];
|
|
140
|
+
// }
|
|
141
|
+
// };
|
|
142
|
+
// }
|
|
143
|
+
// const $When = $Given;
|
|
144
|
+
// const $And = $Given;
|
|
145
|
+
// const $Then = $Given;
|
|
146
|
+
// const $Step = $Given;
|
|
147
|
+
// function createNativeBDD() {
|
|
148
|
+
// return {
|
|
149
|
+
// $Given,
|
|
150
|
+
// $When,
|
|
151
|
+
// $And,
|
|
152
|
+
// $Then,
|
|
153
|
+
// $Step
|
|
154
|
+
// };
|
|
155
|
+
// }
|
|
@@ -36,8 +36,14 @@ function extractPageFixtures(filePath) {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
function extractInputFrmStep(trimmedStep, filePath) {
|
|
39
|
+
var toRemovePattern = trimmedStep.match(/async\s*\(([^)]*)\)/)[1].match(/{(.*?)}/);
|
|
40
|
+
var InputNames = trimmedStep.match(/async\s*\(([^)]*)\)/)[1].replace(toRemovePattern[0], "$null") || [];
|
|
39
41
|
try {
|
|
40
|
-
|
|
42
|
+
var _InputNames$split;
|
|
43
|
+
return {
|
|
44
|
+
stepPageFixtureName: trimmedStep.split(' ').slice(1).join('').match(/\((.*?)\)/)[1].match(/\{(.*?)\}/g).pop() || [false].pop(),
|
|
45
|
+
stepInputKey: ((_InputNames$split = InputNames.split(',')) === null || _InputNames$split === void 0 || (_InputNames$split = _InputNames$split.slice(1)) === null || _InputNames$split === void 0 ? void 0 : _InputNames$split.map(input => `"${input}"`)) || []
|
|
46
|
+
};
|
|
41
47
|
} catch (error) {
|
|
42
48
|
// Logger.log(Logger.FAILURE_TYPE,`${filePath} - Steps Has MisMatched Pattern`)
|
|
43
49
|
(0, _throwError.throwProperStepImplementError)(filePath);
|
|
@@ -54,12 +54,12 @@ function scenarioSnippet(scenario) {
|
|
|
54
54
|
} = extractStepArgument(step.stepDescription);
|
|
55
55
|
var pageFixtureUsed_Step = testDataMap.get(convertedStep) || null;
|
|
56
56
|
/** Step Implementation Check (Walk Through Approach)*/
|
|
57
|
-
if (!pageFixtureUsed_Step) {
|
|
57
|
+
if (!pageFixtureUsed_Step.stepPageFixtureName) {
|
|
58
58
|
(0, _throwError.throwNotImplementError)(step.stepDescription, convertedStep, step.keyword);
|
|
59
59
|
process.exit(0);
|
|
60
60
|
}
|
|
61
|
-
currentInputs.push(pageFixtureUsed_Step);
|
|
62
|
-
currentStep.push((0, _stepsnippets.testStep)(step.keyword, convertedStep, pageFixtureUsed_Step,
|
|
61
|
+
currentInputs.push(pageFixtureUsed_Step.stepPageFixtureName);
|
|
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);
|