@zohodesk/testinglibrary 0.3.3-experimental → 0.3.5-experimental
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/README.md +10 -1
- package/build/bdd-framework/cli/commands/env.js +42 -0
- package/build/bdd-framework/cli/commands/export.js +62 -0
- package/build/bdd-framework/cli/commands/test.js +64 -0
- package/build/bdd-framework/cli/index.js +11 -0
- package/build/bdd-framework/cli/options.js +19 -0
- package/build/bdd-framework/cli/worker.js +13 -0
- package/build/bdd-framework/config/configDir.js +35 -0
- package/build/bdd-framework/config/enrichReporterData.js +23 -0
- package/build/bdd-framework/config/env.js +50 -0
- package/build/bdd-framework/config/index.js +94 -0
- package/build/bdd-framework/config/lang.js +14 -0
- package/build/bdd-framework/cucumber/buildStepDefinition.js +43 -0
- package/build/bdd-framework/cucumber/createTestStep.js +43 -0
- package/build/bdd-framework/cucumber/formatter/EventDataCollector.js +126 -0
- package/build/bdd-framework/cucumber/formatter/GherkinDocumentParser.js +72 -0
- package/build/bdd-framework/cucumber/formatter/PickleParser.js +25 -0
- package/build/bdd-framework/cucumber/formatter/durationHelpers.js +13 -0
- package/build/bdd-framework/cucumber/formatter/getColorFns.js +57 -0
- package/build/bdd-framework/cucumber/formatter/index.js +16 -0
- package/build/bdd-framework/cucumber/formatter/locationHelpers.js +16 -0
- package/build/bdd-framework/cucumber/loadConfig.js +17 -0
- package/build/bdd-framework/cucumber/loadFeatures.js +70 -0
- package/build/bdd-framework/cucumber/loadSnippetBuilder.js +20 -0
- package/build/bdd-framework/cucumber/loadSteps.js +47 -0
- package/build/bdd-framework/cucumber/resolveFeaturePaths.js +62 -0
- package/build/bdd-framework/cucumber/stepArguments.js +21 -0
- package/build/bdd-framework/cucumber/types.js +5 -0
- package/build/bdd-framework/cucumber/valueChecker.js +23 -0
- package/build/bdd-framework/decorators.js +18 -0
- package/build/bdd-framework/gen/fixtures.js +48 -0
- package/build/bdd-framework/gen/formatter.js +167 -0
- package/build/bdd-framework/gen/i18n.js +39 -0
- package/build/bdd-framework/gen/index.js +197 -0
- package/build/bdd-framework/gen/specialTags.js +70 -0
- package/build/bdd-framework/gen/testFile.js +470 -0
- package/build/bdd-framework/gen/testMeta.js +60 -0
- package/build/bdd-framework/gen/testNode.js +35 -0
- package/build/bdd-framework/gen/testPoms.js +133 -0
- package/build/bdd-framework/hooks/scenario.js +130 -0
- package/build/bdd-framework/hooks/worker.js +89 -0
- package/build/bdd-framework/index.js +52 -0
- package/build/bdd-framework/playwright/fixtureParameterNames.js +93 -0
- package/build/bdd-framework/playwright/getLocationInFile.js +79 -0
- package/build/bdd-framework/playwright/loadConfig.js +42 -0
- package/build/bdd-framework/playwright/loadUtils.js +33 -0
- package/build/bdd-framework/playwright/testTypeImpl.js +79 -0
- package/build/bdd-framework/playwright/transform.js +88 -0
- package/build/bdd-framework/playwright/types.js +12 -0
- package/build/bdd-framework/playwright/utils.js +56 -0
- package/build/bdd-framework/reporter/cucumber/base.js +52 -0
- package/build/bdd-framework/reporter/cucumber/custom.js +73 -0
- package/build/bdd-framework/reporter/cucumber/helper.js +12 -0
- package/build/bdd-framework/reporter/cucumber/html.js +40 -0
- package/build/bdd-framework/reporter/cucumber/index.js +74 -0
- package/build/bdd-framework/reporter/cucumber/json.js +312 -0
- package/build/bdd-framework/reporter/cucumber/junit.js +205 -0
- package/build/bdd-framework/reporter/cucumber/message.js +20 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/AttachmentMapper.js +82 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Builder.js +197 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocument.js +43 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocumentClone.js +52 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocuments.js +105 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Hook.js +70 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Meta.js +45 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Pickles.js +27 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Projects.js +38 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCase.js +128 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRun.js +154 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRunHooks.js +123 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepAttachments.js +67 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepRun.js +114 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/index.js +30 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/pwStepUtils.js +70 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/timing.js +35 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/types.js +5 -0
- package/build/bdd-framework/run/StepInvoker.js +69 -0
- package/build/bdd-framework/run/bddData/index.js +59 -0
- package/build/bdd-framework/run/bddData/types.js +5 -0
- package/build/bdd-framework/run/bddFixtures.js +192 -0
- package/build/bdd-framework/run/bddWorld.js +79 -0
- package/build/bdd-framework/run/bddWorldInternal.js +11 -0
- package/build/bdd-framework/snippets/index.js +132 -0
- package/build/bdd-framework/snippets/snippetSyntax.js +43 -0
- package/build/bdd-framework/snippets/snippetSyntaxDecorators.js +26 -0
- package/build/bdd-framework/snippets/snippetSyntaxTs.js +18 -0
- package/build/bdd-framework/stepDefinitions/createBdd.js +66 -0
- package/build/bdd-framework/stepDefinitions/decorators/class.js +68 -0
- package/build/bdd-framework/stepDefinitions/decorators/steps.js +99 -0
- package/build/bdd-framework/stepDefinitions/defineStep.js +62 -0
- package/build/bdd-framework/stepDefinitions/stepConfig.js +24 -0
- package/build/bdd-framework/steps/createBdd.js +78 -0
- package/build/bdd-framework/steps/decorators/class.js +68 -0
- package/build/bdd-framework/steps/decorators/steps.js +98 -0
- package/build/bdd-framework/steps/defineStep.js +62 -0
- package/build/bdd-framework/steps/stepConfig.js +24 -0
- package/build/bdd-framework/utils/AutofillMap.js +20 -0
- package/build/bdd-framework/utils/exit.js +62 -0
- package/build/bdd-framework/utils/index.js +93 -0
- package/build/bdd-framework/utils/jsStringWrap.js +44 -0
- package/build/bdd-framework/utils/logger.js +30 -0
- package/build/bdd-framework/utils/stripAnsiEscapes.js +20 -0
- package/build/core/playwright/configuration/Configuration.js +22 -0
- package/build/core/playwright/configuration/ConfigurationHelper.js +50 -0
- package/build/core/playwright/configuration/UserArgs.js +12 -0
- package/build/core/playwright/helpers/parseUserArgs.js +2 -3
- package/build/core/playwright/index.js +23 -10
- package/build/core/playwright/readConfigFile.js +11 -0
- package/build/core/playwright/setup/config-creator.js +3 -3
- package/build/core/playwright/setup/config-utils.js +25 -8
- package/build/core/playwright/setup/custom-reporter.js +39 -13
- package/build/core/playwright/test-runner.js +27 -11
- package/build/decorators.d.ts +1 -1
- package/build/decorators.js +1 -1
- package/build/test/Test.js +63 -0
- package/build/test/core/playwright/configuration/__tests__/Configuration.test.js +53 -0
- package/npm-shrinkwrap.json +2175 -5825
- package/package.json +5 -6
- package/build/core/playwright/fixtures.js +0 -24
- package/build/core/playwright/indexOld.js +0 -37
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _cliArgsToObject = require("../../../utils/cliArgsToObject");
|
|
4
|
+
class UserArgs {
|
|
5
|
+
static parseToObject(config) {
|
|
6
|
+
return (0, _cliArgsToObject.cliArgsToObject)(config);
|
|
7
|
+
}
|
|
8
|
+
static parseToArgs(object) {
|
|
9
|
+
return (0, _cliArgsToObject.objectToCliArgs)(object);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
module.exports = UserArgs;
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.parseUserArgs = parseUserArgs;
|
|
7
7
|
var _cliArgsToObject = require("../../../utils/cliArgsToObject");
|
|
8
8
|
function parseUserArgs() {
|
|
9
9
|
return (0, _cliArgsToObject.cliArgsToObject)(process.argv.slice(2));
|
|
10
|
-
}
|
|
11
|
-
var _default = exports.default = parseUserArgs;
|
|
10
|
+
}
|
|
@@ -1,24 +1,37 @@
|
|
|
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
|
-
exports
|
|
7
|
-
Object.defineProperty(exports, "expect", {
|
|
7
|
+
Object.defineProperty(exports, "createBdd", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function () {
|
|
10
|
-
return
|
|
10
|
+
return _bddFramework.createBdd;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "expect", {
|
|
14
14
|
enumerable: true,
|
|
15
15
|
get: function () {
|
|
16
|
-
return
|
|
16
|
+
return _test.expect;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
|
|
19
|
+
exports.test = void 0;
|
|
20
|
+
var _bddFramework = require("../../bdd-framework");
|
|
20
21
|
var _test = require("@playwright/test");
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
var _readConfigFile = require("./readConfigFile");
|
|
23
|
+
var _builtInFixtures = _interopRequireDefault(require("./builtInFixtures"));
|
|
24
|
+
var _getUserFixtures = _interopRequireDefault(require("./helpers/getUserFixtures"));
|
|
25
|
+
const {
|
|
26
|
+
bddMode
|
|
27
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
28
|
+
let base = bddMode ? _bddFramework.test : _test.test;
|
|
29
|
+
const buildInFixtures = (0, _builtInFixtures.default)(bddMode);
|
|
30
|
+
const buildInFixturesTest = base.extend({
|
|
31
|
+
...buildInFixtures
|
|
32
|
+
});
|
|
33
|
+
const userFixtures = (0, _getUserFixtures.default)();
|
|
34
|
+
const userFixturesTest = base.extend({
|
|
35
|
+
...userFixtures
|
|
36
|
+
});
|
|
37
|
+
const test = exports.test = (0, _test.mergeTests)(buildInFixturesTest, userFixturesTest);
|
|
@@ -5,13 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.generateConfigFromFile = generateConfigFromFile;
|
|
8
|
+
exports.getApplicationConfig = getApplicationConfig;
|
|
8
9
|
exports.getAuthFilePath = getAuthFilePath;
|
|
10
|
+
exports.getDefaultConfig = getDefaultConfig;
|
|
9
11
|
exports.isUserConfigFileAvailable = isUserConfigFileAvailable;
|
|
10
12
|
var _fs = require("fs");
|
|
11
13
|
var _path = _interopRequireDefault(require("path"));
|
|
12
14
|
var _logger = require("../../utils/logger");
|
|
13
15
|
var _configFileNameProvider = require("./helpers/configFileNameProvider");
|
|
14
16
|
var _mergeObjects = require("./helpers/mergeObjects");
|
|
17
|
+
var _Configuration = require("./configuration/Configuration");
|
|
15
18
|
let cachedConfig = null;
|
|
16
19
|
function getDefaultConfig() {
|
|
17
20
|
return {
|
|
@@ -124,6 +127,14 @@ function generateConfigFromFile() {
|
|
|
124
127
|
}
|
|
125
128
|
return {};
|
|
126
129
|
}
|
|
130
|
+
function getApplicationConfig() {
|
|
131
|
+
const filePath = _path.default.resolve(process.cwd(), (0, _configFileNameProvider.getUATFileName)());
|
|
132
|
+
if ((0, _fs.existsSync)(filePath)) {
|
|
133
|
+
const config = require(filePath);
|
|
134
|
+
return config;
|
|
135
|
+
}
|
|
136
|
+
return {};
|
|
137
|
+
}
|
|
127
138
|
function isUserConfigFileAvailable() {
|
|
128
139
|
const filePath = _path.default.resolve(process.cwd(), (0, _configFileNameProvider.getUATFileName)());
|
|
129
140
|
if ((0, _fs.existsSync)(filePath)) {
|
|
@@ -38,12 +38,12 @@ const testDir = (0, _configUtils.getTestDir)(bddMode, process.cwd(), {
|
|
|
38
38
|
featureFilesFolder,
|
|
39
39
|
stepDefinitionsFolder
|
|
40
40
|
});
|
|
41
|
-
const
|
|
41
|
+
const testOptions = (0, _configUtils.getTestUseOptions)({
|
|
42
42
|
trace,
|
|
43
43
|
video,
|
|
44
44
|
viewport,
|
|
45
45
|
testIdAttribute
|
|
46
|
-
};
|
|
46
|
+
});
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Playwright configuration object
|
|
@@ -66,7 +66,7 @@ function getPlaywrightConfig() {
|
|
|
66
66
|
expect: {
|
|
67
67
|
timeout: expectTimeout
|
|
68
68
|
},
|
|
69
|
-
use,
|
|
69
|
+
use: testOptions,
|
|
70
70
|
projects: isAuthMode ? [{
|
|
71
71
|
name: 'setup',
|
|
72
72
|
testMatch: /.*\.setup\.js/,
|
|
@@ -7,12 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getBrowsersList = getBrowsersList;
|
|
8
8
|
exports.getProjects = getProjects;
|
|
9
9
|
exports.getTestDir = getTestDir;
|
|
10
|
+
exports.getTestUseOptions = getTestUseOptions;
|
|
10
11
|
var _test = require("@playwright/test");
|
|
11
12
|
var _path = _interopRequireDefault(require("path"));
|
|
12
13
|
var _readConfigFile = require("../readConfigFile");
|
|
13
|
-
var
|
|
14
|
+
var _bddFramework = require("../../../bdd-framework");
|
|
14
15
|
var _logger = require("../../../utils/logger");
|
|
15
16
|
var _browserTypes = require("../constants/browserTypes");
|
|
17
|
+
var _configFileNameProvider = require("../helpers/configFileNameProvider");
|
|
16
18
|
var _fileUtils = require("../../../utils/fileUtils");
|
|
17
19
|
/**
|
|
18
20
|
** Playwright project configuration
|
|
@@ -146,15 +148,30 @@ function getPathsForFeatureFiles(cwd) {
|
|
|
146
148
|
function getTestDir(bddMode, cwd, {
|
|
147
149
|
stepDefinitionsFolder
|
|
148
150
|
}) {
|
|
149
|
-
return bddMode ? (0,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
importTestFrom: require.resolve('../fixtures.js'),
|
|
151
|
+
return bddMode ? (0, _bddFramework.defineBddConfig)({
|
|
152
|
+
paths: getPathsForFeatureFiles(cwd),
|
|
153
|
+
import: [_path.default.join(cwd, 'uat', '**', stepDefinitionsFolder, '*.spec.js')],
|
|
153
154
|
featuresRoot: _path.default.join(cwd, 'uat'),
|
|
154
155
|
outputDir: _path.default.join(cwd, 'uat', '.features-gen'),
|
|
155
|
-
disableWarnings: {
|
|
156
|
-
importTestFrom: true
|
|
157
|
-
},
|
|
158
156
|
publish: true
|
|
159
157
|
}) : _path.default.join(cwd, 'uat');
|
|
158
|
+
}
|
|
159
|
+
function getTestUseOptions({
|
|
160
|
+
viewport,
|
|
161
|
+
trace,
|
|
162
|
+
video,
|
|
163
|
+
testIdAttribute
|
|
164
|
+
}) {
|
|
165
|
+
let defaultTestuseOptions = {
|
|
166
|
+
viewport,
|
|
167
|
+
testIdAttribute,
|
|
168
|
+
trace: trace ? 'on' : 'off',
|
|
169
|
+
video: video ? {
|
|
170
|
+
mode: 'on',
|
|
171
|
+
size: {
|
|
172
|
+
...viewport
|
|
173
|
+
}
|
|
174
|
+
} : 'off'
|
|
175
|
+
};
|
|
176
|
+
return defaultTestuseOptions;
|
|
160
177
|
}
|
|
@@ -18,6 +18,7 @@ class JSONSummaryReporter {
|
|
|
18
18
|
this.skipped = [];
|
|
19
19
|
this.failed = [];
|
|
20
20
|
this.warned = [];
|
|
21
|
+
this.errored = [];
|
|
21
22
|
this.interrupted = [];
|
|
22
23
|
this.timedOut = [];
|
|
23
24
|
this.flakey = [];
|
|
@@ -29,7 +30,7 @@ class JSONSummaryReporter {
|
|
|
29
30
|
onBegin() {
|
|
30
31
|
this.startedAt = Date.now();
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
+
getTitle(test) {
|
|
33
34
|
const title = [];
|
|
34
35
|
const fileName = [];
|
|
35
36
|
let clean = true;
|
|
@@ -39,35 +40,52 @@ class JSONSummaryReporter {
|
|
|
39
40
|
}
|
|
40
41
|
clean = false;
|
|
41
42
|
title.push(s);
|
|
42
|
-
if (s.
|
|
43
|
+
if (s.endsWith('.ts') || s.endsWith('.js')) {
|
|
43
44
|
fileName.push(s);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
|
|
48
|
+
//Using the fullTitle variable in the push will push a full test name + test description
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
fullTitle: title.join(' > '),
|
|
52
|
+
fileName: fileName[0] || ''
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
onTestEnd(test, result) {
|
|
56
|
+
const {
|
|
57
|
+
fullTitle,
|
|
58
|
+
fileName
|
|
59
|
+
} = this.getTitle(test);
|
|
60
|
+
|
|
50
61
|
// Set the status
|
|
51
|
-
const stepTitleList = result.steps.map(step => ({
|
|
62
|
+
const stepTitleList = result.steps.filter(step => step.error).map(step => ({
|
|
52
63
|
title: step.title,
|
|
53
64
|
error: step.error,
|
|
54
|
-
testTitle:
|
|
55
|
-
}))
|
|
65
|
+
testTitle: fullTitle
|
|
66
|
+
}));
|
|
56
67
|
if (stepTitleList.length > 0) {
|
|
57
68
|
this.failedSteps = [...this.failedSteps, ...stepTitleList];
|
|
58
69
|
}
|
|
59
|
-
const status = !['passed', 'skipped'].includes(result.status) &&
|
|
70
|
+
const status = !['passed', 'skipped'].includes(result.status) && fullTitle.includes('@warn') ? 'warned' : result.status;
|
|
60
71
|
// Logic to push the results into the correct array
|
|
61
72
|
if (result.status === 'passed' && result.retry >= 1) {
|
|
62
|
-
this.flakey.push(
|
|
73
|
+
this.flakey.push(fileName);
|
|
63
74
|
} else {
|
|
64
|
-
this[status].push(
|
|
75
|
+
this[status].push(fileName);
|
|
65
76
|
}
|
|
66
|
-
this[status].push(
|
|
77
|
+
this[status].push(fileName);
|
|
78
|
+
}
|
|
79
|
+
onError(error) {
|
|
80
|
+
this.errored.push({
|
|
81
|
+
error: error.message,
|
|
82
|
+
stack: error.stack
|
|
83
|
+
});
|
|
67
84
|
}
|
|
68
85
|
onEnd(result) {
|
|
69
86
|
this.durationInMS = Date.now() - this.startedAt;
|
|
70
87
|
this.status = result.status;
|
|
88
|
+
|
|
71
89
|
// removing duplicate tests from passed array
|
|
72
90
|
this.passed = this.passed.filter((element, index) => {
|
|
73
91
|
return this.passed.indexOf(element) === index;
|
|
@@ -90,6 +108,14 @@ class JSONSummaryReporter {
|
|
|
90
108
|
this.interrupted = this.interrupted.filter((element, index) => {
|
|
91
109
|
return this.interrupted.indexOf(element) === index;
|
|
92
110
|
});
|
|
111
|
+
this.errored = this.errored.filter((element, index) => {
|
|
112
|
+
return this.errored.indexOf(element) === index;
|
|
113
|
+
});
|
|
114
|
+
if (this.errored.length > 0) {
|
|
115
|
+
// Reflect setup failures in the final report status
|
|
116
|
+
this.status = "failed";
|
|
117
|
+
}
|
|
118
|
+
|
|
93
119
|
// fs.writeFileSync('./summary.json', JSON.stringify(this, null, ' '));
|
|
94
120
|
let {
|
|
95
121
|
reportPath
|
|
@@ -16,7 +16,9 @@ var _rootPath = require("../../utils/rootPath");
|
|
|
16
16
|
var _tagProcessor = require("./tag-processor");
|
|
17
17
|
var _configUtils = require("./setup/config-utils");
|
|
18
18
|
var _browserTypes = require("./constants/browserTypes");
|
|
19
|
-
var
|
|
19
|
+
var _ConfigurationHelper = require("./configuration/ConfigurationHelper");
|
|
20
|
+
var _Configuration = _interopRequireDefault(require("./configuration/Configuration"));
|
|
21
|
+
var _UserArgs = _interopRequireDefault(require("./configuration/UserArgs"));
|
|
20
22
|
function getPlaywrightArgs(userArgsObject, debug, bddMode, tagArgs, headless) {
|
|
21
23
|
const {
|
|
22
24
|
browsers = null
|
|
@@ -38,9 +40,9 @@ function getPlaywrightArgs(userArgsObject, debug, bddMode, tagArgs, headless) {
|
|
|
38
40
|
}
|
|
39
41
|
return playwrightArgs;
|
|
40
42
|
}
|
|
41
|
-
|
|
43
|
+
function runPreprocessing(tagArgs, configPath) {
|
|
42
44
|
const beforeCommand = 'node';
|
|
43
|
-
const bddGenPath = _path.default.resolve(
|
|
45
|
+
const bddGenPath = _path.default.resolve(__dirname, '../', '../', 'bdd-framework', 'cli', 'index.js');
|
|
44
46
|
const beforeArgs = [bddGenPath, '-c', configPath];
|
|
45
47
|
if (tagArgs) {
|
|
46
48
|
beforeArgs.push('--tags');
|
|
@@ -97,17 +99,31 @@ function runPlaywright(command, args) {
|
|
|
97
99
|
});
|
|
98
100
|
}
|
|
99
101
|
function main() {
|
|
100
|
-
|
|
101
|
-
const uatConfig = (0, _readConfigFile.
|
|
102
|
+
// Getting the default config's from framework
|
|
103
|
+
const uatConfig = new _Configuration.default((0, _readConfigFile.getDefaultConfig)());
|
|
104
|
+
|
|
105
|
+
// overriding the application config's from project
|
|
106
|
+
uatConfig.addAll(new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)()));
|
|
107
|
+
const {
|
|
108
|
+
isAuthMode,
|
|
109
|
+
editionOrder
|
|
110
|
+
} = uatConfig.getAll();
|
|
111
|
+
const userArgConfig = new _Configuration.default(_UserArgs.default.parseToObject(process.argv.slice(2)));
|
|
112
|
+
const mode = userArgConfig.get("mode");
|
|
113
|
+
(0, _envInitializer.initializeEnvConfig)(mode, isAuthMode);
|
|
114
|
+
|
|
115
|
+
// overriding the user config's from CLI
|
|
116
|
+
// const userArgConfig = new Configuration( UserArgs.parseToObject(process.argv.slice(2)) );
|
|
117
|
+
uatConfig.addAll(userArgConfig);
|
|
118
|
+
|
|
119
|
+
//This is only used for pass the user arguments to need places in legacy code. We need to rewamp that also.
|
|
120
|
+
const userArgsObject = userArgConfig.getAll();
|
|
121
|
+
const tagArgs = (0, _tagProcessor.tagProcessor)(userArgsObject, editionOrder);
|
|
102
122
|
const {
|
|
103
123
|
debug,
|
|
104
124
|
bddMode = false,
|
|
105
|
-
headless = false
|
|
106
|
-
|
|
107
|
-
isAuthMode
|
|
108
|
-
} = uatConfig;
|
|
109
|
-
(0, _envInitializer.initializeEnvConfig)(userArgsObject.mode, isAuthMode);
|
|
110
|
-
const tagArgs = (0, _tagProcessor.tagProcessor)(userArgsObject, editionOrder);
|
|
125
|
+
headless = false
|
|
126
|
+
} = uatConfig.getAll();
|
|
111
127
|
const playwrightArgs = getPlaywrightArgs(userArgsObject, debug, bddMode, tagArgs, headless);
|
|
112
128
|
const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('playwright'));
|
|
113
129
|
const command = playwrightPath;
|
package/build/decorators.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from './bdd-framework/decorators';
|
package/build/decorators.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _decorators = require("
|
|
6
|
+
var _decorators = require("./bdd-framework/decorators");
|
|
7
7
|
Object.keys(_decorators).forEach(function (key) {
|
|
8
8
|
if (key === "default" || key === "__esModule") return;
|
|
9
9
|
if (key in exports && exports[key] === _decorators[key]) return;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// const UserArgs = require("../core/playwright/configuration/UserArgs");
|
|
4
|
+
// const Configuration = require("../core/playwright/configuration/Configuration");
|
|
5
|
+
|
|
6
|
+
// function main() {
|
|
7
|
+
// const config = new Configuration();
|
|
8
|
+
// config.set("reportPath", "home/reports");
|
|
9
|
+
|
|
10
|
+
// const fwConfig = new Configuration();
|
|
11
|
+
// fwConfig.set("browser", "chrome");
|
|
12
|
+
// fwConfig.set("trace", true);
|
|
13
|
+
// config.setFrameworkConfig(fwConfig);
|
|
14
|
+
|
|
15
|
+
// const appConfig = new Configuration();
|
|
16
|
+
// appConfig.set("environment", "CI");
|
|
17
|
+
// appConfig.set("edition", "test");
|
|
18
|
+
// config.setApplicationConfig(appConfig);
|
|
19
|
+
|
|
20
|
+
// const uaConfig = new Configuration();
|
|
21
|
+
// uaConfig.set("debug", true);
|
|
22
|
+
// uaConfig.set("headless", true);
|
|
23
|
+
// config.setUserArguments(uaConfig);
|
|
24
|
+
|
|
25
|
+
// console.log("default Config : ", config.get("reportPath"));
|
|
26
|
+
// console.log("framework Config : ", config.getFrameworkConfig()?.get("browser"));
|
|
27
|
+
// console.log("application Config : ", config.getApplicationConfig()?.get("environment"));
|
|
28
|
+
// console.log("User arguments : ", config.getUserArguments()?.get("debug"));
|
|
29
|
+
// }
|
|
30
|
+
|
|
31
|
+
// function test(){
|
|
32
|
+
// const prop = new Map();
|
|
33
|
+
// prop.set("browser","durai");
|
|
34
|
+
|
|
35
|
+
// const config = Configuration(prop);
|
|
36
|
+
// console.log("output :" +config.get("browser"));
|
|
37
|
+
// // console.log(prop);
|
|
38
|
+
|
|
39
|
+
// }
|
|
40
|
+
|
|
41
|
+
// function testParseToArgs(){
|
|
42
|
+
// const prop = new Map();
|
|
43
|
+
// prop.set("browser","durai");
|
|
44
|
+
// const userArgsObject = UserArgs.parseToArgs(prop);
|
|
45
|
+
// console.log(userArgsObject);
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
function throwError() {
|
|
49
|
+
throw new Error("catch error");
|
|
50
|
+
}
|
|
51
|
+
function catchError() {
|
|
52
|
+
try {
|
|
53
|
+
throw new Error("catch error");
|
|
54
|
+
} catch (err) {
|
|
55
|
+
console.log(err.message);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// throwError();
|
|
60
|
+
catchError();
|
|
61
|
+
// testParseToArgs();
|
|
62
|
+
|
|
63
|
+
// main();
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const Configuration = require("../../../../../core/playwright/configuration/Configuration");
|
|
4
|
+
const {
|
|
5
|
+
combineConfiguration
|
|
6
|
+
} = require("../../../../../core/playwright/configuration/ConfigurationHelper");
|
|
7
|
+
jest.mock('../../../../../core/playwright/configuration/ConfigurationHelper', () => ({
|
|
8
|
+
combineConfiguration: jest.fn()
|
|
9
|
+
}));
|
|
10
|
+
describe('Configuration Class', () => {
|
|
11
|
+
let config;
|
|
12
|
+
let sampleData;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
// Sample data as a JSON object
|
|
15
|
+
sampleData = {
|
|
16
|
+
headless: false,
|
|
17
|
+
trace: true,
|
|
18
|
+
video: true,
|
|
19
|
+
bddMode: true
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Initialize the Configuration instance with sample data
|
|
23
|
+
config = new Configuration(sampleData);
|
|
24
|
+
});
|
|
25
|
+
test('should add new key-value pair to the configuration', () => {
|
|
26
|
+
config.add('newKey', 'newValue');
|
|
27
|
+
expect(config.get('newKey')).toBe('newValue');
|
|
28
|
+
});
|
|
29
|
+
test('should combine configurations correctly using addAll', () => {
|
|
30
|
+
const newConfig = new Configuration({
|
|
31
|
+
newKey1: 'newValue1',
|
|
32
|
+
trace: false // existing key to test override
|
|
33
|
+
});
|
|
34
|
+
const combinedConfig = {
|
|
35
|
+
headless: false,
|
|
36
|
+
trace: false,
|
|
37
|
+
// trace overridden
|
|
38
|
+
video: true,
|
|
39
|
+
bddMode: true,
|
|
40
|
+
newKey1: 'newValue1'
|
|
41
|
+
};
|
|
42
|
+
combineConfiguration.mockReturnValue(combinedConfig);
|
|
43
|
+
config.addAll(newConfig);
|
|
44
|
+
expect(combineConfiguration).toHaveBeenCalledWith(sampleData, newConfig.getAll());
|
|
45
|
+
expect(config.getAll()).toEqual(combinedConfig);
|
|
46
|
+
});
|
|
47
|
+
test('should return correct value for a given key', () => {
|
|
48
|
+
expect(config.get('headless')).toBe(false);
|
|
49
|
+
expect(config.get('trace')).toBe(true);
|
|
50
|
+
expect(config.get('video')).toBe(true);
|
|
51
|
+
expect(config.get('bddMode')).toBe(true);
|
|
52
|
+
});
|
|
53
|
+
});
|