@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
|
@@ -9,8 +9,7 @@ var _test = require("@playwright/test");
|
|
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
|
10
10
|
var _readConfigFile = require("../readConfigFile");
|
|
11
11
|
var _configUtils = require("./config-utils");
|
|
12
|
-
|
|
13
|
-
var _runner = require("../../../bdd-poc/core-runner/runner");
|
|
12
|
+
const defaultCIBrowsers = ['Chrome', 'Firefox', 'Edge', 'Safari'];
|
|
14
13
|
const {
|
|
15
14
|
browsers,
|
|
16
15
|
trace,
|
|
@@ -23,18 +22,23 @@ const {
|
|
|
23
22
|
testTimeout,
|
|
24
23
|
authFilePath,
|
|
25
24
|
viewport,
|
|
25
|
+
featureFilesFolder,
|
|
26
|
+
stepDefinitionsFolder,
|
|
26
27
|
testIdAttribute
|
|
27
28
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
29
|
+
const browserList = process.env.mode === 'ci' ? defaultCIBrowsers : browsers;
|
|
28
30
|
const projects = (0, _configUtils.getProjects)({
|
|
29
|
-
browsers,
|
|
31
|
+
browsers: browserList,
|
|
30
32
|
isAuthMode,
|
|
31
33
|
authFilePath,
|
|
32
34
|
expectTimeout,
|
|
33
35
|
testTimeout,
|
|
34
36
|
viewport
|
|
35
37
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
const testDir = (0, _configUtils.getTestDir)(bddMode, process.cwd(), {
|
|
39
|
+
featureFilesFolder,
|
|
40
|
+
stepDefinitionsFolder
|
|
41
|
+
});
|
|
38
42
|
const testOptions = (0, _configUtils.getTestUseOptions)({
|
|
39
43
|
trace,
|
|
40
44
|
video,
|
|
@@ -42,17 +46,12 @@ const testOptions = (0, _configUtils.getTestUseOptions)({
|
|
|
42
46
|
testIdAttribute
|
|
43
47
|
});
|
|
44
48
|
|
|
45
|
-
/**
|
|
46
|
-
* Playwright configuration object
|
|
47
|
-
*
|
|
48
|
-
* @returns {import('@playwright/test').PlaywrightTestConfig}
|
|
49
|
+
/**
|
|
50
|
+
* Playwright configuration object
|
|
51
|
+
*
|
|
52
|
+
* @returns {import('@playwright/test').PlaywrightTestConfig}
|
|
49
53
|
*/
|
|
50
54
|
function getPlaywrightConfig() {
|
|
51
|
-
globalThis.globalStepMap = new Map();
|
|
52
|
-
(0, _runner.stepFileMap)();
|
|
53
|
-
(0, _testDataMap.testDataCreation)().then(inputs => {
|
|
54
|
-
globalThis.globalTestdata = inputs;
|
|
55
|
-
});
|
|
56
55
|
return {
|
|
57
56
|
testDir,
|
|
58
57
|
outputDir: _path.default.join(process.cwd(), 'uat', 'test-results'),
|
|
@@ -4,16 +4,19 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.getBrowsersList = getBrowsersList;
|
|
7
8
|
exports.getProjects = getProjects;
|
|
9
|
+
exports.getTestDir = getTestDir;
|
|
8
10
|
exports.getTestUseOptions = getTestUseOptions;
|
|
9
11
|
var _test = require("@playwright/test");
|
|
10
12
|
var _path = _interopRequireDefault(require("path"));
|
|
11
13
|
var _readConfigFile = require("../readConfigFile");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
var _bddFramework = require("../../../bdd-framework");
|
|
15
|
+
var _logger = require("../../../utils/logger");
|
|
16
|
+
var _browserTypes = require("../constants/browserTypes");
|
|
17
|
+
/**
|
|
18
|
+
** Playwright project configuration
|
|
19
|
+
* @returns {import('@playwright/test').Project}
|
|
17
20
|
*/
|
|
18
21
|
function getBrowserConfig({
|
|
19
22
|
browserName,
|
|
@@ -31,7 +34,7 @@ function getBrowserConfig({
|
|
|
31
34
|
const dependencies = isAuthMode ? ['setup'] : [];
|
|
32
35
|
if (browser === 'chrome') {
|
|
33
36
|
return {
|
|
34
|
-
name:
|
|
37
|
+
name: _browserTypes.BROWSER_PROJECT_MAPPING.CHROME,
|
|
35
38
|
use: {
|
|
36
39
|
..._test.devices['Desktop Chrome'],
|
|
37
40
|
...commonConfig
|
|
@@ -44,7 +47,7 @@ function getBrowserConfig({
|
|
|
44
47
|
};
|
|
45
48
|
} else if (browser === 'edge') {
|
|
46
49
|
return {
|
|
47
|
-
name:
|
|
50
|
+
name: _browserTypes.BROWSER_PROJECT_MAPPING.EDGE,
|
|
48
51
|
timeout: testTimeout,
|
|
49
52
|
expect: {
|
|
50
53
|
timeout: expectTimeout
|
|
@@ -58,7 +61,7 @@ function getBrowserConfig({
|
|
|
58
61
|
};
|
|
59
62
|
} else if (browser === 'firefox') {
|
|
60
63
|
return {
|
|
61
|
-
name:
|
|
64
|
+
name: _browserTypes.BROWSER_PROJECT_MAPPING.FIREFOX,
|
|
62
65
|
timeout: 2 * testTimeout,
|
|
63
66
|
expect: {
|
|
64
67
|
timeout: 2 * expectTimeout
|
|
@@ -71,7 +74,7 @@ function getBrowserConfig({
|
|
|
71
74
|
};
|
|
72
75
|
} else if (browser === 'safari') {
|
|
73
76
|
return {
|
|
74
|
-
name:
|
|
77
|
+
name: _browserTypes.BROWSER_PROJECT_MAPPING.SAFARI,
|
|
75
78
|
timeout: 4 * testTimeout,
|
|
76
79
|
expect: {
|
|
77
80
|
timeout: 4 * expectTimeout
|
|
@@ -87,10 +90,10 @@ function getBrowserConfig({
|
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
|
|
90
|
-
/**
|
|
91
|
-
*
|
|
92
|
-
* @param {*} param0
|
|
93
|
-
* @returns {import('@playwright/test').Project[]}
|
|
93
|
+
/**
|
|
94
|
+
*
|
|
95
|
+
* @param {*} param0
|
|
96
|
+
* @returns {import('@playwright/test').Project[]}
|
|
94
97
|
*/
|
|
95
98
|
function getProjects({
|
|
96
99
|
browsers,
|
|
@@ -109,19 +112,27 @@ function getProjects({
|
|
|
109
112
|
viewport
|
|
110
113
|
})).filter(Boolean);
|
|
111
114
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
115
|
+
function getBrowsersList(browserFromArgs) {
|
|
116
|
+
if (browserFromArgs) {
|
|
117
|
+
if (typeof browserFromArgs === 'string') {
|
|
118
|
+
let listOfbrowsers = browserFromArgs.split(',').map(browser => browser.trim().toLowerCase());
|
|
119
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Using browsers from command line args');
|
|
120
|
+
return listOfbrowsers;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return [];
|
|
124
|
+
}
|
|
125
|
+
function getTestDir(bddMode, cwd, {
|
|
126
|
+
stepDefinitionsFolder
|
|
127
|
+
}) {
|
|
128
|
+
return bddMode ? (0, _bddFramework.defineBddConfig)({
|
|
129
|
+
paths: [_path.default.join(cwd, 'uat', '**', '*.feature')],
|
|
130
|
+
import: [_path.default.join(cwd, 'uat', '**', stepDefinitionsFolder, '*.spec.js')],
|
|
131
|
+
featuresRoot: _path.default.join(cwd, 'uat'),
|
|
132
|
+
outputDir: _path.default.join(cwd, 'uat', '.features-gen'),
|
|
133
|
+
publish: true
|
|
134
|
+
}) : _path.default.join(cwd, 'uat');
|
|
135
|
+
}
|
|
125
136
|
function getTestUseOptions({
|
|
126
137
|
viewport,
|
|
127
138
|
trace,
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.buildEditionTags = buildEditionTags;
|
|
7
|
-
exports.editionPreprocessing = editionPreprocessing;
|
|
8
6
|
exports.tagProcessor = tagProcessor;
|
|
9
7
|
var _logger = require("../../utils/logger");
|
|
10
8
|
/* eslint-disable dot-notation */
|
|
@@ -30,11 +28,11 @@ function editionPreprocessing(editionOrder, selectedEdition) {
|
|
|
30
28
|
if (index !== -1) {
|
|
31
29
|
let resultArray;
|
|
32
30
|
if (operator === '<=') {
|
|
33
|
-
resultArray = editionOrder.slice(
|
|
31
|
+
resultArray = editionOrder.slice(index + 1);
|
|
34
32
|
} else if (operator === '>=') {
|
|
35
33
|
resultArray = editionOrder.slice(0, index);
|
|
36
34
|
} else if (operator === '<') {
|
|
37
|
-
resultArray = editionOrder.slice(
|
|
35
|
+
resultArray = editionOrder.slice(index);
|
|
38
36
|
} else if (operator === '>') {
|
|
39
37
|
resultArray = editionOrder.slice(0, index + 1);
|
|
40
38
|
} else {
|
|
@@ -14,12 +14,16 @@ var _logger = require("../../utils/logger");
|
|
|
14
14
|
var _readConfigFile = require("./readConfigFile");
|
|
15
15
|
var _rootPath = require("../../utils/rootPath");
|
|
16
16
|
var _tagProcessor = require("./tag-processor");
|
|
17
|
-
var
|
|
18
|
-
var
|
|
17
|
+
var _configUtils = require("./setup/config-utils");
|
|
18
|
+
var _browserTypes = require("./constants/browserTypes");
|
|
19
19
|
function parseUserArgs() {
|
|
20
20
|
return (0, _cliArgsToObject.cliArgsToObject)(process.argv.slice(2));
|
|
21
21
|
}
|
|
22
22
|
function getPlaywrightArgs(userArgsObject, debug, bddMode, tagArgs, headless) {
|
|
23
|
+
const {
|
|
24
|
+
browsers = null
|
|
25
|
+
} = userArgsObject;
|
|
26
|
+
let browserList = (0, _configUtils.getBrowsersList)(browsers);
|
|
23
27
|
const playwrightArgs = (0, _cliArgsToObject.objectToCliArgs)(userArgsObject, key => !_customCommands.CUSTOM_COMMANDS.includes(key));
|
|
24
28
|
if (debug) {
|
|
25
29
|
playwrightArgs.push('--debug');
|
|
@@ -31,38 +35,38 @@ function getPlaywrightArgs(userArgsObject, debug, bddMode, tagArgs, headless) {
|
|
|
31
35
|
if (!headless && !userArgsObject.headed) {
|
|
32
36
|
playwrightArgs.push('--headed');
|
|
33
37
|
}
|
|
38
|
+
if (browserList && browserList.length > 0) {
|
|
39
|
+
browserList.map(browser => playwrightArgs.push(`--project=${_browserTypes.BROWSER_PROJECT_MAPPING[browser.toUpperCase()]}`));
|
|
40
|
+
}
|
|
41
|
+
console.log(playwrightArgs);
|
|
34
42
|
return playwrightArgs;
|
|
35
43
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// });
|
|
63
|
-
// });
|
|
64
|
-
// }
|
|
65
|
-
|
|
44
|
+
function runPreprocessing(tagArgs, configPath) {
|
|
45
|
+
const beforeCommand = 'node';
|
|
46
|
+
const bddGenPath = _path.default.resolve(__dirname, '../', '../', 'bdd-framework', 'cli', 'index.js');
|
|
47
|
+
const beforeArgs = [bddGenPath, '-c', configPath];
|
|
48
|
+
if (tagArgs) {
|
|
49
|
+
beforeArgs.push('--tags');
|
|
50
|
+
beforeArgs.push(tagArgs);
|
|
51
|
+
}
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
53
|
+
const childProcessForPreprocessing = (0, _child_process.spawn)(beforeCommand, beforeArgs, {
|
|
54
|
+
stdio: 'inherit'
|
|
55
|
+
});
|
|
56
|
+
childProcessForPreprocessing.on('error', data => {
|
|
57
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, data);
|
|
58
|
+
reject();
|
|
59
|
+
});
|
|
60
|
+
childProcessForPreprocessing.on('exit', code => {
|
|
61
|
+
if (code === 0) {
|
|
62
|
+
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Feature Files Processed Successfully');
|
|
63
|
+
resolve();
|
|
64
|
+
} else {
|
|
65
|
+
reject(`BddGen exited with code ${code}`);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
66
70
|
function runPlaywright(command, args) {
|
|
67
71
|
return new Promise((resolve, reject) => {
|
|
68
72
|
const childProcessForRunningPlaywright = (0, _child_process.spawn)(command, args, {
|
|
@@ -109,16 +113,7 @@ function main() {
|
|
|
109
113
|
const args = ['test', '--config', configPath].concat(playwrightArgs);
|
|
110
114
|
let promises = [];
|
|
111
115
|
if (bddMode) {
|
|
112
|
-
(
|
|
113
|
-
if (userArgsObject !== null && userArgsObject !== void 0 && userArgsObject.edition || userArgsObject !== null && userArgsObject !== void 0 && userArgsObject.tags) {
|
|
114
|
-
if (userArgsObject !== null && userArgsObject !== void 0 && userArgsObject.edition) {
|
|
115
|
-
playwrightArgs.push('--grep-invert');
|
|
116
|
-
} else {
|
|
117
|
-
playwrightArgs.push('--grep');
|
|
118
|
-
}
|
|
119
|
-
playwrightArgs.push((0, _tagsHandle.allowedTags)(userArgsObject));
|
|
120
|
-
}
|
|
121
|
-
// promises.push(runPreprocessing(tagArgs, configPath));
|
|
116
|
+
promises.push(runPreprocessing(tagArgs, configPath));
|
|
122
117
|
}
|
|
123
118
|
Promise.all(promises).then(() => runPlaywright(command, args)).catch(err => {
|
|
124
119
|
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, err);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object|null} viewportConfig
|
|
3
|
+
* @property {number} width - width of the viewport
|
|
4
|
+
* @property {number} height - height of the viewport
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object|null} viewportConfig
|
|
8
|
+
* @property {number} width - width of the viewport
|
|
9
|
+
* @property {number} height - height of the viewport
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {Object|null} testSetupConfig
|
|
14
|
+
* @property {any} page - Function that will be called while setting up page fixtures
|
|
15
|
+
* @property {any} context - Function that will be called while setting up context fixtures
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Represents the user configuration object.
|
|
20
|
+
* @typedef {Object} UserConfig
|
|
21
|
+
* @property {string} uatDirectory - Directory in which uat configuration is places.
|
|
22
|
+
* @property {string} headless - Headless Browsers mode.
|
|
23
|
+
* @property {number} trace - trace for test cases.
|
|
24
|
+
* @property {boolean} video - video for test cases,
|
|
25
|
+
* @property {boolean} debug - debug mode
|
|
26
|
+
* @property {string} mode: mode in which the test cases needs to run
|
|
27
|
+
* @property {boolean} isAuthMode - Auth Mode. config whether authentication step needed before running test cases
|
|
28
|
+
* @property {string} authFilePath - File Path where the cookies stored
|
|
29
|
+
* @property {any} browsers: List of browsers
|
|
30
|
+
* @property {string} openReportOn: default Option value (never, on-failure and always)
|
|
31
|
+
* @property {any} reportPath : directory where report is generate
|
|
32
|
+
* @property {boolean} bddMode: Feature files needs to be processed
|
|
33
|
+
* @property {number} expectTimeout: time in milliseconds which the expect condition should fail
|
|
34
|
+
* @property {number} testTimeout: time in milliseconds which the test should fail
|
|
35
|
+
* @property {Object} additionalPages: custom pages configuration
|
|
36
|
+
* @property {string} featureFilesFolder: folder name under which feature-files will be placed. Default is feature-files
|
|
37
|
+
* @property {string} stepDefinitionsFolder: folder name under which step implementations will be placed. Default is steps
|
|
38
|
+
* @property {viewportConfig} viewport: viewport configuration for the browser. Default is { width: 1280, height: 720 }
|
|
39
|
+
* @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
|
|
40
|
+
* @property {Array} editionOrder: Order in the form of larger editions in the back. Edition with the most privelages should be last
|
|
41
|
+
* @property {testSetupConfig} testSetup: Specify page and context functions that will be called while intilaizing fixtures.
|
|
42
|
+
*/
|
|
43
|
+
"use strict";
|
package/build/decorators.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export * from './bdd-framework/decorators';
|
package/build/decorators.js
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _decorators = require("./bdd-framework/decorators");
|
|
7
|
+
Object.keys(_decorators).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _decorators[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _decorators[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
package/build/index.d.ts
CHANGED
|
@@ -1,60 +1,77 @@
|
|
|
1
|
-
import { expect, test
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
import { expect, test, accountLogin,
|
|
2
|
+
getListOfUsers,
|
|
3
|
+
getPrimaryUser,
|
|
4
|
+
getUserForSelectedEditionAndProfile,
|
|
5
|
+
isCI,
|
|
6
|
+
loadCookiesIfPresent,
|
|
7
|
+
performLoginSteps,
|
|
8
|
+
verifyIfCookieFileExists } from './core/playwright/index';
|
|
9
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
10
|
+
import {
|
|
11
|
+
PlaywrightTestArgs,
|
|
12
|
+
PlaywrightTestOptions,
|
|
13
|
+
PlaywrightWorkerArgs,
|
|
14
|
+
PlaywrightWorkerOptions,
|
|
15
|
+
TestType,
|
|
16
|
+
Page
|
|
17
|
+
} from '@playwright/test';
|
|
18
|
+
import { DefineStepPattern } from '@cucumber/cucumber/lib/support_code_library_builder/types';
|
|
19
|
+
|
|
20
|
+
export type KeyValue = { [key: string]: any };
|
|
21
|
+
|
|
22
|
+
export type BuiltInFixturesWorker = PlaywrightWorkerArgs &
|
|
23
|
+
PlaywrightWorkerOptions;
|
|
24
|
+
export type BuiltInFixtures = PlaywrightTestArgs &
|
|
25
|
+
PlaywrightTestOptions &
|
|
26
|
+
BuiltInFixturesWorker;
|
|
27
|
+
|
|
28
|
+
export type FixturesArg<T extends KeyValue = {}, W extends KeyValue = {}> = T &
|
|
29
|
+
W &
|
|
30
|
+
BuiltInFixtures;
|
|
31
|
+
|
|
32
|
+
export declare let hasCustomTest: boolean;
|
|
33
|
+
|
|
34
|
+
export declare function createBdd<
|
|
35
|
+
T extends KeyValue = BuiltInFixtures,
|
|
36
|
+
W extends KeyValue = BuiltInFixturesWorker,
|
|
37
|
+
World
|
|
38
|
+
>(
|
|
39
|
+
customTest?: TestType<T, W> | null,
|
|
40
|
+
_CustomWorld?: new (...args: any[]) => World
|
|
41
|
+
): {
|
|
42
|
+
Given: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
|
|
43
|
+
When: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
|
|
44
|
+
Then: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
|
|
45
|
+
And: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
|
|
46
|
+
But: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
|
|
47
|
+
Step: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
|
|
48
|
+
Before: any;
|
|
49
|
+
After: any;
|
|
50
|
+
BeforeAll: any;
|
|
51
|
+
AfterAll: any;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
type StepFunctionFixturesArg<
|
|
55
|
+
T extends KeyValue,
|
|
56
|
+
W extends KeyValue
|
|
57
|
+
> = FixturesArg<T, W>;
|
|
58
|
+
type StepFunction<T extends KeyValue, W extends KeyValue> = (
|
|
59
|
+
fixtures: StepFunctionFixturesArg<T, W>,
|
|
60
|
+
...args: any[]
|
|
61
|
+
) => unknown;
|
|
62
|
+
|
|
63
|
+
const { Given, Then, When, Step, And, But } = createBdd();
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
Given, Then, When, Step, And, But, expect, test,
|
|
68
|
+
createBdd, Page, accountLogin,
|
|
69
|
+
getListOfUsers,
|
|
70
|
+
getPrimaryUser,
|
|
71
|
+
getUserForSelectedEditionAndProfile,
|
|
72
|
+
isCI,
|
|
73
|
+
loadCookiesIfPresent,
|
|
74
|
+
performLoginSteps,
|
|
75
|
+
verifyIfCookieFileExists };
|
|
76
|
+
|
|
77
|
+
export * from '@playwright/test/types/test';
|
package/build/index.js
CHANGED
|
@@ -4,16 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.When = exports.Then = exports.Step = exports.Given = exports.But = exports.And = void 0;
|
|
7
|
-
Object.defineProperty(exports, "
|
|
7
|
+
Object.defineProperty(exports, "accountLogin", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function () {
|
|
10
|
-
return
|
|
10
|
+
return _index.accountLogin;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "createBdd", {
|
|
14
14
|
enumerable: true,
|
|
15
15
|
get: function () {
|
|
16
|
-
return
|
|
16
|
+
return _index.createBdd;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "expect", {
|
|
@@ -22,24 +22,66 @@ Object.defineProperty(exports, "expect", {
|
|
|
22
22
|
return _index.expect;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
+
Object.defineProperty(exports, "getListOfUsers", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _index.getListOfUsers;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "getPrimaryUser", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return _index.getPrimaryUser;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "getUserForSelectedEditionAndProfile", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _index.getUserForSelectedEditionAndProfile;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "isCI", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _index.isCI;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "loadCookiesIfPresent", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () {
|
|
52
|
+
return _index.loadCookiesIfPresent;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "performLoginSteps", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return _index.performLoginSteps;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
25
61
|
Object.defineProperty(exports, "test", {
|
|
26
62
|
enumerable: true,
|
|
27
63
|
get: function () {
|
|
28
64
|
return _index.test;
|
|
29
65
|
}
|
|
30
66
|
});
|
|
67
|
+
Object.defineProperty(exports, "verifyIfCookieFileExists", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return _index.verifyIfCookieFileExists;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
31
73
|
var _index = require("./core/playwright/index");
|
|
32
|
-
var _bddPoc = require("./bdd-poc");
|
|
33
74
|
// import { fireEvent, render } from '@testing-library/react';
|
|
75
|
+
|
|
34
76
|
const {
|
|
35
77
|
Given,
|
|
36
78
|
Then,
|
|
37
79
|
When,
|
|
38
|
-
|
|
39
|
-
} = (0,
|
|
40
|
-
exports.
|
|
80
|
+
Step
|
|
81
|
+
} = (0, _index.createBdd)();
|
|
82
|
+
exports.Step = Step;
|
|
41
83
|
exports.When = When;
|
|
42
84
|
exports.Then = Then;
|
|
43
85
|
exports.Given = Given;
|
|
44
|
-
const
|
|
86
|
+
const And = exports.And = Then;
|
|
45
87
|
const But = exports.But = Then;
|
package/build/lib/cli.js
CHANGED
|
@@ -12,9 +12,6 @@ var _helper = _interopRequireDefault(require("../setup-folder-structure/helper")
|
|
|
12
12
|
// import createJestRunner from '../core/jest/runner/jest-runner';
|
|
13
13
|
|
|
14
14
|
const [,, option, ...otherOptions] = process.argv;
|
|
15
|
-
// const args = process.argv.slice(3);
|
|
16
|
-
// const appPath = process.cwd();
|
|
17
|
-
|
|
18
15
|
switch (option) {
|
|
19
16
|
case 'test':
|
|
20
17
|
{
|
|
@@ -5,13 +5,18 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
5
5
|
var _child_process = require("child_process");
|
|
6
6
|
var _logger = require("../utils/logger");
|
|
7
7
|
var _rootPath = require("../utils/rootPath");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
// We are skipping the download of browsers when NODE_ENV is set to production or flag SKIP_BROWSER_DOWNLOAD is set to true
|
|
9
|
+
if (process.env.NODE_ENV !== 'production' || process.env.SKIP_BROWSER_DOWNLOAD === true) {
|
|
10
|
+
const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('playwright'));
|
|
11
|
+
const command = playwrightPath;
|
|
12
|
+
const args = ['install'];
|
|
13
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Downloading browsers for running tests');
|
|
14
|
+
const childProcess = (0, _child_process.spawn)(command, args, {
|
|
15
|
+
stdio: 'inherit'
|
|
16
|
+
});
|
|
17
|
+
childProcess.on('error', error => {
|
|
18
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, error);
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Skipping browsers download in production mode');
|
|
22
|
+
}
|