@zohodesk/testinglibrary 0.1.8-bdd-26.6 → 0.1.8-bdd-27
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 +7 -3
- package/build/bdd-poc/core-runner/createCallbacksMap.js +1 -0
- package/build/bdd-poc/core-runner/exportMethods.js +2 -6
- package/build/bdd-poc/core-runner/intialize.js +3 -1
- package/build/bdd-poc/core-runner/main.js +11 -5
- package/build/bdd-poc/core-runner/stepRunner.js +9 -8
- package/build/bdd-poc/errors/throwError.js +4 -1
- package/build/bdd-poc/{test/stepsDefinition/createTestCode.js → gherkin-parser/createTestTemplate.js} +14 -14
- package/build/bdd-poc/{test → gherkin-parser}/cucumber/cucumberSynatxParser.js +3 -2
- package/build/bdd-poc/{test → gherkin-parser}/cucumber/data-driven/dataSourceMap.js +3 -17
- package/build/bdd-poc/{test → gherkin-parser}/stepsDefinition/extractTestInputs.js +3 -0
- package/build/bdd-poc/{test → gherkin-parser/stepsDefinition}/generateStep.js +10 -10
- package/build/bdd-poc/{test/stepsDefinition/parserSteps.js → gherkin-parser/stepsDefinition/parserStepsArguments.js} +12 -12
- package/build/bdd-poc/index.js +4 -4
- package/build/bdd-poc/snippets/stepsnippets.js +12 -9
- package/build/core/playwright/setup/config-creator.js +4 -0
- package/build/core/playwright/test-runner.js +1 -1
- package/package.json +1 -1
- package/playwright.config.js +1 -1
- /package/build/bdd-poc/{test → gherkin-parser}/cucumber/cucumber.js +0 -0
- /package/build/bdd-poc/{test → gherkin-parser}/tagsHandle.js +0 -0
|
@@ -15,8 +15,12 @@ const {
|
|
|
15
15
|
stepDefinitionsFolder
|
|
16
16
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
17
17
|
function getFeatureFilePath() {
|
|
18
|
-
return (0, _stringManipulation.filePathPattern)(_path.default.resolve(process.cwd(), 'uat',
|
|
18
|
+
return (0, _stringManipulation.filePathPattern)(_path.default.resolve(process.cwd(), 'uat', featureFilesFolder || '**', '**', '*.feature'), _getFilePath.isWindows);
|
|
19
19
|
}
|
|
20
20
|
function getStepFilePath() {
|
|
21
|
-
return (0, _stringManipulation.filePathPattern)(_path.default.resolve(process.cwd(), 'uat',
|
|
22
|
-
}
|
|
21
|
+
return (0, _stringManipulation.filePathPattern)(_path.default.resolve(process.cwd(), 'uat', stepDefinitionsFolder || '**', '**', '*.spec.js'), _getFilePath.isWindows);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* loosly coupled and repo context
|
|
26
|
+
*/
|
|
@@ -20,6 +20,7 @@ async function createStepsCallBack() {
|
|
|
20
20
|
cwd: process.cwd()
|
|
21
21
|
}).forEach(FilePath => {
|
|
22
22
|
const specFilePath = _path.default.resolve(process.cwd(), FilePath);
|
|
23
|
+
// Executing spec file to store description and callbacks && Esm Pattern && invoke call
|
|
23
24
|
require(specFilePath);
|
|
24
25
|
});
|
|
25
26
|
}
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createBdd = createBdd;
|
|
7
|
-
|
|
7
|
+
const Given = Then = When = And = Step = (description, callback) => {
|
|
8
8
|
globalStepMap.set(description, callback);
|
|
9
|
-
}
|
|
10
|
-
const Then = Given;
|
|
11
|
-
const When = Given;
|
|
12
|
-
const And = Given;
|
|
13
|
-
const Step = Given;
|
|
9
|
+
};
|
|
14
10
|
function createBdd() {
|
|
15
11
|
return {
|
|
16
12
|
Given,
|
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createGlobalMaps = createGlobalMaps;
|
|
7
7
|
var _createCallbacksMap = require("./createCallbacksMap");
|
|
8
|
-
var _dataSourceMap = require("../
|
|
8
|
+
var _dataSourceMap = require("../gherkin-parser/cucumber/data-driven/dataSourceMap");
|
|
9
9
|
async function createGlobalMaps() {
|
|
10
|
+
// globalStepMap = stores (description callback)
|
|
10
11
|
globalThis.globalStepMap = new Map();
|
|
11
12
|
(0, _createCallbacksMap.createStepsCallBack)();
|
|
13
|
+
// globalTestDataMap For feature Files (parser testdata map)
|
|
12
14
|
globalThis.globalTestDataMap = await (0, _dataSourceMap.createTestDataMap)();
|
|
13
15
|
}
|
|
@@ -3,13 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var
|
|
6
|
+
exports.preProcessGherkin = preProcessGherkin;
|
|
7
|
+
var _createTestTemplate = require("../gherkin-parser/createTestTemplate");
|
|
8
8
|
/**
|
|
9
9
|
* @function
|
|
10
10
|
* @name createCucumber - start generating Step Files
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
function
|
|
14
|
-
(0,
|
|
15
|
-
}
|
|
13
|
+
function preProcessGherkin() {
|
|
14
|
+
(0, _createTestTemplate.gherkinParser)();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* feature relates - gherkin
|
|
19
|
+
* steps related - gherkin step
|
|
20
|
+
* developer written - step file
|
|
21
|
+
*/
|
|
@@ -5,18 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createNativeBDD = createNativeBDD;
|
|
7
7
|
var _logger = require("../../utils/logger");
|
|
8
|
-
|
|
8
|
+
const $Given = $Step = $Then = $When = $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}`);
|
|
12
12
|
process.exit(0);
|
|
13
13
|
}
|
|
14
14
|
return function (pages, ...argument) {
|
|
15
|
-
const stepTestData =
|
|
15
|
+
const stepTestData = filterTestData(description, argument);
|
|
16
16
|
return stepFunction(pages, ...stepTestData);
|
|
17
17
|
};
|
|
18
|
-
}
|
|
19
|
-
function
|
|
18
|
+
};
|
|
19
|
+
function filterTestData(description, argument) {
|
|
20
20
|
const stepArguments = globalTestDataMap.get(description);
|
|
21
21
|
if (stepArguments === undefined) {
|
|
22
22
|
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Missing Step - ${description}`);
|
|
@@ -53,10 +53,11 @@ function getTestData(description, argument) {
|
|
|
53
53
|
}
|
|
54
54
|
return [];
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* get method input but not get it assign and extract
|
|
59
|
+
*/
|
|
60
|
+
|
|
60
61
|
function createNativeBDD() {
|
|
61
62
|
return {
|
|
62
63
|
$Given,
|
|
@@ -4,23 +4,18 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.gherkinParser = gherkinParser;
|
|
8
8
|
var _fastGlob = _interopRequireDefault(require("fast-glob"));
|
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
|
10
|
-
var _cucumberSynatxParser = require("
|
|
11
|
-
var _generateStep = require("
|
|
12
|
-
var _fileUtils = require("
|
|
13
|
-
var _pathConfig = require("
|
|
14
|
-
var
|
|
10
|
+
var _cucumberSynatxParser = require("./cucumber/cucumberSynatxParser");
|
|
11
|
+
var _generateStep = require("./stepsDefinition/generateStep");
|
|
12
|
+
var _fileUtils = require("../../utils/fileUtils");
|
|
13
|
+
var _pathConfig = require("../config/pathConfig");
|
|
14
|
+
var _parserStepsArguments = require("./stepsDefinition/parserStepsArguments");
|
|
15
15
|
// import { createStepDataMap } from './extractTestInputs';
|
|
16
16
|
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
const stepsSnippets = (0, _generateStep.createTestStructure)(parsedFeatureContent, featureFilePath);
|
|
20
|
-
(0, _fileUtils.writeFileContents)(stepsFilePath, stepsSnippets);
|
|
21
|
-
}
|
|
22
|
-
async function createStepFiles() {
|
|
23
|
-
await (0, _parserSteps.traverseASTstep)();
|
|
17
|
+
async function gherkinParser() {
|
|
18
|
+
await (0, _parserStepsArguments.createStepArgumentsMap)();
|
|
24
19
|
const featureFilePattern = (0, _pathConfig.getFeatureFilePath)();
|
|
25
20
|
const featureFileFolderPath = _path.default.resolve(process.cwd(), 'uat', '.feature-gen');
|
|
26
21
|
if (!(0, _fileUtils.checkIfFileExists)(featureFileFolderPath)) {
|
|
@@ -35,6 +30,11 @@ async function createStepFiles() {
|
|
|
35
30
|
const featurefilePath = _path.default.resolve(process.cwd(), filePath);
|
|
36
31
|
const parsedFeatureContent = (0, _cucumberSynatxParser.parseFeature)((0, _fileUtils.readFileContents)(featurefilePath, 'utf-8'));
|
|
37
32
|
const fileName = _path.default.basename(filePath).replace('.feature', '.spec.js');
|
|
38
|
-
|
|
33
|
+
generateStepFiles(parsedFeatureContent, fileName, filePath);
|
|
39
34
|
});
|
|
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
|
}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.parseFeature = parseFeature;
|
|
8
|
+
exports.testDataExtraction = testDataExtraction;
|
|
8
9
|
var _cucumber = _interopRequireDefault(require("./cucumber"));
|
|
9
10
|
function parseFeature(featureFileContent) {
|
|
10
11
|
var _gherkinDocument$feat;
|
|
@@ -21,7 +22,7 @@ function parseFeature(featureFileContent) {
|
|
|
21
22
|
gherkinDocument.feature.children.forEach($scenario => {
|
|
22
23
|
var _$scenario$scenario, _$scenario$scenario2, _$scenario$scenario3, _$scenario$scenario4;
|
|
23
24
|
var scenarioSteps = {
|
|
24
|
-
|
|
25
|
+
scenarioDescription: "",
|
|
25
26
|
steps: [],
|
|
26
27
|
tablebody: false,
|
|
27
28
|
tableheader: false,
|
|
@@ -29,7 +30,7 @@ function parseFeature(featureFileContent) {
|
|
|
29
30
|
scenarioTags: [],
|
|
30
31
|
background: []
|
|
31
32
|
};
|
|
32
|
-
scenarioSteps.
|
|
33
|
+
scenarioSteps.scenarioDescription = (_$scenario$scenario = $scenario.scenario) === null || _$scenario$scenario === void 0 ? void 0 : _$scenario$scenario.name;
|
|
33
34
|
|
|
34
35
|
/** If Feature Has Background it will Assign to Scenario Background of Feature */
|
|
35
36
|
if ($scenario !== null && $scenario !== void 0 && $scenario.background) {
|
|
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.createTestDataMap = createTestDataMap;
|
|
8
8
|
var _fastGlob = _interopRequireDefault(require("fast-glob"));
|
|
9
|
-
var _generateStep = require("../../generateStep");
|
|
9
|
+
var _generateStep = require("../../stepsDefinition/generateStep");
|
|
10
10
|
var _fileUtils = require("../../../../utils/fileUtils");
|
|
11
11
|
var _path = _interopRequireDefault(require("path"));
|
|
12
12
|
var _cucumber = _interopRequireDefault(require("../cucumber"));
|
|
13
13
|
var _pathConfig = require("../../../config/pathConfig");
|
|
14
|
+
var _cucumberSynatxParser = require("../cucumberSynatxParser");
|
|
14
15
|
function createTestDataMap() {
|
|
15
16
|
var exampleSteps = [];
|
|
16
17
|
const globalTestdata = new Map();
|
|
@@ -91,7 +92,7 @@ function createTestDataMap() {
|
|
|
91
92
|
return exampleHead.value;
|
|
92
93
|
});
|
|
93
94
|
});
|
|
94
|
-
const inputParameter = testDataExtraction(header, body);
|
|
95
|
+
const inputParameter = (0, _cucumberSynatxParser.testDataExtraction)(header, body);
|
|
95
96
|
exampleSteps.forEach(step => {
|
|
96
97
|
$currentExampleSteps.inputParameter = Object.assign([], inputParameter);
|
|
97
98
|
$currentExampleSteps.scenarioTable = true;
|
|
@@ -103,21 +104,6 @@ function createTestDataMap() {
|
|
|
103
104
|
resolve(globalTestdata);
|
|
104
105
|
});
|
|
105
106
|
}
|
|
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
|
-
}
|
|
121
107
|
|
|
122
108
|
// handle length of example
|
|
123
109
|
// if($scenario?.background){
|
|
@@ -54,6 +54,9 @@ function extractInputFrmStep(trimmedStep, filePath) {
|
|
|
54
54
|
process.exit(0);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
+
|
|
58
|
+
// regex seperation
|
|
59
|
+
|
|
57
60
|
function extractDescriptionFrmStep(trimmedStep) {
|
|
58
61
|
var refactoredDescription;
|
|
59
62
|
if (trimmedStep.match(/\((.*?)\)/g).pop().split('').indexOf(`'`) === 1) {
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.createTestSnippet = createTestSnippet;
|
|
7
7
|
exports.extractStepArgument = extractStepArgument;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
function createTestStructure(parsedFeature, featureFilePath) {
|
|
8
|
+
var _throwError = require("../../errors/throwError");
|
|
9
|
+
var _stringManipulation = require("../../utils/stringManipulation");
|
|
10
|
+
var _stepsnippets = require("../../snippets/stepsnippets");
|
|
11
|
+
function createTestSnippet(parsedFeature, featureFilePath) {
|
|
13
12
|
var currentScenarios = [];
|
|
14
13
|
var $tags = {};
|
|
15
14
|
parsedFeature.scenarios.forEach(scenario => {
|
|
@@ -18,7 +17,7 @@ function createTestStructure(parsedFeature, featureFilePath) {
|
|
|
18
17
|
const resultedStep = scenarioSnippet(scenario);
|
|
19
18
|
currentScenarios.push(resultedStep);
|
|
20
19
|
});
|
|
21
|
-
return (0, _stepsnippets.
|
|
20
|
+
return (0, _stepsnippets.createTestFormat)(currentScenarios, featureFilePath, $tags);
|
|
22
21
|
}
|
|
23
22
|
function extractStepArgument(step) {
|
|
24
23
|
var testInputs = [];
|
|
@@ -44,6 +43,7 @@ function scenarioSnippet(scenario) {
|
|
|
44
43
|
var currentInputs = [];
|
|
45
44
|
/** To Add BackGround As Steps */
|
|
46
45
|
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.createStepFormat)(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.describeTest)(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
|
}
|
|
@@ -4,12 +4,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.createStepArgumentsMap = createStepArgumentsMap;
|
|
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
|
+
}
|
|
13
23
|
async function extractFixtureFrmNode(node) {
|
|
14
24
|
var stepText;
|
|
15
25
|
return await new Promise(resolve => {
|
|
@@ -51,17 +61,7 @@ function combineAllFixture(fixturesArray) {
|
|
|
51
61
|
}
|
|
52
62
|
return `{${allFixture}${lastFixture}}`;
|
|
53
63
|
}
|
|
54
|
-
function
|
|
55
|
-
var $promise = [];
|
|
56
|
-
_fastGlob.default.globSync((0, _pathConfig.getStepFilePath)(), {
|
|
57
|
-
dot: true,
|
|
58
|
-
cwd: process.cwd()
|
|
59
|
-
}).forEach(filePath => {
|
|
60
|
-
$promise.push(nodeAST((0, _fileUtils.readFileContents)(filePath)));
|
|
61
|
-
});
|
|
62
|
-
Promise.all($promise);
|
|
63
|
-
}
|
|
64
|
-
function nodeAST(stepContent) {
|
|
64
|
+
function parseNodeAST(stepContent) {
|
|
65
65
|
const options = {
|
|
66
66
|
ecmaVersion: 2020,
|
|
67
67
|
sourceType: 'module'
|
package/build/bdd-poc/index.js
CHANGED
|
@@ -9,16 +9,16 @@ Object.defineProperty(exports, "createBdd", {
|
|
|
9
9
|
return _exportMethods.createBdd;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "createNativeBDD", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _stepRunner.createNativeBDD;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
18
|
+
Object.defineProperty(exports, "preProcessGherkin", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function () {
|
|
21
|
-
return
|
|
21
|
+
return _main.preProcessGherkin;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
var _exportMethods = require("./core-runner/exportMethods");
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.testSuite = testSuite;
|
|
6
|
+
exports.createStepFormat = createStepFormat;
|
|
7
|
+
exports.createTestFormat = createTestFormat;
|
|
8
|
+
exports.describeTest = describeTest;
|
|
10
9
|
const TESTING_LIBRARY = '@zohodesk/testinglibrary';
|
|
11
10
|
function stepReportHandle(Steps, Example) {
|
|
12
11
|
var _steps = [...Steps];
|
|
@@ -19,7 +18,7 @@ function stepReportHandle(Steps, Example) {
|
|
|
19
18
|
});
|
|
20
19
|
return [...resultSteps.split(medium)];
|
|
21
20
|
}
|
|
22
|
-
function
|
|
21
|
+
function createStepFormat(keyword, description, pageFixtureUsed_Step, testData, stepDescription, options) {
|
|
23
22
|
return `await test.step('${keyword.trim()}:${stepDescription.replace(new RegExp(`'`, 'g'), ' ')}',async() => {
|
|
24
23
|
await $${keyword}("${description}")(${pageFixtureUsed_Step},${testData})
|
|
25
24
|
})`;
|
|
@@ -29,7 +28,7 @@ function testSuite(description, scenariotestBlock, tags, options = null) {
|
|
|
29
28
|
${scenariotestBlock}
|
|
30
29
|
})`;
|
|
31
30
|
}
|
|
32
|
-
function
|
|
31
|
+
function describeTest(steps, examples, description, pageFixtures, tags, option) {
|
|
33
32
|
if (examples.length >= 1) {
|
|
34
33
|
const exmapleScenario = examples.map(($ele, index) => {
|
|
35
34
|
var exampleDescription = Object.values($ele).map(val => {
|
|
@@ -47,7 +46,7 @@ function testBlock(description, steps, pageFixtures) {
|
|
|
47
46
|
${steps.join(`\n\t`)}
|
|
48
47
|
})`;
|
|
49
48
|
}
|
|
50
|
-
function
|
|
49
|
+
function createTestFormat(testCases, relativeFilePath, $tags = ' ', options = null) {
|
|
51
50
|
return ` // ${relativeFilePath}
|
|
52
51
|
import { test, createNativeBDD } from "${TESTING_LIBRARY}";
|
|
53
52
|
const {$Given,$When,$Then,$And} = createNativeBDD()
|
|
@@ -56,6 +55,10 @@ function testFile(testCase, relativeFilePath, $tags = ' ', options = null) {
|
|
|
56
55
|
$tags: ({}, use, testInfo) => use(${JSON.stringify($tags)}
|
|
57
56
|
[testInfo.titlePath.slice(2).join("|")] || [])
|
|
58
57
|
})
|
|
59
|
-
${
|
|
58
|
+
${testCases.join('')}
|
|
60
59
|
`;
|
|
61
|
-
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* test templete else snippet
|
|
64
|
+
*/
|
|
@@ -54,6 +54,10 @@ const testOptions = (0, _configUtils.getTestUseOptions)({
|
|
|
54
54
|
*/
|
|
55
55
|
async function getPlaywrightConfig() {
|
|
56
56
|
(0, _intialize.createGlobalMaps)();
|
|
57
|
+
/**
|
|
58
|
+
* createglobal Map = make it loose coupled
|
|
59
|
+
* expose from bdd parser (From module to core module)
|
|
60
|
+
*/
|
|
57
61
|
// globalThis.globalStepMap = new Map();
|
|
58
62
|
// createStepsCallBack();
|
|
59
63
|
// globalThis.globalTestDataMap = await createTestDataMap();
|
|
@@ -128,7 +128,7 @@ function main() {
|
|
|
128
128
|
const configPath = (0, _readConfigFile.isUserConfigFileAvailable)() ? require.resolve('./setup/config-creator.js') : require.resolve('../../../playwright.config.js');
|
|
129
129
|
let promises = [];
|
|
130
130
|
if (bddMode) {
|
|
131
|
-
promises.push((0, _bddPoc.
|
|
131
|
+
promises.push((0, _bddPoc.preProcessGherkin)());
|
|
132
132
|
// promises.push(createGlobalMaps());
|
|
133
133
|
}
|
|
134
134
|
const args = ['test', '--config', configPath].concat(playwrightArgs);
|
package/package.json
CHANGED
package/playwright.config.js
CHANGED
|
File without changes
|
|
File without changes
|