@zohodesk/testinglibrary 0.1.8-exp-bdd-v10 → 0.1.8-exp.10
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/.babelrc +21 -18
- package/.eslintrc.js +31 -31
- package/.prettierrc +5 -5
- package/README.md +17 -17
- package/bin/cli.js +2 -2
- package/build/bdd-framework/cli/commands/env.js +3 -3
- package/build/bdd-framework/cli/options.js +4 -4
- package/build/bdd-framework/cli/worker.js +3 -3
- package/build/bdd-framework/config/dir.js +6 -6
- package/build/bdd-framework/config/env.js +3 -3
- package/build/bdd-framework/config/index.js +2 -2
- package/build/bdd-framework/config/lang.js +2 -2
- package/build/bdd-framework/cucumber/buildStepDefinition.js +3 -3
- package/build/bdd-framework/cucumber/loadSnippetBuilder.js +3 -3
- package/build/bdd-framework/cucumber/loadSources.js +9 -9
- package/build/bdd-framework/gen/fixtures.js +8 -8
- package/build/bdd-framework/gen/formatter.js +7 -7
- package/build/bdd-framework/gen/i18n.js +3 -3
- package/build/bdd-framework/gen/index.js +2 -2
- package/build/bdd-framework/gen/testFile.js +16 -16
- package/build/bdd-framework/gen/testNode.js +3 -3
- package/build/bdd-framework/gen/testPoms.js +31 -31
- package/build/bdd-framework/hooks/scenario.js +6 -6
- package/build/bdd-framework/hooks/worker.js +4 -4
- package/build/bdd-framework/playwright/fixtureParameterNames.js +3 -3
- package/build/bdd-framework/playwright/getLocationInFile.js +4 -4
- package/build/bdd-framework/playwright/loadConfig.js +3 -3
- package/build/bdd-framework/playwright/testTypeImpl.js +11 -11
- package/build/bdd-framework/playwright/transform.js +4 -4
- package/build/bdd-framework/playwright/utils.js +2 -2
- package/build/bdd-framework/run/StepInvoker.js +2 -2
- package/build/bdd-framework/run/bddWorld.js +15 -15
- package/build/bdd-framework/snippets/index.js +2 -2
- package/build/bdd-framework/snippets/snippetSyntaxTs.js +4 -4
- package/build/bdd-framework/stepDefinitions/createBdd.js +2 -2
- package/build/bdd-framework/stepDefinitions/decorators/class.js +7 -7
- package/build/bdd-framework/stepDefinitions/decorators/steps.js +6 -6
- package/build/bdd-framework/stepDefinitions/defineStep.js +3 -3
- package/build/bdd-framework/stepDefinitions/stepConfig.js +5 -5
- package/build/bdd-framework/utils/exit.js +22 -18
- package/build/bdd-framework/utils/index.js +9 -9
- package/build/bdd-framework/utils/jsStringWrap.js +9 -9
- package/build/bdd-framework/utils/logger.js +2 -2
- package/build/core/playwright/builtInFixtures/addTags.js +1 -1
- package/build/core/playwright/builtInFixtures/context.js +12 -1
- package/build/core/playwright/builtInFixtures/i18N.js +33 -0
- package/build/core/playwright/builtInFixtures/index.js +8 -5
- package/build/core/playwright/builtInFixtures/page.js +53 -39
- package/build/core/playwright/builtInFixtures/unauthenticatedPage.js +18 -0
- package/build/core/playwright/clear-caches.js +19 -8
- package/build/core/playwright/codegen.js +4 -4
- package/build/core/playwright/constants/browserTypes.js +12 -0
- package/build/core/playwright/custom-commands.js +1 -1
- package/build/core/playwright/env-initializer.js +10 -6
- package/build/core/playwright/helpers/auth/accountLogin.js +18 -0
- package/build/core/playwright/helpers/auth/checkAuthCookies.js +47 -0
- package/build/core/playwright/helpers/auth/getUrlOrigin.js +13 -0
- package/build/core/playwright/helpers/auth/getUsers.js +72 -0
- package/build/core/playwright/helpers/auth/index.js +58 -0
- package/build/core/playwright/helpers/auth/loginSteps.js +36 -0
- package/build/core/playwright/helpers/configFileNameProvider.js +13 -0
- package/build/core/playwright/helpers/getUserFixtures.js +18 -0
- package/build/core/playwright/helpers/mergeObjects.js +13 -0
- package/build/core/playwright/index.js +68 -7
- package/build/core/playwright/readConfigFile.js +49 -39
- package/build/core/playwright/report-generator.js +7 -7
- package/build/core/playwright/setup/config-creator.js +13 -14
- package/build/core/playwright/setup/config-utils.js +37 -26
- package/build/core/playwright/tag-processor.js +2 -4
- package/build/core/playwright/test-runner.js +37 -42
- package/build/core/playwright/types.js +43 -0
- package/build/decorators.d.ts +1 -1
- package/build/decorators.js +16 -2
- package/build/index.d.ts +77 -60
- package/build/index.js +51 -9
- package/build/lib/cli.js +0 -3
- package/build/lib/post-install.js +15 -10
- package/build/parser/sample.feature +34 -34
- package/build/parser/sample.spec.js +18 -18
- package/build/setup-folder-structure/helper.js +2 -0
- package/build/setup-folder-structure/reportEnhancement/addonScript.html +24 -24
- package/build/setup-folder-structure/samples/auth-setup-sample.js +72 -72
- package/build/setup-folder-structure/samples/authUsers-sample.json +8 -8
- package/build/setup-folder-structure/samples/env-config-sample.json +20 -20
- package/build/setup-folder-structure/samples/git-ignore.sample.js +36 -36
- package/build/setup-folder-structure/samples/uat-config-sample.js +44 -44
- package/build/utils/cliArgsToObject.js +30 -26
- package/build/utils/fileUtils.js +4 -19
- package/build/utils/getFilePath.js +1 -2
- package/build/utils/rootPath.js +16 -9
- package/changelog.md +139 -131
- package/jest.config.js +63 -63
- package/npm-shrinkwrap.json +6469 -5980
- package/package.json +55 -54
- package/playwright.config.js +112 -112
- package/build/bdd-poc/core-runner/exportMethods.js +0 -20
- package/build/bdd-poc/core-runner/main.js +0 -10
- package/build/bdd-poc/core-runner/runner.js +0 -21
- package/build/bdd-poc/core-runner/stepDefinitions.js +0 -52
- package/build/bdd-poc/index.js +0 -26
- package/build/bdd-poc/test/cucumber/featureFileParer.js +0 -84
- package/build/bdd-poc/test/cucumber/parserCucumber.js +0 -15
- package/build/bdd-poc/test/stepGenerate/extractTestInputs.js +0 -37
- package/build/bdd-poc/test/stepGenerate/stepFileGenerate.js +0 -39
- package/build/bdd-poc/test/stepGenerate/stepsnippets.js +0 -58
- package/build/bdd-poc/test/tagsHandle.js +0 -69
- package/build/bdd-poc/test/testDataMap.js +0 -98
- package/build/bdd-poc/test/testStructure.js +0 -98
- package/build/bdd-poc/utils/stringManipulation.js +0 -26
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TESTING_LIBRARY = void 0;
|
|
7
|
-
exports.testBackGround = testBackGround;
|
|
8
|
-
exports.testCase = testCase;
|
|
9
|
-
exports.testFile = testFile;
|
|
10
|
-
exports.testStep = testStep;
|
|
11
|
-
exports.testSuite = testSuite;
|
|
12
|
-
const TESTING_LIBRARY = exports.TESTING_LIBRARY = '@zohodesk/testinglibrary';
|
|
13
|
-
function testStep(keyword, description, browserObject, testData, options) {
|
|
14
|
-
return `await $${keyword}('${description}')(${browserObject},${testData})\n`;
|
|
15
|
-
}
|
|
16
|
-
function testSuite(description, scenariotestBlock, tags, options = null) {
|
|
17
|
-
return `\ntest.describe('${description}${tags.join(" ")}', () => {
|
|
18
|
-
${scenariotestBlock}
|
|
19
|
-
})`;
|
|
20
|
-
}
|
|
21
|
-
function testCase(steps, examples, description, browserObjects, tags, option) {
|
|
22
|
-
if (examples.length >= 1) {
|
|
23
|
-
const exmapleScenario = examples.map(($ele, index) => {
|
|
24
|
-
var exampleDescription = Object.values($ele).map(val => {
|
|
25
|
-
return val.concat('-');
|
|
26
|
-
});
|
|
27
|
-
let avoidRepitationDescription = exampleDescription.join('').concat(`Example-${index + 1}`);
|
|
28
|
-
return testBlock(avoidRepitationDescription, steps, browserObjects);
|
|
29
|
-
});
|
|
30
|
-
return testSuite(description, exmapleScenario.join('\n'), tags);
|
|
31
|
-
}
|
|
32
|
-
return testSuite(`${description}-title`, testBlock(description, steps, browserObjects), tags);
|
|
33
|
-
}
|
|
34
|
-
function testBlock(description, steps, browserObjects) {
|
|
35
|
-
return `\ntest("${description}", async({${browserObjects.join(',')}}) => {
|
|
36
|
-
${steps.join(`\n\t`)}
|
|
37
|
-
})`;
|
|
38
|
-
}
|
|
39
|
-
function testFile(testCase, relativeFilePath, $tags, backgroundScenario = " ", options = null) {
|
|
40
|
-
return ` // ${relativeFilePath}
|
|
41
|
-
import { test, createNativeBDD } from "${TESTING_LIBRARY}";
|
|
42
|
-
const {$Given,$When,$Then,$And} = createNativeBDD()
|
|
43
|
-
\n
|
|
44
|
-
test.use({
|
|
45
|
-
$test: ({}, use) => use(test),
|
|
46
|
-
$tags: ({}, use, testInfo) => use(${JSON.stringify($tags)} \n [testInfo.titlePath.slice(2).join("|")] || [])
|
|
47
|
-
})
|
|
48
|
-
\n
|
|
49
|
-
${backgroundScenario}
|
|
50
|
-
\n
|
|
51
|
-
${testCase.join('')}
|
|
52
|
-
`;
|
|
53
|
-
}
|
|
54
|
-
function testBackGround(backgroundSteps, inputs) {
|
|
55
|
-
return ` test.beforeEach(async ({${inputs.join(',')}}) => { \n
|
|
56
|
-
${backgroundSteps.join(`\n`)}
|
|
57
|
-
});`;
|
|
58
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.allowedTags = allowedTags;
|
|
7
|
-
exports.expressionHandle = expressionHandle;
|
|
8
|
-
var _tagProcessor = require("../../core/playwright/tag-processor");
|
|
9
|
-
const editionOrder = ['Free', 'Express', 'Standard', 'Professional', 'Enterprise'];
|
|
10
|
-
function allowedTags(userArgs) {
|
|
11
|
-
let tags = (userArgs === null || userArgs === void 0 ? void 0 : userArgs.tags) || null;
|
|
12
|
-
if (tags !== null) {
|
|
13
|
-
if (Array.isArray(tags)) {
|
|
14
|
-
return buildGrepTags(tags, '|');
|
|
15
|
-
}
|
|
16
|
-
return tags;
|
|
17
|
-
}
|
|
18
|
-
let edition = (userArgs === null || userArgs === void 0 ? void 0 : userArgs.edition) || null;
|
|
19
|
-
if (edition !== null) {
|
|
20
|
-
const editionFrmCli = edition.split(',');
|
|
21
|
-
if (editionFrmCli.length === 1) {
|
|
22
|
-
// const sortedEdition = editionPreprocessing(editionOrder,editionFrmCli)
|
|
23
|
-
return (0, _tagProcessor.buildEditionTags)(expressionHandle(editionFrmCli, editionOrder), '|');
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
function buildGrepTags(tags, operator) {
|
|
29
|
-
return tags.join(`${operator}`);
|
|
30
|
-
}
|
|
31
|
-
function expressionHandle(editionFrmCli, editionOrder) {
|
|
32
|
-
var expression;
|
|
33
|
-
var $edition;
|
|
34
|
-
if (editionFrmCli.split('=').length !== 1) {
|
|
35
|
-
expression = editionFrmCli.split('').slice(0, 2).join('');
|
|
36
|
-
$edition = editionFrmCli.split('=').pop();
|
|
37
|
-
} else if (editionFrmCli.split('>').length !== 1) {
|
|
38
|
-
expression = editionFrmCli.split('').slice(0, 1).join('');
|
|
39
|
-
$edition = editionFrmCli.split('>').pop();
|
|
40
|
-
} else {
|
|
41
|
-
expression = editionFrmCli.split('').slice(0, 1).join('');
|
|
42
|
-
$edition = editionFrmCli.split('<').pop();
|
|
43
|
-
}
|
|
44
|
-
const index_Edition = editionOrder.indexOf($edition);
|
|
45
|
-
switch (expression) {
|
|
46
|
-
case '>=':
|
|
47
|
-
if ($edition == editionOrder[editionOrder.length - 1]) {
|
|
48
|
-
return editionOrder[editionOrder.length - 1];
|
|
49
|
-
}
|
|
50
|
-
return editionOrder.slice(0, index_Edition);
|
|
51
|
-
case '<=':
|
|
52
|
-
if ($edition == editionOrder[0]) {
|
|
53
|
-
return editionOrder.slice(1, editionOrder.length + 1);
|
|
54
|
-
}
|
|
55
|
-
return editionOrder.slice(index_Edition + 1, editionOrder.length + 1);
|
|
56
|
-
case '<':
|
|
57
|
-
if ($edition == editionOrder[0]) {
|
|
58
|
-
return editionOrder;
|
|
59
|
-
}
|
|
60
|
-
return editionOrder.slice(index_Edition, editionOrder.length + 1);
|
|
61
|
-
case '>':
|
|
62
|
-
if ($edition == editionOrder[editionOrder.length - 1]) {
|
|
63
|
-
return editionOrder;
|
|
64
|
-
}
|
|
65
|
-
return editionOrder.slice(0, index_Edition + 1);
|
|
66
|
-
default:
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,98 +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.testDataCreation = testDataCreation;
|
|
8
|
-
var _fastGlob = _interopRequireDefault(require("fast-glob"));
|
|
9
|
-
var _testStructure = require("./testStructure");
|
|
10
|
-
var _fileUtils = require("../../utils/fileUtils");
|
|
11
|
-
var _path = _interopRequireDefault(require("path"));
|
|
12
|
-
var _parserCucumber = _interopRequireDefault(require("./cucumber/parserCucumber"));
|
|
13
|
-
var _stringManipulation = require("../utils/stringManipulation");
|
|
14
|
-
var _getFilePath = require("../../utils/getFilePath");
|
|
15
|
-
async function testDataCreation() {
|
|
16
|
-
var exampleSteps = [];
|
|
17
|
-
const globalTestdata = new Map();
|
|
18
|
-
const actualStepFilePath = (0, _stringManipulation.filePathPattern)(_path.default.resolve('uat', 'modules', '**', '**', '**', '**', '**', '*.feature'), _getFilePath.isWindows);
|
|
19
|
-
await _fastGlob.default.globSync(actualStepFilePath, {
|
|
20
|
-
dot: true,
|
|
21
|
-
cwd: process.cwd()
|
|
22
|
-
}).forEach(filePath => {
|
|
23
|
-
var body, header;
|
|
24
|
-
var gherkinDocument = (0, _parserCucumber.default)((0, _fileUtils.readFileContents)(_path.default.resolve(process.cwd(), filePath), 'utf-8'));
|
|
25
|
-
gherkinDocument.feature.children.forEach($scenario => {
|
|
26
|
-
var _$scenario$scenario, _$scenario$scenario2;
|
|
27
|
-
const $currentScenario = {
|
|
28
|
-
currentArgument: '',
|
|
29
|
-
dataTableStep: '',
|
|
30
|
-
inputParameter: '',
|
|
31
|
-
input: false,
|
|
32
|
-
steptable: false,
|
|
33
|
-
scenarioTable: false
|
|
34
|
-
};
|
|
35
|
-
(_$scenario$scenario = $scenario.scenario) === null || _$scenario$scenario === void 0 || _$scenario$scenario.steps.forEach(step => {
|
|
36
|
-
var _step$dataTable;
|
|
37
|
-
const {
|
|
38
|
-
refactoredStep,
|
|
39
|
-
currentArgument
|
|
40
|
-
} = (0, _testStructure.extactStepArgs)(step.text);
|
|
41
|
-
if (Object.values(currentArgument).length && !$scenario.scenario.examples.length) {
|
|
42
|
-
$currentScenario.currentArgument = currentArgument;
|
|
43
|
-
$currentScenario.input = true;
|
|
44
|
-
} else {
|
|
45
|
-
globalTestdata.set(refactoredStep, {});
|
|
46
|
-
}
|
|
47
|
-
const dataTableStep = [];
|
|
48
|
-
step === null || step === void 0 || (_step$dataTable = step.dataTable) === null || _step$dataTable === void 0 || _step$dataTable.rows.forEach(cell => {
|
|
49
|
-
const Table = cell.cells.map(element => element.value);
|
|
50
|
-
dataTableStep.push(Table);
|
|
51
|
-
});
|
|
52
|
-
if (step.dataTable) {
|
|
53
|
-
$currentScenario.dataTableStep = dataTableStep;
|
|
54
|
-
$currentScenario.steptable = true;
|
|
55
|
-
}
|
|
56
|
-
globalTestdata.set(refactoredStep, Object.assign({}, $currentScenario));
|
|
57
|
-
});
|
|
58
|
-
if (typeof $scenario.background === Object) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if ((_$scenario$scenario2 = $scenario.scenario) !== null && _$scenario$scenario2 !== void 0 && (_$scenario$scenario2 = _$scenario$scenario2.examples) !== null && _$scenario$scenario2 !== void 0 && _$scenario$scenario2.length) {
|
|
62
|
-
var _$scenario$scenario3;
|
|
63
|
-
exampleSteps = $scenario.scenario.steps.map(element => (0, _testStructure.extactStepArgs)(element.text).refactoredStep);
|
|
64
|
-
(_$scenario$scenario3 = $scenario.scenario) === null || _$scenario$scenario3 === void 0 || _$scenario$scenario3.examples.map(example => {
|
|
65
|
-
var _example$tableHeader;
|
|
66
|
-
body = example === null || example === void 0 ? void 0 : example.tableBody.map(cell => {
|
|
67
|
-
return cell === null || cell === void 0 ? void 0 : cell.cells.map(example => example.value);
|
|
68
|
-
});
|
|
69
|
-
header = example === null || example === void 0 || (_example$tableHeader = example.tableHeader) === null || _example$tableHeader === void 0 ? void 0 : _example$tableHeader.cells.map(exampleHead => {
|
|
70
|
-
return exampleHead.value;
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
const inputParameter = testDataExtraction(header, body);
|
|
74
|
-
exampleSteps.forEach(step => {
|
|
75
|
-
$currentScenario.inputParameter = Object.assign([], inputParameter);
|
|
76
|
-
$currentScenario.scenarioTable = true;
|
|
77
|
-
globalTestdata.set(step, Object.assign({}, $currentScenario));
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
return globalTestdata;
|
|
83
|
-
}
|
|
84
|
-
function testDataExtraction(tableHeader, tableBody) {
|
|
85
|
-
const result = [];
|
|
86
|
-
if (tableBody && tableHeader) {
|
|
87
|
-
tableBody.forEach(array => {
|
|
88
|
-
const obj = {};
|
|
89
|
-
array.forEach((item, index) => {
|
|
90
|
-
obj[`${tableHeader[index].replace(/\s/g, '')}`] = item;
|
|
91
|
-
});
|
|
92
|
-
result.push(obj);
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
return [...result];
|
|
98
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.extactStepArgs = extactStepArgs;
|
|
7
|
-
exports.testSnippet = testSnippet;
|
|
8
|
-
var _stringManipulation = require("../utils/stringManipulation");
|
|
9
|
-
var _stepsnippets = require("./stepGenerate/stepsnippets");
|
|
10
|
-
function testSnippet(featureContent, featureFilePath) {
|
|
11
|
-
var _featureContent$featu;
|
|
12
|
-
var currentScenarios = [];
|
|
13
|
-
var $tags = {};
|
|
14
|
-
featureContent.scenarios.forEach(scenario => {
|
|
15
|
-
scenario.scenarioTags = [...scenario.scenarioTags, ...featureContent.featureTags];
|
|
16
|
-
$tags = Object.assign($tags, handleInputTags(scenario));
|
|
17
|
-
const _constructStep = scenarioSnippet(scenario);
|
|
18
|
-
currentScenarios.push(_constructStep);
|
|
19
|
-
});
|
|
20
|
-
if ((_featureContent$featu = featureContent.featureBackGround) !== null && _featureContent$featu !== void 0 && _featureContent$featu.length) {
|
|
21
|
-
return (0, _stepsnippets.testFile)(currentScenarios, featureFilePath, $tags, backgroundHandle(featureContent.featureBackGround));
|
|
22
|
-
}
|
|
23
|
-
return (0, _stepsnippets.testFile)(currentScenarios, featureFilePath, $tags);
|
|
24
|
-
}
|
|
25
|
-
function extactStepArgs(step) {
|
|
26
|
-
var inputParam = [];
|
|
27
|
-
var currentArgument = {};
|
|
28
|
-
var refactoredStep = step.replace(/"([^"]+)"/g, (match, word) => {
|
|
29
|
-
if (!isNaN(Number(word))) {
|
|
30
|
-
inputParam.push(word.toString());
|
|
31
|
-
return '{int}';
|
|
32
|
-
} else {
|
|
33
|
-
inputParam.push(word.toString());
|
|
34
|
-
return '{string}';
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
currentArgument = inputParam.map(inputs => `"${(0, _stringManipulation.removeAll)(inputs, ['<', '>'], /\s/g)}"`);
|
|
38
|
-
return {
|
|
39
|
-
refactoredStep,
|
|
40
|
-
currentArgument
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function scenarioSnippet(scenario) {
|
|
44
|
-
var currentStep = [];
|
|
45
|
-
var currentInputs = [];
|
|
46
|
-
scenario.steps.forEach(step => {
|
|
47
|
-
var {
|
|
48
|
-
refactoredStep,
|
|
49
|
-
currentArgument
|
|
50
|
-
} = extactStepArgs(step.stepDescription);
|
|
51
|
-
var input = inputsParamterMap.get(`'${refactoredStep}'`);
|
|
52
|
-
currentInputs.push(input);
|
|
53
|
-
currentStep.push((0, _stepsnippets.testStep)(step.keyword, refactoredStep, input, currentArgument.join(',')));
|
|
54
|
-
return;
|
|
55
|
-
});
|
|
56
|
-
const pageObject = browserObjectHandle(currentInputs);
|
|
57
|
-
return (0, _stepsnippets.testCase)(currentStep, scenario === null || scenario === void 0 ? void 0 : scenario.examples, scenario === null || scenario === void 0 ? void 0 : scenario.scenariodescription, pageObject, scenario.scenarioTags);
|
|
58
|
-
}
|
|
59
|
-
function browserObjectHandle(arrayofBrowserObjects) {
|
|
60
|
-
var browserInputs = [];
|
|
61
|
-
arrayofBrowserObjects.forEach(pageObject => {
|
|
62
|
-
browserinputs = [...browserInputs, ...(0, _stringManipulation.removeAll)(pageObject, ['{', '}']).split(',')];
|
|
63
|
-
});
|
|
64
|
-
return (0, _stringManipulation.avoidDuplicate)(browserInputs);
|
|
65
|
-
}
|
|
66
|
-
function handleInputTags(scenario) {
|
|
67
|
-
var _scenario$examples;
|
|
68
|
-
if (((_scenario$examples = scenario.examples) === null || _scenario$examples === void 0 ? void 0 : _scenario$examples.length) >= 1) {
|
|
69
|
-
var _tagsObjects = {};
|
|
70
|
-
scenario.examples.forEach(($ele, index) => {
|
|
71
|
-
var exampleDescription = Object.values($ele).map(val => {
|
|
72
|
-
return val.concat('-');
|
|
73
|
-
});
|
|
74
|
-
Object.assign(_tagsObjects, {
|
|
75
|
-
[exampleDescription.join('').concat(`Example-${index + 1}`)]: scenario.scenarioTags
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
return _tagsObjects;
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
[scenario.scenariodescription]: scenario.scenarioTags
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function backgroundHandle(background) {
|
|
85
|
-
const currentBackground = [];
|
|
86
|
-
const backgroundInput = [];
|
|
87
|
-
background.forEach(b_scenario => {
|
|
88
|
-
var {
|
|
89
|
-
refactoredStep,
|
|
90
|
-
currentArgument
|
|
91
|
-
} = extactStepArgs(b_scenario.stepDescription);
|
|
92
|
-
var input = inputsParamterMap.get(`'${refactoredStep}'`);
|
|
93
|
-
backgroundInput.push(input);
|
|
94
|
-
currentBackground.push((0, _stepsnippets.testStep)(b_scenario.keyword, refactoredStep, input, currentArgument.join(',')));
|
|
95
|
-
return;
|
|
96
|
-
});
|
|
97
|
-
return (0, _stepsnippets.testBackGround)(currentBackground, browserObjectHandle(backgroundInput));
|
|
98
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.avoidDuplicate = avoidDuplicate;
|
|
7
|
-
exports.filePathPattern = filePathPattern;
|
|
8
|
-
exports.removeAll = removeAll;
|
|
9
|
-
function removeAll(InputString, toRemove, regex = undefined, options = null) {
|
|
10
|
-
if (regex) {
|
|
11
|
-
InputString = InputString.replace(regex, '').trim();
|
|
12
|
-
}
|
|
13
|
-
toRemove.forEach(ele => {
|
|
14
|
-
InputString = InputString.replace(ele, '').trim();
|
|
15
|
-
});
|
|
16
|
-
return InputString;
|
|
17
|
-
}
|
|
18
|
-
function avoidDuplicate(arrayOfInputs) {
|
|
19
|
-
return [...new Set(arrayOfInputs)];
|
|
20
|
-
}
|
|
21
|
-
function filePathPattern(filePath, isWindows = true) {
|
|
22
|
-
if (isWindows) {
|
|
23
|
-
return filePath.split('\\').join('/');
|
|
24
|
-
}
|
|
25
|
-
return filePath;
|
|
26
|
-
}
|