@zohodesk/testinglibrary 0.3.1-experimental → 0.3.1
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/.gitlab-ci.yml +111 -0
- package/README.md +41 -4
- package/build/core/playwright/builtInFixtures/page.js +1 -1
- package/build/core/playwright/configuration/Configuration.js +25 -0
- package/build/core/playwright/configuration/ConfigurationHelper.js +43 -0
- package/build/core/playwright/configuration/UserArgs.js +12 -0
- package/build/core/playwright/env-initializer.js +0 -1
- package/build/core/playwright/fixtures.js +24 -0
- package/build/core/playwright/helpers/auth/getUsers.js +34 -35
- package/build/core/playwright/helpers/configFileNameProvider.js +9 -3
- package/build/core/playwright/helpers/parseUserArgs.js +2 -3
- package/build/core/playwright/index.js +10 -23
- package/build/core/playwright/readConfigFile.js +23 -21
- package/build/core/playwright/setup/config-creator.js +8 -6
- package/build/core/playwright/setup/config-utils.js +8 -5
- package/build/core/playwright/setup/custom-reporter.js +39 -13
- package/build/core/playwright/tagProcessor.js +69 -0
- package/build/core/playwright/test-runner.js +28 -12
- package/build/core/playwright/validateFeature.js +28 -0
- package/build/decorators.d.ts +1 -1
- package/build/decorators.js +1 -1
- package/build/lib/cli.js +6 -0
- package/build/setup-folder-structure/samples/actors-index.js +3 -0
- package/build/setup-folder-structure/samples/auth-setup-sample.js +14 -66
- package/build/setup-folder-structure/samples/editions-index.js +3 -0
- package/build/setup-folder-structure/samples/free-sample.json +25 -0
- package/build/setup-folder-structure/samples/settings.json +7 -0
- package/build/setup-folder-structure/setupProject.js +18 -5
- package/build/test/core/playwright/__tests__/tagProcessor.test.js +94 -0
- package/build/test/core/playwright/__tests__/validateFeature.test.js +69 -0
- package/build/test/core/playwright/configuration/__tests__/Configuration.test.js +53 -0
- package/build/test/core/playwright/helpers/__tests__/configFileNameProvider.test.js +34 -0
- package/build/test/core/playwright/helpers/__tests__/getUsers_ListOfActors.test.js +80 -0
- package/build/utils/cliArgsToObject.js +3 -0
- package/jest.config.js +19 -9
- package/nobdd/README.md +1 -0
- package/nobdd/package.json +17 -0
- package/nobdd/uat/conf/default/actors/beta/custom-module.json +24 -0
- package/nobdd/uat/conf/default/actors/beta/index.js +6 -0
- package/nobdd/uat/conf/default/actors/beta/parent-child.json +24 -0
- package/nobdd/uat/conf/default/actors/editions/enterprise.json +24 -0
- package/nobdd/uat/conf/default/actors/editions/index.js +4 -0
- package/nobdd/uat/conf/default/actors/index.js +5 -0
- package/nobdd/uat/conf/default/settings.json +6 -0
- package/nobdd/uat/conf/nobdd/uat.config.js +28 -0
- package/nobdd/uat/env-config.json +20 -0
- package/nobdd/uat/fixtures/auth.setup.js +44 -0
- package/nobdd/uat/fixtures/setup.teardown.js +32 -0
- package/nobdd/uat/modules/nobdd/steps/VerifyNoBDD.feature.spec.js +16 -0
- package/nobdd/uat/shared/commands/_index-custom-fixtures.js +9 -0
- package/nobdd/uat/shared/commands/i18n.js +25 -0
- package/nobdd/uat/shared/commands/unauthenticatedPage.js +8 -0
- package/nobdd/uat/shared/index.js +7 -0
- package/nobdd/uat/shared/onboardings/onboardingUpdate.js +44 -0
- package/nobdd/uat/shared/url-helpers/getUrlOrigin.js +6 -0
- package/nobdd/uat.config.js +30 -0
- package/npm-shrinkwrap.json +5795 -2145
- package/package.json +7 -6
- package/playwright.config.js +1 -1
- package/build/bdd-framework/cli/commands/env.js +0 -42
- package/build/bdd-framework/cli/commands/export.js +0 -62
- package/build/bdd-framework/cli/commands/test.js +0 -64
- package/build/bdd-framework/cli/index.js +0 -11
- package/build/bdd-framework/cli/options.js +0 -19
- package/build/bdd-framework/cli/worker.js +0 -13
- package/build/bdd-framework/config/configDir.js +0 -35
- package/build/bdd-framework/config/enrichReporterData.js +0 -23
- package/build/bdd-framework/config/env.js +0 -50
- package/build/bdd-framework/config/index.js +0 -94
- package/build/bdd-framework/config/lang.js +0 -14
- package/build/bdd-framework/cucumber/buildStepDefinition.js +0 -43
- package/build/bdd-framework/cucumber/createTestStep.js +0 -43
- package/build/bdd-framework/cucumber/formatter/EventDataCollector.js +0 -126
- package/build/bdd-framework/cucumber/formatter/GherkinDocumentParser.js +0 -72
- package/build/bdd-framework/cucumber/formatter/PickleParser.js +0 -25
- package/build/bdd-framework/cucumber/formatter/durationHelpers.js +0 -13
- package/build/bdd-framework/cucumber/formatter/getColorFns.js +0 -57
- package/build/bdd-framework/cucumber/formatter/index.js +0 -16
- package/build/bdd-framework/cucumber/formatter/locationHelpers.js +0 -16
- package/build/bdd-framework/cucumber/loadConfig.js +0 -17
- package/build/bdd-framework/cucumber/loadFeatures.js +0 -70
- package/build/bdd-framework/cucumber/loadSnippetBuilder.js +0 -20
- package/build/bdd-framework/cucumber/loadSteps.js +0 -47
- package/build/bdd-framework/cucumber/resolveFeaturePaths.js +0 -62
- package/build/bdd-framework/cucumber/stepArguments.js +0 -21
- package/build/bdd-framework/cucumber/types.js +0 -5
- package/build/bdd-framework/cucumber/valueChecker.js +0 -23
- package/build/bdd-framework/decorators.js +0 -18
- package/build/bdd-framework/gen/fixtures.js +0 -48
- package/build/bdd-framework/gen/formatter.js +0 -167
- package/build/bdd-framework/gen/i18n.js +0 -39
- package/build/bdd-framework/gen/index.js +0 -197
- package/build/bdd-framework/gen/specialTags.js +0 -70
- package/build/bdd-framework/gen/testFile.js +0 -470
- package/build/bdd-framework/gen/testMeta.js +0 -60
- package/build/bdd-framework/gen/testNode.js +0 -35
- package/build/bdd-framework/gen/testPoms.js +0 -133
- package/build/bdd-framework/hooks/scenario.js +0 -130
- package/build/bdd-framework/hooks/worker.js +0 -89
- package/build/bdd-framework/index.js +0 -52
- package/build/bdd-framework/playwright/fixtureParameterNames.js +0 -93
- package/build/bdd-framework/playwright/getLocationInFile.js +0 -79
- package/build/bdd-framework/playwright/loadConfig.js +0 -42
- package/build/bdd-framework/playwright/loadUtils.js +0 -33
- package/build/bdd-framework/playwright/testTypeImpl.js +0 -79
- package/build/bdd-framework/playwright/transform.js +0 -88
- package/build/bdd-framework/playwright/types.js +0 -12
- package/build/bdd-framework/playwright/utils.js +0 -56
- package/build/bdd-framework/reporter/cucumber/base.js +0 -52
- package/build/bdd-framework/reporter/cucumber/custom.js +0 -73
- package/build/bdd-framework/reporter/cucumber/helper.js +0 -12
- package/build/bdd-framework/reporter/cucumber/html.js +0 -40
- package/build/bdd-framework/reporter/cucumber/index.js +0 -74
- package/build/bdd-framework/reporter/cucumber/json.js +0 -312
- package/build/bdd-framework/reporter/cucumber/junit.js +0 -205
- package/build/bdd-framework/reporter/cucumber/message.js +0 -20
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/AttachmentMapper.js +0 -82
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Builder.js +0 -197
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocument.js +0 -43
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocumentClone.js +0 -52
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocuments.js +0 -105
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Hook.js +0 -70
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Meta.js +0 -45
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Pickles.js +0 -27
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Projects.js +0 -38
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCase.js +0 -128
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRun.js +0 -154
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRunHooks.js +0 -123
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepAttachments.js +0 -67
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepRun.js +0 -114
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/index.js +0 -30
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/pwStepUtils.js +0 -70
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/timing.js +0 -35
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/types.js +0 -5
- package/build/bdd-framework/run/StepInvoker.js +0 -69
- package/build/bdd-framework/run/bddData/index.js +0 -59
- package/build/bdd-framework/run/bddData/types.js +0 -5
- package/build/bdd-framework/run/bddFixtures.js +0 -192
- package/build/bdd-framework/run/bddWorld.js +0 -79
- package/build/bdd-framework/run/bddWorldInternal.js +0 -11
- package/build/bdd-framework/snippets/index.js +0 -132
- package/build/bdd-framework/snippets/snippetSyntax.js +0 -43
- package/build/bdd-framework/snippets/snippetSyntaxDecorators.js +0 -26
- package/build/bdd-framework/snippets/snippetSyntaxTs.js +0 -18
- package/build/bdd-framework/stepDefinitions/createBdd.js +0 -66
- package/build/bdd-framework/stepDefinitions/decorators/class.js +0 -68
- package/build/bdd-framework/stepDefinitions/decorators/steps.js +0 -99
- package/build/bdd-framework/stepDefinitions/defineStep.js +0 -62
- package/build/bdd-framework/stepDefinitions/stepConfig.js +0 -24
- package/build/bdd-framework/steps/createBdd.js +0 -78
- package/build/bdd-framework/steps/decorators/class.js +0 -68
- package/build/bdd-framework/steps/decorators/steps.js +0 -98
- package/build/bdd-framework/steps/defineStep.js +0 -62
- package/build/bdd-framework/steps/stepConfig.js +0 -24
- package/build/bdd-framework/utils/AutofillMap.js +0 -20
- package/build/bdd-framework/utils/exit.js +0 -62
- package/build/bdd-framework/utils/index.js +0 -93
- package/build/bdd-framework/utils/jsStringWrap.js +0 -44
- package/build/bdd-framework/utils/logger.js +0 -30
- package/build/bdd-framework/utils/stripAnsiEscapes.js +0 -20
- package/build/core/playwright/tag-processor.js +0 -68
- package/build/setup-folder-structure/samples/authUsers-sample.json +0 -9
- package/build/setup-folder-structure/samples/env-config-sample.json +0 -21
package/.gitlab-ci.yml
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
|
|
2
|
+
|
|
3
|
+
workflow:
|
|
4
|
+
rules:
|
|
5
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
6
|
+
|
|
7
|
+
stages:
|
|
8
|
+
- build
|
|
9
|
+
- unit
|
|
10
|
+
- uat
|
|
11
|
+
|
|
12
|
+
# Install dependencies stage
|
|
13
|
+
build:
|
|
14
|
+
stage: build
|
|
15
|
+
image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
|
|
16
|
+
script:
|
|
17
|
+
- npm install
|
|
18
|
+
artifacts:
|
|
19
|
+
paths:
|
|
20
|
+
- node_modules/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# Unit tests stage
|
|
24
|
+
unit:
|
|
25
|
+
stage: unit
|
|
26
|
+
image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
|
|
27
|
+
script:
|
|
28
|
+
- npm run test
|
|
29
|
+
artifacts:
|
|
30
|
+
when: always
|
|
31
|
+
paths:
|
|
32
|
+
- unit_reports
|
|
33
|
+
|
|
34
|
+
# UAT tests stage
|
|
35
|
+
uat-auth:
|
|
36
|
+
stage: uat
|
|
37
|
+
image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
|
|
38
|
+
script:
|
|
39
|
+
- npm install
|
|
40
|
+
- npm run build
|
|
41
|
+
- cd examples
|
|
42
|
+
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
43
|
+
- output=$(npm run uatauth)
|
|
44
|
+
- echo "$output"
|
|
45
|
+
- if [[ "$output" == *"failed"* ]]; then
|
|
46
|
+
- exit 1
|
|
47
|
+
- fi
|
|
48
|
+
|
|
49
|
+
artifacts:
|
|
50
|
+
when: always
|
|
51
|
+
paths:
|
|
52
|
+
- examples/uat/playwright-report
|
|
53
|
+
|
|
54
|
+
uat-noauth:
|
|
55
|
+
stage: uat
|
|
56
|
+
image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
|
|
57
|
+
script:
|
|
58
|
+
- npm install
|
|
59
|
+
- npm run build
|
|
60
|
+
- cd examples
|
|
61
|
+
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
62
|
+
- output=$(npm run uatnoauth)
|
|
63
|
+
- echo "$output"
|
|
64
|
+
- if [[ "$output" == *"failed"* ]]; then
|
|
65
|
+
- exit 1
|
|
66
|
+
- fi
|
|
67
|
+
|
|
68
|
+
artifacts:
|
|
69
|
+
when: always
|
|
70
|
+
paths:
|
|
71
|
+
- examples/uat/playwright-report
|
|
72
|
+
|
|
73
|
+
uat-profile:
|
|
74
|
+
stage: uat
|
|
75
|
+
image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
|
|
76
|
+
script:
|
|
77
|
+
- npm install
|
|
78
|
+
- npm run build
|
|
79
|
+
- cd examples
|
|
80
|
+
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
81
|
+
- output=$(npm run uatprofile)
|
|
82
|
+
- echo "$output"
|
|
83
|
+
- if [[ "$output" == *"failed"* ]]; then
|
|
84
|
+
- exit 1
|
|
85
|
+
- fi
|
|
86
|
+
|
|
87
|
+
artifacts:
|
|
88
|
+
when: always
|
|
89
|
+
paths:
|
|
90
|
+
- examples/uat/playwright-report
|
|
91
|
+
|
|
92
|
+
uat-nobdd:
|
|
93
|
+
stage: uat
|
|
94
|
+
image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
|
|
95
|
+
script:
|
|
96
|
+
- npm install
|
|
97
|
+
- npm run build
|
|
98
|
+
- cd nobdd
|
|
99
|
+
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
100
|
+
- output=$(npm run uatnobdd)
|
|
101
|
+
- echo "$output"
|
|
102
|
+
- if [[ "$output" == *"failed"* ]]; then
|
|
103
|
+
- exit 1
|
|
104
|
+
- fi
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
artifacts:
|
|
108
|
+
when: always
|
|
109
|
+
paths:
|
|
110
|
+
- nobdd/uat/playwright-report
|
|
111
|
+
|
package/README.md
CHANGED
|
@@ -18,12 +18,49 @@
|
|
|
18
18
|
|
|
19
19
|
## Version History
|
|
20
20
|
|
|
21
|
-
### v0.2.8 -
|
|
21
|
+
### v0.2.8 - 26-09-2024
|
|
22
22
|
|
|
23
|
-
####
|
|
23
|
+
#### Feature
|
|
24
24
|
- Added support for writing unitcases for framework implementations
|
|
25
|
-
- Updated the configuration for `video` and `trace` to accept Playwright-specific values instead of boolean values.
|
|
26
25
|
|
|
26
|
+
### Bug fix
|
|
27
|
+
- Updated the custom-reported to include the errors in tests during the executions. It will help us avoid the stage passed without the actual test execution.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Version History
|
|
31
|
+
|
|
32
|
+
### v0.2.9 - 25-10-2024
|
|
33
|
+
|
|
34
|
+
#### Feature
|
|
35
|
+
- Added support for scenario level tag support
|
|
36
|
+
- Added a new cli optin like uat-validate to validate the feature files using playwright-bdd
|
|
37
|
+
- Mode based configuration implementations
|
|
38
|
+
- @only option enabled in dev pipeline
|
|
39
|
+
- Latest setup related configuration changed for init option
|
|
40
|
+
|
|
41
|
+
### v0.3.0 - 25-10-2024
|
|
42
|
+
|
|
43
|
+
#### Features
|
|
44
|
+
- Added support for scenario level tag support
|
|
45
|
+
- Updated the configuration for `video` and `trace` to accept Playwright-specific values instead of boolean values.
|
|
46
|
+
- Below package versions are updated in this release.
|
|
47
|
+
- playwright - 1.48.0,
|
|
48
|
+
- playwright-bdd - 7.5.0,
|
|
49
|
+
- @playwright/test - 1.48.0,
|
|
50
|
+
- @cucumber/cucumber - 11.0.1
|
|
51
|
+
- From this version, We adopt the playwright-bdd as library instead of modified source
|
|
52
|
+
- Published on 11-11-2024
|
|
53
|
+
|
|
27
54
|
#### Deprecations
|
|
28
55
|
- **Deprecated**: Passing `video` and `trace` as boolean (`true`/`false`) in project configuration.
|
|
29
|
-
- **New Approach**: Use Playwright values for `video` and `trace` options, such as `'on'`, `'retain-on-failure'`, or `'off'`.
|
|
56
|
+
- **New Approach**: Use Playwright values for `video` and `trace` options, such as `'on'`, `'retain-on-failure'`, or `'off'`.
|
|
57
|
+
|
|
58
|
+
### v0.3.1 - 13-11-2024
|
|
59
|
+
|
|
60
|
+
#### Issue Fix
|
|
61
|
+
- Adding bddmode to get the fixtures.
|
|
62
|
+
|
|
63
|
+
### v0.2.9.1 - 14-11-2024
|
|
64
|
+
|
|
65
|
+
#### Enhancement
|
|
66
|
+
- Beta feature Actors and edition configurations are unified
|
|
@@ -11,7 +11,7 @@ var _readConfigFile = require("../readConfigFile");
|
|
|
11
11
|
/* eslint-disable global-require */
|
|
12
12
|
|
|
13
13
|
function getTagInputFromSelectedTags(tags, inputString) {
|
|
14
|
-
const selectedTag = tags.find(tag => tag.startsWith(inputString));
|
|
14
|
+
const selectedTag = [...tags].reverse().find(tag => tag.startsWith(inputString));
|
|
15
15
|
let tagInput = null;
|
|
16
16
|
if (selectedTag) {
|
|
17
17
|
tagInput = selectedTag.split(`${inputString}_`).pop().toLowerCase();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _ConfigurationHelper = require("./ConfigurationHelper");
|
|
4
|
+
class Configuration {
|
|
5
|
+
properties = {};
|
|
6
|
+
constructor(props) {
|
|
7
|
+
this.properties = props;
|
|
8
|
+
}
|
|
9
|
+
add(key, value) {
|
|
10
|
+
this.properties[key] = value;
|
|
11
|
+
}
|
|
12
|
+
addAll(newConfig) {
|
|
13
|
+
this.properties = (0, _ConfigurationHelper.combineConfiguration)(this.properties, newConfig.getAll());
|
|
14
|
+
}
|
|
15
|
+
get(key) {
|
|
16
|
+
return this.properties[key];
|
|
17
|
+
}
|
|
18
|
+
getAll() {
|
|
19
|
+
return this.properties;
|
|
20
|
+
}
|
|
21
|
+
delete(key) {
|
|
22
|
+
delete this.properties[key];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
module.exports = Configuration;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.combineConfiguration = combineConfiguration;
|
|
8
|
+
exports.getApplicationConfig = getApplicationConfig;
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
var _logger = require("../../../utils/logger");
|
|
11
|
+
var _configFileNameProvider = require("../helpers/configFileNameProvider");
|
|
12
|
+
var _mergeObjects = require("../helpers/mergeObjects");
|
|
13
|
+
var _fs = require("fs");
|
|
14
|
+
const Configuration = require("./Configuration");
|
|
15
|
+
function combineConfiguration(defaultConfig, userConfiguration) {
|
|
16
|
+
let configurationObj = {};
|
|
17
|
+
Object.keys(userConfiguration).forEach(configKey => {
|
|
18
|
+
let configValue = userConfiguration[configKey];
|
|
19
|
+
if (configValue !== null && configValue !== undefined) {
|
|
20
|
+
configurationObj[configKey] = configValue;
|
|
21
|
+
} else if (defaultConfig[configKey]) {
|
|
22
|
+
configurationObj[configKey] = defaultConfig[configKey];
|
|
23
|
+
} else {
|
|
24
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `key - ${configKey} is not yet supported in uat configuration. This will not be used while creating playwright configuration`);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return (0, _mergeObjects.mergeObjects)(defaultConfig, configurationObj);
|
|
28
|
+
}
|
|
29
|
+
function getApplicationConfig(mode) {
|
|
30
|
+
let filePath = "";
|
|
31
|
+
try {
|
|
32
|
+
filePath = _path.default.resolve(process.cwd(), (0, _configFileNameProvider.getUATFileName)(mode));
|
|
33
|
+
if (!(0, _fs.existsSync)(filePath)) {
|
|
34
|
+
throw new Error("Exception while getting the uat file from the application - " + filePath);
|
|
35
|
+
}
|
|
36
|
+
const config = require(filePath);
|
|
37
|
+
return config;
|
|
38
|
+
} catch (err) {
|
|
39
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Founded Path - ${filePath} Application config file not Exist ...`);
|
|
40
|
+
_logger.Logger.error(err);
|
|
41
|
+
return {};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -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;
|
|
@@ -10,7 +10,6 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
10
10
|
var _configFileNameProvider = require("./helpers/configFileNameProvider");
|
|
11
11
|
var _logger = require("../../utils/logger");
|
|
12
12
|
var _getUsers = require("./helpers/auth/getUsers");
|
|
13
|
-
var _readConfigFile = require("./readConfigFile");
|
|
14
13
|
function setEnvironmentVariables(configJSON) {
|
|
15
14
|
for (const key in configJSON) {
|
|
16
15
|
process.env[key] = configJSON[key];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _test = require("@playwright/test");
|
|
5
|
+
var _playwrightBdd = require("playwright-bdd");
|
|
6
|
+
var _readConfigFile = require("./readConfigFile");
|
|
7
|
+
var _builtInFixtures = _interopRequireDefault(require("./builtInFixtures"));
|
|
8
|
+
var _getUserFixtures = _interopRequireDefault(require("./helpers/getUserFixtures"));
|
|
9
|
+
const {
|
|
10
|
+
bddMode
|
|
11
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
12
|
+
let base = bddMode ? _playwrightBdd.test : _test.test;
|
|
13
|
+
const buildInFixtures = (0, _builtInFixtures.default)(bddMode);
|
|
14
|
+
const buildInFixturesTest = base.extend({
|
|
15
|
+
...buildInFixtures
|
|
16
|
+
});
|
|
17
|
+
const userFixtures = (0, _getUserFixtures.default)();
|
|
18
|
+
const userFixturesTest = base.extend({
|
|
19
|
+
...userFixtures
|
|
20
|
+
});
|
|
21
|
+
const test = (0, _test.mergeTests)(buildInFixturesTest, userFixturesTest);
|
|
22
|
+
module.exports = {
|
|
23
|
+
test
|
|
24
|
+
};
|
|
@@ -33,12 +33,17 @@ function getDefaultActorConf() {
|
|
|
33
33
|
const {
|
|
34
34
|
uatDirectory
|
|
35
35
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
36
|
-
const
|
|
37
|
-
const filePath = _path.default.join(uatDirectory,
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
const modeSettingsFile = `conf/${getRunMode()}/settings.json`;
|
|
37
|
+
const filePath = _path.default.join(uatDirectory, modeSettingsFile);
|
|
38
|
+
try {
|
|
39
|
+
if (!(0, _fs.existsSync)(filePath)) {
|
|
40
|
+
const defaultSettingsFile = _path.default.join(uatDirectory, `conf/default/settings.json`);
|
|
41
|
+
return require(defaultSettingsFile);
|
|
42
|
+
}
|
|
43
|
+
return require(filePath);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
throw new Error(`${defaultSettingFile} ${filePath} both files are missing.`);
|
|
40
46
|
}
|
|
41
|
-
return require(filePath);
|
|
42
47
|
}
|
|
43
48
|
function getDefaultActor() {
|
|
44
49
|
const {
|
|
@@ -47,51 +52,45 @@ function getDefaultActor() {
|
|
|
47
52
|
} = getDefaultActorConf();
|
|
48
53
|
return getUserForSelectedEditionAndProfile(edition, profile);
|
|
49
54
|
}
|
|
50
|
-
function getListOfActors() {
|
|
55
|
+
function getListOfActors(betaFeature) {
|
|
51
56
|
const {
|
|
52
57
|
uatDirectory
|
|
53
58
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
54
59
|
const mode = getRunMode();
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (!(0, _fs.existsSync)(
|
|
58
|
-
|
|
60
|
+
let configFile = _path.default.join(uatDirectory, `conf/${mode}/actors/index.js`);
|
|
61
|
+
let betaReference = mode;
|
|
62
|
+
if (!(0, _fs.existsSync)(configFile)) {
|
|
63
|
+
configFile = _path.default.join(uatDirectory, `conf/default/actors/index.js`);
|
|
64
|
+
betaReference = "default";
|
|
65
|
+
}
|
|
66
|
+
if (betaFeature) {
|
|
67
|
+
configFile = _path.default.join(uatDirectory, `conf/${betaReference}/actors/beta/${betaFeature}/index.js`);
|
|
68
|
+
if (!(0, _fs.existsSync)(configFile)) {
|
|
69
|
+
throw new Error(`There is no beta feature configured with the name "${betaFeature}"`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
return require(configFile);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
throw new Error(`Error loading actor configuration from ${configFile}`);
|
|
59
76
|
}
|
|
60
|
-
return require(filePath);
|
|
61
77
|
}
|
|
62
78
|
function getUserForSelectedEditionAndProfile(preferedEdition, preferredProfile, betaFeature, testDataPortal = null) {
|
|
79
|
+
const actorsData = getListOfActors(betaFeature);
|
|
80
|
+
if (!actorsData || !actorsData.editions) {
|
|
81
|
+
throw new Error("The actors data is missing.");
|
|
82
|
+
}
|
|
63
83
|
const {
|
|
64
|
-
editions: userdata
|
|
65
|
-
|
|
66
|
-
} = getListOfActors();
|
|
84
|
+
editions: userdata
|
|
85
|
+
} = actorsData;
|
|
67
86
|
const defaultConf = getDefaultActorConf();
|
|
68
87
|
const edition = preferedEdition || defaultConf.edition;
|
|
69
88
|
const profile = preferredProfile || defaultConf.profile;
|
|
70
89
|
let selectedProfile = {};
|
|
71
|
-
if (betaFeature && betaFeature !== null) {
|
|
72
|
-
if (!betaPortals.hasOwnProperty(betaFeature)) {
|
|
73
|
-
throw new Error(`There is no "${betaFeature}" beta feature configured.`);
|
|
74
|
-
}
|
|
75
|
-
const betaEdition = betaPortals[betaFeature].find(portal => portal.edition === edition);
|
|
76
|
-
if (!betaEdition) {
|
|
77
|
-
throw new Error(`There is no "${edition}" edition configured in "${betaFeature}" beta feature.`);
|
|
78
|
-
}
|
|
79
|
-
const {
|
|
80
|
-
profiles: betaProfiles,
|
|
81
|
-
...betaEditionData
|
|
82
|
-
} = betaEdition;
|
|
83
|
-
selectedProfile = betaProfiles.find(user => user.profile === profile);
|
|
84
|
-
if (!selectedProfile) {
|
|
85
|
-
throw new Error(`There is no "${profile}" configured in edition of "${edition}" in "${betaFeature}" beta features.`);
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
...betaEditionData,
|
|
89
|
-
...selectedProfile
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
90
|
|
|
93
91
|
// TODO: We are returning the first data from array. We need to check the possiblity of having multiple users for same profile and possibly round robin
|
|
94
92
|
// For this we need to get the data from ci environment.
|
|
93
|
+
|
|
95
94
|
let testingPortal = null;
|
|
96
95
|
if (!userdata.hasOwnProperty(edition)) {
|
|
97
96
|
throw new Error(`There is no "${edition}" edition configured.`);
|
|
@@ -9,8 +9,14 @@ exports.getReportFileName = getReportFileName;
|
|
|
9
9
|
exports.getUATFileName = getUATFileName;
|
|
10
10
|
var _path = _interopRequireDefault(require("path"));
|
|
11
11
|
var _fs = _interopRequireDefault(require("fs"));
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
var _auth = require("./auth");
|
|
13
|
+
function getUATFileName(mode) {
|
|
14
|
+
mode = mode || (0, _auth.getRunMode)();
|
|
15
|
+
const uatConfFilePath = _path.default.resolve(process.cwd(), `uat/conf/${mode}/uat.config.js`);
|
|
16
|
+
if (_fs.default.existsSync(uatConfFilePath)) {
|
|
17
|
+
return uatConfFilePath;
|
|
18
|
+
}
|
|
19
|
+
return _path.default.resolve(process.cwd(), `uat.config.js`);
|
|
14
20
|
}
|
|
15
21
|
function getEnvConfigFilePath(mode) {
|
|
16
22
|
const confFilePath = _path.default.resolve(process.cwd(), `uat/conf/${mode}/settings.json`);
|
|
@@ -18,7 +24,7 @@ function getEnvConfigFilePath(mode) {
|
|
|
18
24
|
if (_fs.default.existsSync(confFilePath)) {
|
|
19
25
|
return `uat/conf/${mode}/settings.json`;
|
|
20
26
|
}
|
|
21
|
-
return `uat/
|
|
27
|
+
return `uat/conf/default/settings.json`;
|
|
22
28
|
}
|
|
23
29
|
function getReportFileName() {
|
|
24
30
|
return `test-summary.json`;
|
|
@@ -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,37 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
|
|
6
|
+
exports.createBdd = void 0;
|
|
7
|
+
Object.defineProperty(exports, "expect", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function () {
|
|
10
|
-
return
|
|
10
|
+
return _test.expect;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "test", {
|
|
14
14
|
enumerable: true,
|
|
15
15
|
get: function () {
|
|
16
|
-
return
|
|
16
|
+
return _playwrightBdd.test;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
|
|
20
|
-
var _bddFramework = require("../../bdd-framework");
|
|
19
|
+
var _playwrightBdd = require("playwright-bdd");
|
|
21
20
|
var _test = require("@playwright/test");
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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);
|
|
21
|
+
let createBdd = function () {
|
|
22
|
+
return (0, _playwrightBdd.createBdd)(_playwrightBdd.test);
|
|
23
|
+
};
|
|
24
|
+
exports.createBdd = createBdd;
|
|
@@ -6,18 +6,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.generateConfigFromFile = generateConfigFromFile;
|
|
8
8
|
exports.getAuthFilePath = getAuthFilePath;
|
|
9
|
+
exports.getDefaultConfig = getDefaultConfig;
|
|
9
10
|
exports.isUserConfigFileAvailable = isUserConfigFileAvailable;
|
|
10
11
|
var _fs = require("fs");
|
|
11
12
|
var _path = _interopRequireDefault(require("path"));
|
|
12
13
|
var _logger = require("../../utils/logger");
|
|
13
14
|
var _configFileNameProvider = require("./helpers/configFileNameProvider");
|
|
14
15
|
var _mergeObjects = require("./helpers/mergeObjects");
|
|
16
|
+
var _Configuration = _interopRequireDefault(require("./configuration/Configuration"));
|
|
17
|
+
var _UserArgs = _interopRequireDefault(require("./configuration/UserArgs"));
|
|
18
|
+
var _ConfigurationHelper = require("./configuration/ConfigurationHelper");
|
|
15
19
|
let cachedConfig = null;
|
|
16
20
|
function getDefaultConfig() {
|
|
17
21
|
return {
|
|
18
22
|
uatDirectory: _path.default.join(process.cwd(), 'uat'),
|
|
19
23
|
headless: false,
|
|
20
24
|
browsers: ['Chrome'],
|
|
25
|
+
forbidOnly: false,
|
|
26
|
+
retries: 0,
|
|
21
27
|
trace: false,
|
|
22
28
|
video: false,
|
|
23
29
|
isAuthMode: false,
|
|
@@ -32,26 +38,18 @@ function getDefaultConfig() {
|
|
|
32
38
|
height: 720
|
|
33
39
|
},
|
|
34
40
|
debug: false,
|
|
35
|
-
|
|
41
|
+
testIdAttribute: 'data-testid',
|
|
36
42
|
additionalPages: {},
|
|
37
43
|
featureFilesFolder: 'feature-files',
|
|
38
44
|
stepDefinitionsFolder: 'steps',
|
|
39
|
-
testIdAttribute: 'data-testid',
|
|
40
45
|
testSetup: {},
|
|
41
46
|
editionOrder: ['Free', 'Express', 'Standard', 'Professional', 'Enterprise']
|
|
42
47
|
};
|
|
43
48
|
}
|
|
44
|
-
function checkForDeprecatedKeys(configKey) {
|
|
45
|
-
let deprecatedConfigInUatConfigFile = ['mode'];
|
|
46
|
-
if (deprecatedConfigInUatConfigFile.includes(configKey)) {
|
|
47
|
-
_logger.Logger.log(_logger.Logger.INFO_TYPE, `key ${configKey} is deprecated. Please use other options`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
49
|
function combineDefaultConfigWithUserConfig(userConfiguration) {
|
|
51
50
|
let defaultConfig = getDefaultConfig();
|
|
52
51
|
let configurationObj = {};
|
|
53
52
|
Object.keys(userConfiguration).forEach(configKey => {
|
|
54
|
-
checkForDeprecatedKeys(configKey);
|
|
55
53
|
let configValue = userConfiguration[configKey];
|
|
56
54
|
if (configValue !== null && configValue !== undefined) {
|
|
57
55
|
configurationObj[configKey] = configValue;
|
|
@@ -110,22 +108,26 @@ function combineDefaultConfigWithUserConfig(userConfiguration) {
|
|
|
110
108
|
*
|
|
111
109
|
* @returns {UserConfig}
|
|
112
110
|
*/
|
|
111
|
+
|
|
112
|
+
function getConfigFilePath() {
|
|
113
|
+
return _path.default.resolve(process.cwd(), (0, _configFileNameProvider.getUATFileName)());
|
|
114
|
+
}
|
|
113
115
|
function generateConfigFromFile() {
|
|
114
|
-
if (cachedConfig
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
116
|
+
if (cachedConfig === null) {
|
|
117
|
+
// Getting the default config's from framework
|
|
118
|
+
const uatConfig = new _Configuration.default(getDefaultConfig());
|
|
119
|
+
// overriding the application config's from project
|
|
120
|
+
const appConfig = new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)());
|
|
121
|
+
const userArgConfig = new _Configuration.default(_UserArgs.default.parseToObject(process.argv.slice(2)));
|
|
122
|
+
// overriding the user config's from CLI
|
|
123
|
+
uatConfig.addAll(appConfig);
|
|
124
|
+
uatConfig.addAll(userArgConfig);
|
|
125
|
+
cachedConfig = uatConfig.getAll();
|
|
124
126
|
}
|
|
125
|
-
return
|
|
127
|
+
return cachedConfig;
|
|
126
128
|
}
|
|
127
129
|
function isUserConfigFileAvailable() {
|
|
128
|
-
const filePath =
|
|
130
|
+
const filePath = getConfigFilePath();
|
|
129
131
|
if ((0, _fs.existsSync)(filePath)) {
|
|
130
132
|
return true;
|
|
131
133
|
}
|
|
@@ -9,6 +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
|
+
const uatConfig = (0, _readConfigFile.generateConfigFromFile)();
|
|
12
13
|
const {
|
|
13
14
|
browsers,
|
|
14
15
|
trace,
|
|
@@ -25,7 +26,7 @@ const {
|
|
|
25
26
|
stepDefinitionsFolder,
|
|
26
27
|
testIdAttribute,
|
|
27
28
|
globalTimeout
|
|
28
|
-
} =
|
|
29
|
+
} = uatConfig;
|
|
29
30
|
const projects = (0, _configUtils.getProjects)({
|
|
30
31
|
browsers,
|
|
31
32
|
isAuthMode,
|
|
@@ -38,9 +39,10 @@ const testDir = (0, _configUtils.getTestDir)(bddMode, process.cwd(), {
|
|
|
38
39
|
featureFilesFolder,
|
|
39
40
|
stepDefinitionsFolder
|
|
40
41
|
});
|
|
41
|
-
|
|
42
|
+
const use = {
|
|
42
43
|
trace,
|
|
43
44
|
video,
|
|
45
|
+
viewport,
|
|
44
46
|
testIdAttribute
|
|
45
47
|
};
|
|
46
48
|
|
|
@@ -50,13 +52,11 @@ let use = {
|
|
|
50
52
|
* @returns {import('@playwright/test').PlaywrightTestConfig}
|
|
51
53
|
*/
|
|
52
54
|
function getPlaywrightConfig() {
|
|
53
|
-
|
|
55
|
+
const playwrightConfig = {
|
|
54
56
|
testDir,
|
|
55
57
|
globalTimeout: globalTimeout || 3600000,
|
|
56
58
|
outputDir: _path.default.join(process.cwd(), 'uat', 'test-results'),
|
|
57
59
|
fullyParallel: true,
|
|
58
|
-
forbidOnly: !!process.env.CI,
|
|
59
|
-
retries: process.env.CI ? 2 : 0,
|
|
60
60
|
reporter: [['html', {
|
|
61
61
|
outputFolder: reportPath,
|
|
62
62
|
open: openReportOn
|
|
@@ -75,7 +75,9 @@ function getPlaywrightConfig() {
|
|
|
75
75
|
name: 'cleanup',
|
|
76
76
|
testMatch: /.*\.teardown\.js/,
|
|
77
77
|
testDir: _path.default.join(process.cwd(), 'uat')
|
|
78
|
-
}, ...projects] : [...projects]
|
|
78
|
+
}, ...projects] : [...projects],
|
|
79
|
+
...uatConfig
|
|
79
80
|
};
|
|
81
|
+
return playwrightConfig;
|
|
80
82
|
}
|
|
81
83
|
var _default = exports.default = (0, _test.defineConfig)(getPlaywrightConfig());
|
|
@@ -10,10 +10,9 @@ exports.getTestDir = getTestDir;
|
|
|
10
10
|
var _test = require("@playwright/test");
|
|
11
11
|
var _path = _interopRequireDefault(require("path"));
|
|
12
12
|
var _readConfigFile = require("../readConfigFile");
|
|
13
|
-
var
|
|
13
|
+
var _playwrightBdd = require("playwright-bdd");
|
|
14
14
|
var _logger = require("../../../utils/logger");
|
|
15
15
|
var _browserTypes = require("../constants/browserTypes");
|
|
16
|
-
var _configFileNameProvider = require("../helpers/configFileNameProvider");
|
|
17
16
|
var _fileUtils = require("../../../utils/fileUtils");
|
|
18
17
|
/**
|
|
19
18
|
** Playwright project configuration
|
|
@@ -147,11 +146,15 @@ function getPathsForFeatureFiles(cwd) {
|
|
|
147
146
|
function getTestDir(bddMode, cwd, {
|
|
148
147
|
stepDefinitionsFolder
|
|
149
148
|
}) {
|
|
150
|
-
return bddMode ? (0,
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
return bddMode ? (0, _playwrightBdd.defineBddConfig)({
|
|
150
|
+
features: getPathsForFeatureFiles(cwd),
|
|
151
|
+
steps: [_path.default.join(cwd, 'uat', '**', stepDefinitionsFolder, '*.spec.js'), require.resolve('../fixtures.js')],
|
|
152
|
+
importTestFrom: require.resolve('../fixtures.js'),
|
|
153
153
|
featuresRoot: _path.default.join(cwd, 'uat'),
|
|
154
154
|
outputDir: _path.default.join(cwd, 'uat', '.features-gen'),
|
|
155
|
+
disableWarnings: {
|
|
156
|
+
importTestFrom: true
|
|
157
|
+
},
|
|
155
158
|
publish: true
|
|
156
159
|
}) : _path.default.join(cwd, 'uat');
|
|
157
160
|
}
|