@zohodesk/testinglibrary 0.1.8-stb-bdd-v5 → 0.1.8-stb-bdd-v7
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/core-runner/exportMethods.js +3 -1
- package/build/bdd-poc/core-runner/stepDefinitions.js +3 -1
- package/build/bdd-poc/test/cucumber/featureFileParer.js +3 -5
- package/build/bdd-poc/test/stepGenerate/stepFileGenerate.js +1 -1
- package/build/bdd-poc/test/tagsHandle.js +69 -68
- package/build/bdd-poc/test/testDataMap.js +5 -2
- package/build/core/playwright/builtInFixtures/index.js +5 -2
- package/build/core/playwright/setup/config-creator.js +1 -1
- package/build/core/playwright/tag-processor.js +20 -6
- package/build/core/playwright/test-runner.js +23 -12
- package/package.json +1 -1
|
@@ -42,11 +42,13 @@ function getInputArray(description, argument) {
|
|
|
42
42
|
const $When = $Given;
|
|
43
43
|
const $And = $Given;
|
|
44
44
|
const $Then = $Given;
|
|
45
|
+
const $Step = $Given;
|
|
45
46
|
function createNativeBDD() {
|
|
46
47
|
return {
|
|
47
48
|
$Given,
|
|
48
49
|
$When,
|
|
49
50
|
$And,
|
|
50
|
-
$Then
|
|
51
|
+
$Then,
|
|
52
|
+
$Step
|
|
51
53
|
};
|
|
52
54
|
}
|
|
@@ -71,14 +71,12 @@ function testDataExtraction(tableHeader, tableBody) {
|
|
|
71
71
|
const result = [];
|
|
72
72
|
if (tableBody && tableHeader) {
|
|
73
73
|
tableBody.forEach(array => {
|
|
74
|
-
const
|
|
74
|
+
const InputObject = {};
|
|
75
75
|
array.forEach((item, index) => {
|
|
76
|
-
|
|
76
|
+
InputObject[`<${tableHeader[index]}>`] = item;
|
|
77
77
|
});
|
|
78
|
-
result.push(
|
|
78
|
+
result.push(InputObject);
|
|
79
79
|
});
|
|
80
|
-
} else {
|
|
81
|
-
return;
|
|
82
80
|
}
|
|
83
81
|
return result;
|
|
84
82
|
}
|
|
@@ -19,7 +19,7 @@ function stepFileCreation(featureContent, stepFilename, featureFilePath) {
|
|
|
19
19
|
}
|
|
20
20
|
async function generateSpecFiles() {
|
|
21
21
|
const featureFilePattern = (0, _pathConfig.getFeatureFilePath)();
|
|
22
|
-
const generatedFolderPath = _path.default.resolve(process.cwd(), 'uat', 'feature-gen');
|
|
22
|
+
const generatedFolderPath = _path.default.resolve(process.cwd(), 'uat', '.feature-gen');
|
|
23
23
|
if (!(0, _fileUtils.checkIfFileExists)(generatedFolderPath)) {
|
|
24
24
|
(0, _fileUtils.createFolderSync)(generatedFolderPath, {
|
|
25
25
|
recursive: true
|
|
@@ -1,69 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
// const editionOrder = ['Free','Express','Standard','Professional','Enterprise']
|
|
2
|
+
// import { buildEditionTags} from '../../core/playwright/tag-processor'
|
|
3
|
+
// function allowedTags(userArgs){
|
|
4
|
+
// let tags = userArgs?.tags || null
|
|
5
|
+
// if(tags){
|
|
6
|
+
// if(Array.isArray(tags)){
|
|
7
|
+
// return buildGrepTags(tags,'|')
|
|
8
|
+
// }
|
|
9
|
+
// return tags;
|
|
10
|
+
// }
|
|
11
|
+
// let edition = userArgs?.edition || null
|
|
12
|
+
// if(edition){
|
|
13
|
+
// const editionFrmCli = edition.split(',')
|
|
14
|
+
// if(editionFrmCli.length === 1){
|
|
15
|
+
// // const sortedEdition = editionPreprocessing(editionOrder,editionFrmCli)
|
|
16
|
+
// return buildEditionTags(expressionHandle(editionFrmCli,editionOrder),'|')
|
|
17
|
+
// }
|
|
18
|
+
// }
|
|
19
|
+
// return;
|
|
20
|
+
// }
|
|
2
21
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
}
|
|
22
|
+
// function buildGrepTags(tags,operator){
|
|
23
|
+
// return tags.join(`${operator}`)
|
|
24
|
+
// }
|
|
25
|
+
|
|
26
|
+
// function expressionHandle(editionFrmCli,editionOrder){
|
|
27
|
+
// var expression;
|
|
28
|
+
// var $edition;
|
|
29
|
+
// if(editionFrmCli.split('=').length !== 1){
|
|
30
|
+
// expression = editionFrmCli.split('').slice(0,2).join('');
|
|
31
|
+
// $edition = editionFrmCli.split('=').pop()
|
|
32
|
+
// }else if(editionFrmCli.split('>').length !== 1){
|
|
33
|
+
// expression = editionFrmCli.split('').slice(0,1).join('');
|
|
34
|
+
// $edition = editionFrmCli.split('>').pop()
|
|
35
|
+
// }else {
|
|
36
|
+
// expression = editionFrmCli.split('').slice(0,1).join('');
|
|
37
|
+
// $edition = editionFrmCli.split('<').pop()
|
|
38
|
+
// }
|
|
39
|
+
// const index_Edition = editionOrder.indexOf($edition)
|
|
40
|
+
// switch(expression){
|
|
41
|
+
// case '>=':
|
|
42
|
+
// if($edition == editionOrder[editionOrder.length-1]){
|
|
43
|
+
// return editionOrder[editionOrder.length-1]
|
|
44
|
+
// }
|
|
45
|
+
// return editionOrder.slice(0,index_Edition);
|
|
46
|
+
// case '<=':
|
|
47
|
+
// if($edition == editionOrder[0]){
|
|
48
|
+
// return editionOrder.slice(1,editionOrder.length + 1)
|
|
49
|
+
// }
|
|
50
|
+
// return editionOrder.slice(index_Edition+1,editionOrder.length+1);
|
|
51
|
+
// case '<':
|
|
52
|
+
// if($edition == editionOrder[0]){
|
|
53
|
+
// return editionOrder;
|
|
54
|
+
// }
|
|
55
|
+
// return editionOrder.slice(index_Edition, editionOrder.length + 1);
|
|
56
|
+
// case '>':
|
|
57
|
+
// if($edition == editionOrder[editionOrder.length-1]){
|
|
58
|
+
// return editionOrder;
|
|
59
|
+
// }
|
|
60
|
+
// return editionOrder.slice(0,index_Edition+1);
|
|
61
|
+
// default:
|
|
62
|
+
// break;
|
|
63
|
+
// }
|
|
64
|
+
// }
|
|
65
|
+
|
|
66
|
+
// export {
|
|
67
|
+
// allowedTags,
|
|
68
|
+
// expressionHandle
|
|
69
|
+
// }
|
|
70
|
+
"use strict";
|
|
@@ -33,7 +33,10 @@ function testDataCreation() {
|
|
|
33
33
|
scenarioTable: false
|
|
34
34
|
};
|
|
35
35
|
if ($scenario !== null && $scenario !== void 0 && $scenario.background) {
|
|
36
|
-
$scenario.scenario =
|
|
36
|
+
$scenario.scenario = {
|
|
37
|
+
...$scenario.background,
|
|
38
|
+
examples: []
|
|
39
|
+
};
|
|
37
40
|
}
|
|
38
41
|
(_$scenario$scenario = $scenario.scenario) === null || _$scenario$scenario === void 0 || _$scenario$scenario.steps.forEach(step => {
|
|
39
42
|
var _step$dataTable;
|
|
@@ -52,7 +55,7 @@ function testDataCreation() {
|
|
|
52
55
|
const Table = cell.cells.map(element => element.value);
|
|
53
56
|
dataTableStep.push(Table);
|
|
54
57
|
});
|
|
55
|
-
if (step.dataTable) {
|
|
58
|
+
if (step !== null && step !== void 0 && step.dataTable) {
|
|
56
59
|
$currentScenario.dataTableStep = dataTableStep;
|
|
57
60
|
$currentScenario.steptable = true;
|
|
58
61
|
}
|
|
@@ -10,6 +10,9 @@ var _context = _interopRequireDefault(require("./context"));
|
|
|
10
10
|
var _cacheLayer = _interopRequireDefault(require("./cacheLayer"));
|
|
11
11
|
// import addTags from './addTags';
|
|
12
12
|
|
|
13
|
+
const addTags = {
|
|
14
|
+
$tags: ({}, use) => use([])
|
|
15
|
+
};
|
|
13
16
|
function getBuiltInFixtures(bddMode) {
|
|
14
17
|
let builtInFixtures = {
|
|
15
18
|
..._page.default,
|
|
@@ -18,8 +21,8 @@ function getBuiltInFixtures(bddMode) {
|
|
|
18
21
|
};
|
|
19
22
|
if (bddMode) {
|
|
20
23
|
builtInFixtures = {
|
|
21
|
-
...builtInFixtures
|
|
22
|
-
|
|
24
|
+
...builtInFixtures,
|
|
25
|
+
...addTags
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
28
|
return builtInFixtures;
|
|
@@ -34,7 +34,7 @@ const projects = (0, _configUtils.getProjects)({
|
|
|
34
34
|
viewport
|
|
35
35
|
});
|
|
36
36
|
// const testDir = getTestDir(bddMode, process.cwd(), { featureFilesFolder, stepDefinitionsFolder });
|
|
37
|
-
const testDir = _path.default.resolve(process.cwd(), 'uat', 'feature-gen');
|
|
37
|
+
const testDir = _path.default.resolve(process.cwd(), 'uat', '.feature-gen');
|
|
38
38
|
const testOptions = (0, _configUtils.getTestUseOptions)({
|
|
39
39
|
trace,
|
|
40
40
|
video,
|
|
@@ -10,7 +10,11 @@ var _logger = require("../../utils/logger");
|
|
|
10
10
|
/* eslint-disable dot-notation */
|
|
11
11
|
|
|
12
12
|
function getTagsString(tags, editionTags) {
|
|
13
|
-
return
|
|
13
|
+
return {
|
|
14
|
+
tags: tags || null,
|
|
15
|
+
editionTags: editionTags || null
|
|
16
|
+
};
|
|
17
|
+
// return tags && tags !== '' ? `${tags} and not (${editionTags})` : `not (${editionTags})`;
|
|
14
18
|
}
|
|
15
19
|
function getEdition(edition) {
|
|
16
20
|
if (edition.startsWith('<=')) {
|
|
@@ -49,22 +53,32 @@ function buildEditionTags(editionArgs, operator) {
|
|
|
49
53
|
return editionArgs.map(edition => `@edition_${edition}`).join(` ${operator} `);
|
|
50
54
|
}
|
|
51
55
|
function tagProcessor(userArgsObject, editionOrder) {
|
|
56
|
+
let filteredTags;
|
|
52
57
|
let tagArgs = userArgsObject['tags'];
|
|
58
|
+
let multiTags = userArgsObject['tags'];
|
|
59
|
+
if (multiTags.split(',').length >= 2) {
|
|
60
|
+
tagArgs = buildEditionTags(multiTags.split(','), '|');
|
|
61
|
+
}
|
|
53
62
|
const edition = userArgsObject['edition'] || null;
|
|
54
63
|
if (edition !== null) {
|
|
55
64
|
let editionsArray = edition.split(',');
|
|
56
65
|
if (editionsArray.length === 1) {
|
|
57
66
|
const editionArgs = editionPreprocessing(editionOrder, edition);
|
|
58
67
|
if (editionArgs && editionArgs.length > 0) {
|
|
59
|
-
const editionTags = buildEditionTags(editionArgs, '
|
|
60
|
-
|
|
68
|
+
const editionTags = buildEditionTags(editionArgs, '|');
|
|
69
|
+
filteredTags = getTagsString(tagArgs, editionTags);
|
|
61
70
|
}
|
|
62
71
|
} else {
|
|
63
72
|
// More than one edition given
|
|
64
73
|
const filteredEditions = editionOrder.filter(edition => !editionsArray.includes(edition));
|
|
65
|
-
const editionTags = buildEditionTags(filteredEditions, '
|
|
66
|
-
|
|
74
|
+
const editionTags = buildEditionTags(filteredEditions, '|');
|
|
75
|
+
filteredTags = getTagsString(tagArgs, editionTags);
|
|
67
76
|
}
|
|
77
|
+
} else {
|
|
78
|
+
filteredTags = {
|
|
79
|
+
tags: tagArgs,
|
|
80
|
+
editionTags: []
|
|
81
|
+
};
|
|
68
82
|
}
|
|
69
|
-
return
|
|
83
|
+
return filteredTags;
|
|
70
84
|
}
|
|
@@ -15,7 +15,8 @@ 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
|
-
|
|
18
|
+
// import { allowedTags } from '../../bdd-poc/test/tagsHandle';
|
|
19
|
+
|
|
19
20
|
function parseUserArgs() {
|
|
20
21
|
return (0, _cliArgsToObject.cliArgsToObject)(process.argv.slice(2));
|
|
21
22
|
}
|
|
@@ -24,9 +25,25 @@ function getPlaywrightArgs(userArgsObject, debug, bddMode, tagArgs, headless) {
|
|
|
24
25
|
if (debug) {
|
|
25
26
|
playwrightArgs.push('--debug');
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
|
|
29
|
+
// if (!bddMode && tagArgs) {
|
|
30
|
+
// playwrightArgs.push('--grep');
|
|
31
|
+
// playwrightArgs.push(tagArgs);
|
|
32
|
+
// }
|
|
33
|
+
|
|
34
|
+
if (tagArgs && userArgsObject !== null && userArgsObject !== void 0 && userArgsObject.edition || userArgsObject !== null && userArgsObject !== void 0 && userArgsObject.tags) {
|
|
35
|
+
const {
|
|
36
|
+
tags,
|
|
37
|
+
editionTags
|
|
38
|
+
} = tagArgs;
|
|
39
|
+
if (tags) {
|
|
40
|
+
playwrightArgs.push('--grep');
|
|
41
|
+
playwrightArgs.push(tags);
|
|
42
|
+
}
|
|
43
|
+
if (editionTags) {
|
|
44
|
+
playwrightArgs.push('--grep-invert');
|
|
45
|
+
playwrightArgs.push(editionTags);
|
|
46
|
+
}
|
|
30
47
|
}
|
|
31
48
|
if (!headless && !userArgsObject.headed) {
|
|
32
49
|
playwrightArgs.push('--headed');
|
|
@@ -101,6 +118,8 @@ function main() {
|
|
|
101
118
|
editionOrder
|
|
102
119
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
103
120
|
const tagArgs = (0, _tagProcessor.tagProcessor)(userArgsObject, editionOrder);
|
|
121
|
+
// const tagArgs = allowedTags(userArgsObject)
|
|
122
|
+
|
|
104
123
|
const playwrightArgs = getPlaywrightArgs(userArgsObject, debug, bddMode, tagArgs, headless);
|
|
105
124
|
(0, _envInitializer.initializeEnvConfig)(userArgsObject.mode ? userArgsObject.mode : mode);
|
|
106
125
|
const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('playwright'));
|
|
@@ -109,14 +128,6 @@ function main() {
|
|
|
109
128
|
let promises = [];
|
|
110
129
|
if (bddMode) {
|
|
111
130
|
promises.push((0, _bddPoc.createCucumberBDD)());
|
|
112
|
-
if (userArgsObject !== null && userArgsObject !== void 0 && userArgsObject.edition || userArgsObject !== null && userArgsObject !== void 0 && userArgsObject.tags) {
|
|
113
|
-
if (userArgsObject !== null && userArgsObject !== void 0 && userArgsObject.edition) {
|
|
114
|
-
playwrightArgs.push('--grep-invert');
|
|
115
|
-
} else {
|
|
116
|
-
playwrightArgs.push('--grep');
|
|
117
|
-
}
|
|
118
|
-
playwrightArgs.push((0, _tagsHandle.allowedTags)(userArgsObject));
|
|
119
|
-
}
|
|
120
131
|
}
|
|
121
132
|
const args = ['test', '--config', configPath].concat(playwrightArgs);
|
|
122
133
|
Promise.all(promises).then(() => runPlaywright(command, args)).catch(err => {
|