@zohodesk/testinglibrary 0.1.8-stb-bdd-v1 → 0.1.8-stb-bdd-v3
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.
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.getFeatureFilePath = getFeatureFilePath;
|
|
7
8
|
exports.getStepFilePath = getStepFilePath;
|
|
8
|
-
var _readConfigFile = require("
|
|
9
|
+
var _readConfigFile = require("../../core/playwright/readConfigFile");
|
|
9
10
|
var _getFilePath = require("../../utils/getFilePath");
|
|
10
11
|
var _stringManipulation = require("../utils/stringManipulation");
|
|
12
|
+
var _path = _interopRequireDefault(require("path"));
|
|
11
13
|
const {
|
|
12
14
|
featureFilesFolder,
|
|
13
15
|
stepDefinitionsFolder
|
|
14
16
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
15
17
|
function getFeatureFilePath() {
|
|
16
|
-
return (0, _stringManipulation.filePathPattern)(
|
|
18
|
+
return (0, _stringManipulation.filePathPattern)(_path.default.resolve(process.cwd(), 'uat', 'modules', '**', '**', featureFilesFolder, '**', '**', '**', '**', '**', '*.feature'), _getFilePath.isWindows);
|
|
17
19
|
}
|
|
18
20
|
function getStepFilePath() {
|
|
19
|
-
return (0, _stringManipulation.filePathPattern)(
|
|
21
|
+
return (0, _stringManipulation.filePathPattern)(_path.default.resolve(process.cwd(), 'uat', 'modules', '**', '**', stepDefinitionsFolder, '**', '**', '**', '**', '**', '*.spec.js'), _getFilePath.isWindows);
|
|
20
22
|
}
|
|
@@ -11,7 +11,7 @@ exports.testStep = testStep;
|
|
|
11
11
|
exports.testSuite = testSuite;
|
|
12
12
|
const TESTING_LIBRARY = exports.TESTING_LIBRARY = '@zohodesk/testinglibrary';
|
|
13
13
|
function testStep(keyword, description, browserObject, testData, options) {
|
|
14
|
-
return `await $${keyword}('${description}')(${browserObject},${testData})
|
|
14
|
+
return `await $${keyword}('${description}')(${browserObject},${testData})`;
|
|
15
15
|
}
|
|
16
16
|
function testSuite(description, scenariotestBlock, tags, options = null) {
|
|
17
17
|
return `\ntest.describe('${description}${tags.join(" ")}', () => {
|
|
@@ -40,14 +40,12 @@ function testFile(testCase, relativeFilePath, $tags, backgroundScenario = " ", o
|
|
|
40
40
|
return ` // ${relativeFilePath}
|
|
41
41
|
import { test, createNativeBDD } from "${TESTING_LIBRARY}";
|
|
42
42
|
const {$Given,$When,$Then,$And} = createNativeBDD()
|
|
43
|
-
\n
|
|
44
43
|
test.use({
|
|
45
44
|
$test: ({}, use) => use(test),
|
|
46
|
-
$tags: ({}, use, testInfo) => use(${JSON.stringify($tags)}
|
|
45
|
+
$tags: ({}, use, testInfo) => use(${JSON.stringify($tags)}
|
|
46
|
+
[testInfo.titlePath.slice(2).join("|")] || [])
|
|
47
47
|
})
|
|
48
|
-
\n
|
|
49
48
|
${backgroundScenario}
|
|
50
|
-
\n
|
|
51
49
|
${testCase.join('')}
|
|
52
50
|
`;
|
|
53
51
|
}
|
|
@@ -106,10 +106,9 @@ function main() {
|
|
|
106
106
|
const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('playwright'));
|
|
107
107
|
const command = playwrightPath;
|
|
108
108
|
const configPath = (0, _readConfigFile.isUserConfigFileAvailable)() ? require.resolve('./setup/config-creator.js') : require.resolve('../../../playwright.config.js');
|
|
109
|
-
const args = ['test', '--config', configPath].concat(playwrightArgs);
|
|
110
109
|
let promises = [];
|
|
111
110
|
if (bddMode) {
|
|
112
|
-
(0, _bddPoc.createCucumberBDD)();
|
|
111
|
+
promises.push((0, _bddPoc.createCucumberBDD)());
|
|
113
112
|
if (userArgsObject !== null && userArgsObject !== void 0 && userArgsObject.edition || userArgsObject !== null && userArgsObject !== void 0 && userArgsObject.tags) {
|
|
114
113
|
if (userArgsObject !== null && userArgsObject !== void 0 && userArgsObject.edition) {
|
|
115
114
|
playwrightArgs.push('--grep-invert');
|
|
@@ -118,8 +117,8 @@ function main() {
|
|
|
118
117
|
}
|
|
119
118
|
playwrightArgs.push((0, _tagsHandle.allowedTags)(userArgsObject));
|
|
120
119
|
}
|
|
121
|
-
// promises.push(runPreprocessing(tagArgs, configPath));
|
|
122
120
|
}
|
|
121
|
+
const args = ['test', '--config', configPath].concat(playwrightArgs);
|
|
123
122
|
Promise.all(promises).then(() => runPlaywright(command, args)).catch(err => {
|
|
124
123
|
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, err);
|
|
125
124
|
process.exit();
|