@zohodesk/testinglibrary 0.1.8-bdd-27 → 0.1.8-bdd-29
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.
|
@@ -15,10 +15,10 @@ const {
|
|
|
15
15
|
stepDefinitionsFolder
|
|
16
16
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
17
17
|
function getFeatureFilePath() {
|
|
18
|
-
return (0, _stringManipulation.filePathPattern)(_path.default.resolve(process.cwd(), 'uat', featureFilesFolder || '**', '**', '*.feature'), _getFilePath.isWindows);
|
|
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', stepDefinitionsFolder || '**', '**', '*.spec.js'), _getFilePath.isWindows);
|
|
21
|
+
return (0, _stringManipulation.filePathPattern)(_path.default.resolve(process.cwd(), 'uat', 'modules', '**', stepDefinitionsFolder || '**', '**', '*.spec.js'), _getFilePath.isWindows);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -4,15 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createBdd = createBdd;
|
|
7
|
-
const
|
|
7
|
+
const Step = (description, callback) => {
|
|
8
8
|
globalStepMap.set(description, callback);
|
|
9
9
|
};
|
|
10
|
+
const Given = Step;
|
|
11
|
+
const Then = Step;
|
|
12
|
+
const When = Step;
|
|
13
|
+
const And = Step;
|
|
10
14
|
function createBdd() {
|
|
11
15
|
return {
|
|
12
16
|
Given,
|
|
13
17
|
When,
|
|
14
18
|
Then,
|
|
15
19
|
And,
|
|
16
|
-
Step
|
|
20
|
+
Step,
|
|
21
|
+
But
|
|
17
22
|
};
|
|
18
23
|
}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createNativeBDD = createNativeBDD;
|
|
7
7
|
var _logger = require("../../utils/logger");
|
|
8
|
-
const $
|
|
8
|
+
const $And = description => {
|
|
9
9
|
const stepFunction = globalStepMap.get(description);
|
|
10
10
|
if (stepFunction === undefined) {
|
|
11
11
|
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Missing Steps Implementation - ${description}`);
|
|
@@ -25,39 +25,66 @@ function filterTestData(description, argument) {
|
|
|
25
25
|
|
|
26
26
|
/** Both Input and Step Table Passed*/
|
|
27
27
|
if (stepArguments.input && stepArguments.steptable) {
|
|
28
|
-
const stepInput =
|
|
29
|
-
return [...stepInput, stepArguments
|
|
28
|
+
const stepInput = getInputs(stepArguments);
|
|
29
|
+
return [...stepInput, getStepTable(stepArguments)];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/** Input Passed */
|
|
33
33
|
if (stepArguments.input) {
|
|
34
|
-
return
|
|
34
|
+
return getInputs(stepArguments);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/** StepTable Passed */
|
|
38
38
|
if (stepArguments.steptable) {
|
|
39
|
-
return
|
|
39
|
+
return getStepTable(stepArguments);
|
|
40
40
|
}
|
|
41
41
|
/** Scenario Table Passed */
|
|
42
42
|
|
|
43
43
|
if (stepArguments.scenarioTable) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
duplicateInput.
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
return getScenarioTable(stepArguments, 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;
|
|
53
55
|
}
|
|
54
56
|
return [];
|
|
55
57
|
}
|
|
56
|
-
|
|
58
|
+
function getInputs(stepArguments) {
|
|
59
|
+
return Object.values(stepArguments.currentArgument) || [null];
|
|
60
|
+
}
|
|
61
|
+
function getStepTable(stepArguments) {
|
|
62
|
+
const dataTable = {
|
|
63
|
+
raw: () => {
|
|
64
|
+
return stepArguments.stepArguments || [];
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return [dataTable];
|
|
68
|
+
}
|
|
69
|
+
function getScenarioTable(stepArguments, 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
|
+
}
|
|
57
80
|
/**
|
|
58
81
|
* get method input but not get it assign and extract
|
|
59
82
|
*/
|
|
60
83
|
|
|
84
|
+
const $Given = $And;
|
|
85
|
+
const $Step = $And;
|
|
86
|
+
const $Then = $And;
|
|
87
|
+
const $When = $And;
|
|
61
88
|
function createNativeBDD() {
|
|
62
89
|
return {
|
|
63
90
|
$Given,
|
package/build/index.js
CHANGED
|
@@ -35,11 +35,13 @@ const {
|
|
|
35
35
|
Given,
|
|
36
36
|
Then,
|
|
37
37
|
When,
|
|
38
|
-
And
|
|
38
|
+
And,
|
|
39
|
+
Step,
|
|
40
|
+
But
|
|
39
41
|
} = (0, _bddPoc.createBdd)();
|
|
42
|
+
exports.But = But;
|
|
43
|
+
exports.Step = Step;
|
|
40
44
|
exports.And = And;
|
|
41
45
|
exports.When = When;
|
|
42
46
|
exports.Then = Then;
|
|
43
|
-
exports.Given = Given;
|
|
44
|
-
const Step = exports.Step = Then;
|
|
45
|
-
const But = exports.But = Then;
|
|
47
|
+
exports.Given = Given;
|