@zohodesk/testinglibrary 0.4.32-experimental → 0.4.33-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/.gitlab-ci.yml +12 -20
- package/README.md +54 -1
- package/build/core/playwright/builtInFixtures/page.js +2 -6
- package/build/core/playwright/custom-commands.js +1 -1
- package/build/core/playwright/fixtures.js +24 -0
- package/build/core/playwright/helpers/fileMutex.js +2 -2
- package/build/core/playwright/index.js +10 -23
- package/build/core/playwright/runner/SpawnRunner.js +2 -2
- package/build/core/playwright/setup/config-creator.js +13 -8
- package/build/core/playwright/setup/config-utils.js +8 -25
- package/build/core/playwright/test-runner.js +1 -1
- package/build/decorators.d.ts +1 -1
- package/build/decorators.js +1 -1
- package/build/setup-folder-structure/samples/accountLogin-sample.js +19 -0
- package/build/setup-folder-structure/samples/actors-index.js +2 -0
- package/build/setup-folder-structure/samples/auth-setup-sample.js +10 -68
- 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/samples/testSetup-sample.js +14 -0
- package/build/setup-folder-structure/samples/uat-config-sample.js +3 -1
- package/build/setup-folder-structure/setupProject.js +22 -5
- package/npm-shrinkwrap.json +6172 -2202
- package/package.json +12 -11
- package/playwright.config.js +0 -48
- 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/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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:
|
|
1
|
+
image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
|
|
2
2
|
|
|
3
3
|
workflow:
|
|
4
4
|
rules:
|
|
@@ -18,14 +18,19 @@ default:
|
|
|
18
18
|
paths:
|
|
19
19
|
- node_modules
|
|
20
20
|
- build
|
|
21
|
+
- npm-shrinkwrap.json
|
|
21
22
|
|
|
22
23
|
# Install dependencies stage
|
|
23
24
|
build:
|
|
24
25
|
stage: build
|
|
25
26
|
script:
|
|
27
|
+
- npm -v
|
|
28
|
+
- node -v
|
|
26
29
|
- npm install --ignore-scripts
|
|
27
30
|
- npm run build
|
|
28
31
|
- npm install
|
|
32
|
+
- npm shrinkwrap
|
|
33
|
+
- npm run build
|
|
29
34
|
|
|
30
35
|
# Unit tests stage
|
|
31
36
|
unit:
|
|
@@ -45,9 +50,7 @@ uat-auth:
|
|
|
45
50
|
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
46
51
|
- output=$(npm run uatauth)
|
|
47
52
|
- echo "$output"
|
|
48
|
-
-
|
|
49
|
-
- exit 1
|
|
50
|
-
- fi
|
|
53
|
+
- node ../ValidateUATReport.js examples
|
|
51
54
|
|
|
52
55
|
artifacts:
|
|
53
56
|
when: always
|
|
@@ -61,9 +64,7 @@ uat-noauth:
|
|
|
61
64
|
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
62
65
|
- output=$(npm run uatnoauth)
|
|
63
66
|
- echo "$output"
|
|
64
|
-
-
|
|
65
|
-
- exit 1
|
|
66
|
-
- fi
|
|
67
|
+
- node ../ValidateUATReport.js examples
|
|
67
68
|
|
|
68
69
|
artifacts:
|
|
69
70
|
when: always
|
|
@@ -77,9 +78,7 @@ uat-profile:
|
|
|
77
78
|
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
78
79
|
- output=$(npm run uatprofile)
|
|
79
80
|
- echo "$output"
|
|
80
|
-
-
|
|
81
|
-
- exit 1
|
|
82
|
-
- fi
|
|
81
|
+
- node ../ValidateUATReport.js examples
|
|
83
82
|
|
|
84
83
|
artifacts:
|
|
85
84
|
when: always
|
|
@@ -89,17 +88,12 @@ uat-profile:
|
|
|
89
88
|
|
|
90
89
|
uat-unauth:
|
|
91
90
|
stage: uat
|
|
92
|
-
image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v2
|
|
93
91
|
script:
|
|
94
|
-
- npm install
|
|
95
|
-
- npm run build
|
|
96
92
|
- cd examples
|
|
97
93
|
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
98
94
|
- output=$(npm run uatunauth)
|
|
99
95
|
- echo "$output"
|
|
100
|
-
-
|
|
101
|
-
- exit 1
|
|
102
|
-
- fi
|
|
96
|
+
- node ../ValidateUATReport.js examples
|
|
103
97
|
|
|
104
98
|
|
|
105
99
|
artifacts:
|
|
@@ -112,11 +106,9 @@ uat-nobdd:
|
|
|
112
106
|
script:
|
|
113
107
|
- cd nobdd
|
|
114
108
|
- npm install $(npm pack ../../testing-framework | tail -1)
|
|
115
|
-
- output=$(npm run uatnobdd)
|
|
109
|
+
- output=$(npm run uatnobdd -- --headless)
|
|
116
110
|
- echo "$output"
|
|
117
|
-
-
|
|
118
|
-
- exit 1
|
|
119
|
-
- fi
|
|
111
|
+
- node ../ValidateUATReport.js nobdd
|
|
120
112
|
|
|
121
113
|
|
|
122
114
|
artifacts:
|
package/README.md
CHANGED
|
@@ -26,13 +26,66 @@
|
|
|
26
26
|
### Bug fix
|
|
27
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
28
|
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
## Version History
|
|
31
|
+
|
|
32
|
+
### v3.0.8 - 25-12-2024
|
|
33
|
+
|
|
34
|
+
#### Enhancement
|
|
35
|
+
- Added support to disable headless mode using command line arguments
|
|
36
|
+
- Proper validation added for node 14 build process
|
|
37
|
+
- Removed unwanted uat.config.js files in test projects (examples / nobdd)
|
|
38
|
+
|
|
39
|
+
### v0.2.9.2 - 22-11-2024
|
|
40
|
+
|
|
41
|
+
#### BugFix
|
|
42
|
+
- Implemented synchronization for the login process. This fix will help avoid login session-related failures in UAT.
|
|
43
|
+
|
|
44
|
+
### v0.3.1 - 13-11-2024
|
|
45
|
+
|
|
46
|
+
#### Issue Fix
|
|
47
|
+
- Adding bddmode to get the fixtures.
|
|
48
|
+
|
|
49
|
+
### v0.2.9.1 - 14-11-2024
|
|
50
|
+
|
|
51
|
+
#### Enhancement
|
|
52
|
+
- Beta feature Actors and edition configurations are unified
|
|
53
|
+
|
|
54
|
+
### v0.2.9 - 25-10-2024
|
|
30
55
|
|
|
31
56
|
#### Feature
|
|
32
57
|
- Added support for scenario level tag support
|
|
33
58
|
- Added a new cli optin like uat-validate to validate the feature files using playwright-bdd
|
|
34
59
|
- Mode based configuration implementations
|
|
35
60
|
- @only option enabled in dev pipeline
|
|
61
|
+
- Latest setup related configuration changed for init option
|
|
62
|
+
|
|
63
|
+
### v0.3.0 - 25-10-2024
|
|
64
|
+
|
|
65
|
+
#### Features
|
|
66
|
+
- Added support for scenario level tag support
|
|
67
|
+
- Updated the configuration for `video` and `trace` to accept Playwright-specific values instead of boolean values.
|
|
68
|
+
- Below package versions are updated in this release.
|
|
69
|
+
- playwright - 1.48.0,
|
|
70
|
+
- playwright-bdd - 7.5.0,
|
|
71
|
+
- @playwright/test - 1.48.0,
|
|
72
|
+
- @cucumber/cucumber - 11.0.1
|
|
73
|
+
- From this version, We adopt the playwright-bdd as library instead of modified source
|
|
74
|
+
- Published on 11-11-2024
|
|
75
|
+
|
|
76
|
+
#### Deprecations
|
|
77
|
+
- **Deprecated**: Passing `video` and `trace` as boolean (`true`/`false`) in project configuration.
|
|
78
|
+
- **New Approach**: Use Playwright values for `video` and `trace` options, such as `'on'`, `'retain-on-failure'`, or `'off'`.
|
|
79
|
+
|
|
80
|
+
### v0.3.1 - 13-11-2024
|
|
81
|
+
|
|
82
|
+
#### Issue Fix
|
|
83
|
+
- Adding bddmode to get the fixtures.
|
|
84
|
+
|
|
85
|
+
### v0.3.3 - 27-11-2024
|
|
86
|
+
|
|
87
|
+
#### Feature
|
|
88
|
+
- Custom report integration support (ReportPortal)
|
|
36
89
|
|
|
37
90
|
### v0.2.9.1 - 14-11-2024
|
|
38
91
|
|
|
@@ -1,12 +1,10 @@
|
|
|
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.default = void 0;
|
|
8
7
|
var _auth = require("../helpers/auth");
|
|
9
|
-
var _getUrlOrigin = _interopRequireDefault(require("../helpers/auth/getUrlOrigin"));
|
|
10
8
|
var _readConfigFile = require("../readConfigFile");
|
|
11
9
|
/* eslint-disable global-require */
|
|
12
10
|
|
|
@@ -75,14 +73,12 @@ var _default = exports.default = {
|
|
|
75
73
|
//This block is used to skip the login process if the @unauthenticated tag is added to the script
|
|
76
74
|
if ($tags.includes('@unauthenticated')) {
|
|
77
75
|
await context.clearCookies();
|
|
78
|
-
await use(page);
|
|
79
76
|
return;
|
|
80
77
|
}
|
|
81
78
|
const {
|
|
82
79
|
isAuthMode
|
|
83
80
|
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
84
81
|
if (!isAuthMode) {
|
|
85
|
-
await use(page);
|
|
86
82
|
return;
|
|
87
83
|
}
|
|
88
84
|
const testPortalDetails = getCustomAccountDetails($tags);
|
|
@@ -101,8 +97,8 @@ var _default = exports.default = {
|
|
|
101
97
|
}, loginSteps);
|
|
102
98
|
process.env.actorInfo = JSON.stringify(testPortalDetails);
|
|
103
99
|
}
|
|
104
|
-
} catch (
|
|
105
|
-
console.error('Error during page',
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.error('Error during page', error);
|
|
106
102
|
} finally {
|
|
107
103
|
await performDefaultPageSteps({
|
|
108
104
|
context,
|
|
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CUSTOM_COMMANDS = void 0;
|
|
7
|
-
const CUSTOM_COMMANDS = exports.CUSTOM_COMMANDS = ['mode', 'tags', 'edition', 'browsers', 'filePath'];
|
|
7
|
+
const CUSTOM_COMMANDS = exports.CUSTOM_COMMANDS = ['mode', 'tags', 'edition', 'browsers', 'filePath', 'headless'];
|
|
@@ -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
|
+
};
|
|
@@ -21,13 +21,13 @@ class FileMutex {
|
|
|
21
21
|
}
|
|
22
22
|
async acquire() {
|
|
23
23
|
_assertClassBrand(_FileMutex_brand, this, _createDirectoryIfNotExist).call(this);
|
|
24
|
-
const lockFilePath =
|
|
24
|
+
const lockFilePath = _assertClassBrand(_FileMutex_brand, this, _getLockFilePath).call(this);
|
|
25
25
|
try {
|
|
26
26
|
if (!(0, _fs.existsSync)(lockFilePath)) {
|
|
27
27
|
console.log(`[DEBUG] Creating missing lock file:`, this.lockFileName);
|
|
28
28
|
(0, _fs.writeFileSync)(lockFilePath, 'locked');
|
|
29
29
|
}
|
|
30
|
-
await _properLockfile.default.lock(
|
|
30
|
+
await _properLockfile.default.lock(lockFilePath, this.options);
|
|
31
31
|
} catch (err) {
|
|
32
32
|
throw new Error(`Failed to acquire lock after ${this.options.retries.retries} attempts: ${err.message}`);
|
|
33
33
|
}
|
|
@@ -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;
|
|
@@ -33,9 +33,9 @@ class SpawnRunner extends _Runner.default {
|
|
|
33
33
|
const {
|
|
34
34
|
tagArgs
|
|
35
35
|
} = this.runnerObj;
|
|
36
|
-
const configPath = (0, _readConfigFile.isUserConfigFileAvailable)() ? _path.default.resolve(__dirname, '../', 'setup', 'config-creator.js') : _path.default.resolve('../', '../', '../', '../', 'playwrightConfig.js');
|
|
36
|
+
const configPath = (0, _readConfigFile.isUserConfigFileAvailable)() ? _path.default.resolve(__dirname, '../', 'setup', 'config-creator.js') : _path.default.resolve(__dirname, '../', '../', '../', '../', 'playwrightConfig.js');
|
|
37
37
|
const beforeCommand = 'node';
|
|
38
|
-
const bddGenPath = _path.default.resolve(
|
|
38
|
+
const bddGenPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('bddgen'));
|
|
39
39
|
const beforeArgs = [bddGenPath, '-c', require.resolve(configPath)];
|
|
40
40
|
if (tagArgs) {
|
|
41
41
|
beforeArgs.push('--tags');
|
|
@@ -25,7 +25,8 @@ const {
|
|
|
25
25
|
featureFilesFolder,
|
|
26
26
|
stepDefinitionsFolder,
|
|
27
27
|
testIdAttribute,
|
|
28
|
-
globalTimeout
|
|
28
|
+
globalTimeout,
|
|
29
|
+
customReporter
|
|
29
30
|
} = uatConfig;
|
|
30
31
|
const projects = (0, _configUtils.getProjects)({
|
|
31
32
|
browsers,
|
|
@@ -39,12 +40,19 @@ const testDir = (0, _configUtils.getTestDir)(bddMode, process.cwd(), {
|
|
|
39
40
|
featureFilesFolder,
|
|
40
41
|
stepDefinitionsFolder
|
|
41
42
|
});
|
|
42
|
-
const
|
|
43
|
+
const use = {
|
|
43
44
|
trace,
|
|
44
45
|
video,
|
|
45
46
|
viewport,
|
|
46
47
|
testIdAttribute
|
|
47
|
-
}
|
|
48
|
+
};
|
|
49
|
+
let reporter = [['html', {
|
|
50
|
+
outputFolder: reportPath,
|
|
51
|
+
open: openReportOn
|
|
52
|
+
}], ['list'], ['./custom-reporter.js']];
|
|
53
|
+
if (customReporter) {
|
|
54
|
+
reporter = [customReporter, ...reporter];
|
|
55
|
+
}
|
|
48
56
|
|
|
49
57
|
/**
|
|
50
58
|
* Playwright configuration object
|
|
@@ -57,15 +65,12 @@ function getPlaywrightConfig() {
|
|
|
57
65
|
globalTimeout: globalTimeout || 3600000,
|
|
58
66
|
outputDir: _path.default.join(process.cwd(), 'uat', 'test-results'),
|
|
59
67
|
fullyParallel: true,
|
|
60
|
-
reporter
|
|
61
|
-
outputFolder: reportPath,
|
|
62
|
-
open: openReportOn
|
|
63
|
-
}], ['list'], ['./custom-reporter.js']],
|
|
68
|
+
reporter,
|
|
64
69
|
timeout: testTimeout,
|
|
65
70
|
expect: {
|
|
66
71
|
timeout: expectTimeout
|
|
67
72
|
},
|
|
68
|
-
use
|
|
73
|
+
use,
|
|
69
74
|
projects: isAuthMode ? [{
|
|
70
75
|
name: 'setup',
|
|
71
76
|
testMatch: /.*\.setup\.js/,
|
|
@@ -7,14 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getBrowsersList = getBrowsersList;
|
|
8
8
|
exports.getProjects = getProjects;
|
|
9
9
|
exports.getTestDir = getTestDir;
|
|
10
|
-
exports.getTestUseOptions = getTestUseOptions;
|
|
11
10
|
var _test = require("@playwright/test");
|
|
12
11
|
var _path = _interopRequireDefault(require("path"));
|
|
13
12
|
var _readConfigFile = require("../readConfigFile");
|
|
14
|
-
var
|
|
13
|
+
var _playwrightBdd = require("playwright-bdd");
|
|
15
14
|
var _logger = require("../../../utils/logger");
|
|
16
15
|
var _browserTypes = require("../constants/browserTypes");
|
|
17
|
-
var _configFileNameProvider = require("../helpers/configFileNameProvider");
|
|
18
16
|
var _fileUtils = require("../../../utils/fileUtils");
|
|
19
17
|
/**
|
|
20
18
|
** Playwright project configuration
|
|
@@ -148,30 +146,15 @@ function getPathsForFeatureFiles(cwd) {
|
|
|
148
146
|
function getTestDir(bddMode, cwd, {
|
|
149
147
|
stepDefinitionsFolder
|
|
150
148
|
}) {
|
|
151
|
-
return bddMode ? (0,
|
|
152
|
-
|
|
153
|
-
|
|
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'),
|
|
154
153
|
featuresRoot: _path.default.join(cwd, 'uat'),
|
|
155
154
|
outputDir: _path.default.join(cwd, 'uat', '.features-gen'),
|
|
155
|
+
disableWarnings: {
|
|
156
|
+
importTestFrom: true
|
|
157
|
+
},
|
|
156
158
|
publish: true
|
|
157
159
|
}) : _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;
|
|
177
160
|
}
|
|
@@ -24,7 +24,7 @@ var _RunnerHelper = _interopRequireDefault(require("./runner/RunnerHelper"));
|
|
|
24
24
|
var _Runner = _interopRequireDefault(require("./runner/Runner"));
|
|
25
25
|
function runPreprocessing(tagArgs, configPath) {
|
|
26
26
|
const beforeCommand = 'node';
|
|
27
|
-
const bddGenPath = _path.default.resolve(
|
|
27
|
+
const bddGenPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('bddgen'));
|
|
28
28
|
const beforeArgs = [bddGenPath, '-c', configPath];
|
|
29
29
|
if (tagArgs) {
|
|
30
30
|
beforeArgs.push('--tags');
|
package/build/decorators.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from 'playwright-bdd/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("playwright-bdd/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,19 @@
|
|
|
1
|
+
// This is the sample file generated by testing framework. You can change as per the respective project login
|
|
2
|
+
|
|
3
|
+
const getUrlOrigin = require('../shared/url-helpers/getUrlOrigin');
|
|
4
|
+
|
|
5
|
+
async function accountLogin( { page, email, password } ) {
|
|
6
|
+
await page.locator('#login_id').fill(email);
|
|
7
|
+
await page.locator('#nextbtn').click();
|
|
8
|
+
await page.locator('#password').fill(password);
|
|
9
|
+
await page.locator('#nextbtn').click();
|
|
10
|
+
|
|
11
|
+
const domainUrlOrigin = getUrlOrigin(process.env.domain);
|
|
12
|
+
await page.waitForNavigation();
|
|
13
|
+
await Promise.race([
|
|
14
|
+
page.waitForURL(`${domainUrlOrigin}/**`),
|
|
15
|
+
page.waitForURL('**/announcement/**')
|
|
16
|
+
]);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = accountLogin;
|
|
@@ -1,73 +1,15 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import { test as setup, expect } from '@zohodesk/testinglibrary';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import {
|
|
4
|
+
performLoginSteps,
|
|
5
|
+
getDefaultActor
|
|
6
|
+
} from '@zohodesk/testinglibrary/helpers';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import { loginSteps , validateLogin } from './testSetup';
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const user = getDefaultActor();
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
return JSON.parse(cookies);
|
|
18
|
-
} catch (err) {
|
|
19
|
-
Logger.error(err);
|
|
20
|
-
throw new Error(
|
|
21
|
-
` Error while parsing cookies ${err} \n${path.resolve(
|
|
22
|
-
process.cwd(),
|
|
23
|
-
authFilePath
|
|
24
|
-
)} File is Empty`
|
|
25
|
-
);
|
|
26
|
-
// process.exit()
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
const authDirectory = getAuthFileDirectory(); //path.resolve(process.cwd(), 'uat', 'playwright', '.auth');
|
|
30
|
-
if (!existsSync(authDirectory)) {
|
|
31
|
-
console.log('Creating auth directory for the first time setup...');
|
|
32
|
-
mkdirSync(authDirectory, { recursive: true });
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
userdata.forEach(data => {
|
|
36
|
-
const authFile = path.resolve(path.join(authDirectory, `${data.filename}`));
|
|
37
|
-
if (!existsSync(authFile)) {
|
|
38
|
-
console.log('creating auth file..');
|
|
39
|
-
writeFileSync(authFile, JSON.stringify(authContent, null, 2));
|
|
40
|
-
}
|
|
41
|
-
setup(data.description, async ({ page }) => {
|
|
42
|
-
try {
|
|
43
|
-
const cookies = readFileSync(authFile);
|
|
44
|
-
const parsedCookies = convertCookiesToParse(cookies, authFile);
|
|
45
|
-
await page
|
|
46
|
-
.context()
|
|
47
|
-
.addCookies(
|
|
48
|
-
parsedCookies.cookies === undefined ? [] : parsedCookies.cookies
|
|
49
|
-
);
|
|
50
|
-
await page.goto(page.getBaseUrl());
|
|
51
|
-
await page.waitForLoadState();
|
|
52
|
-
if (await page.url().includes(process.env.domain)) {
|
|
53
|
-
await page.waitForSelector(data.locator);
|
|
54
|
-
} else {
|
|
55
|
-
throw new Error(LOGIN_ERR_MESSAGE);
|
|
56
|
-
}
|
|
57
|
-
} catch (err) {
|
|
58
|
-
if (err.message === LOGIN_ERR_MESSAGE) {
|
|
59
|
-
await expect(page.locator('.load-bg')).toBeHidden();
|
|
60
|
-
await page.locator('#login_id').type(data.useremail);
|
|
61
|
-
await page.locator('#nextbtn').click();
|
|
62
|
-
await page.locator('#password').type(data.password);
|
|
63
|
-
await page.locator('#nextbtn').click();
|
|
64
|
-
|
|
65
|
-
await page.waitForLoadState('networkidle');
|
|
66
|
-
|
|
67
|
-
await page.waitForSelector(data.locator);
|
|
68
|
-
|
|
69
|
-
await page.context().storageState({ path: authFile });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
});
|
|
12
|
+
setup(`${user.edition} - Authentication`, async ({ page }) => {
|
|
13
|
+
//Implement performLoginSteps here
|
|
14
|
+
await performLoginSteps({page, ...user},validateLogin ,loginSteps);
|
|
15
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "1",
|
|
4
|
+
"edition": "free",
|
|
5
|
+
"orgName": "orgFree",
|
|
6
|
+
"profiles": [
|
|
7
|
+
{
|
|
8
|
+
"profile": "admin",
|
|
9
|
+
"email": "admin+free@zohotest.com",
|
|
10
|
+
"password": "password@0987"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"profile": "agent",
|
|
14
|
+
"email": "agent@zohotest.com",
|
|
15
|
+
"password": "password@12345"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"profile": "lightagent",
|
|
19
|
+
"email": "lightagent@zohotest.com",
|
|
20
|
+
"password": "password@12345"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable global-require */
|
|
2
|
+
const accountLogin = require('./accountLogin');
|
|
3
|
+
|
|
4
|
+
async function verifyPageIsLoaded({page}) {
|
|
5
|
+
|
|
6
|
+
//Implement your validation logic here
|
|
7
|
+
//Refer deskclientapp testSetup.js
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
loginSteps:accountLogin,
|
|
12
|
+
validateLogin:verifyPageIsLoaded,
|
|
13
|
+
page:()=>{}
|
|
14
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const testSetup = require('../../fixtures/testSetup');
|
|
1
2
|
/**
|
|
2
3
|
* @typedef {Object|null} viewportConfig
|
|
3
4
|
* @property {number} width - width of the viewport
|
|
@@ -40,5 +41,6 @@ module.exports = {
|
|
|
40
41
|
bddMode: true,
|
|
41
42
|
featureFilesFolder: 'feature-files',
|
|
42
43
|
stepDefinitionsFolder: 'steps',
|
|
43
|
-
viewport: { width: 1280, height: 720 }
|
|
44
|
+
viewport: { width: 1280, height: 720 },
|
|
45
|
+
testSetup
|
|
44
46
|
}
|
|
@@ -10,8 +10,9 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
10
10
|
var _logger = require("../utils/logger");
|
|
11
11
|
function getScriptsToBeAdded() {
|
|
12
12
|
return {
|
|
13
|
-
"uat": "ZDTestingFramework test --mode=
|
|
14
|
-
"uat-debug": "ZDTestingFramework test --mode=
|
|
13
|
+
"uat": "ZDTestingFramework test --mode=dev --headed",
|
|
14
|
+
"uat-debug": "ZDTestingFramework test --mode=dev --debug",
|
|
15
|
+
"uat-validate": "ZDTestingFramework validate",
|
|
15
16
|
"uat-report": "ZDTestingFramework report --port=9009",
|
|
16
17
|
"codegen": "ZDTestingFramework codegen deskclientapp.localzoho.com/agent"
|
|
17
18
|
};
|
|
@@ -71,8 +72,11 @@ function createAuthenticationFile() {
|
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
(0, _fs.writeFileSync)(_path.default.resolve(process.cwd(), 'uat', 'fixtures', 'auth.setup.js'), getSetupFileAsString('auth-setup-sample.js'), null, 2);
|
|
74
|
-
(0, _fs.writeFileSync)(_path.default.resolve(process.cwd(), 'uat', 'fixtures', 'authUsers.json'), getSetupFileAsString('authUsers-sample.json'), null, 2);
|
|
75
75
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Creating Authentication File ....');
|
|
76
|
+
(0, _fs.writeFileSync)(_path.default.resolve(process.cwd(), 'uat', 'fixtures', 'accountLogin.js'), getSetupFileAsString('accountLogin-sample.js'), null, 2);
|
|
77
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Creating login script File ....');
|
|
78
|
+
(0, _fs.writeFileSync)(_path.default.resolve(process.cwd(), 'uat', 'fixtures', 'testSetup.js'), getSetupFileAsString('testSetup-sample.js'), null, 2);
|
|
79
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Creating testSetup File ....');
|
|
76
80
|
} catch (err) {
|
|
77
81
|
_logger.Logger.error(err);
|
|
78
82
|
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, 'Something went wrong ! Folder not Created. Please re-initialize npm init-uat');
|
|
@@ -84,8 +88,21 @@ function createAuthenticationFile() {
|
|
|
84
88
|
function createConfigJson() {
|
|
85
89
|
const uatFolder = _path.default.resolve(process.cwd(), 'uat');
|
|
86
90
|
if ((0, _fs.existsSync)(uatFolder)) {
|
|
87
|
-
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Creating
|
|
88
|
-
(0, _fs.
|
|
91
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Creating settings.json file inside UAT Folder');
|
|
92
|
+
if (!(0, _fs.existsSync)(_path.default.resolve(uatFolder, 'conf', 'default'))) {
|
|
93
|
+
(0, _fs.mkdirSync)(_path.default.resolve(uatFolder, 'conf', 'default'), {
|
|
94
|
+
recursive: true
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
(0, _fs.writeFileSync)(_path.default.resolve(uatFolder, 'conf', 'default', './settings.json'), getSetupFileAsString('settings.json'), null, 2);
|
|
98
|
+
if (!(0, _fs.existsSync)(_path.default.resolve(uatFolder, 'conf', 'default', 'actors', 'editions'))) {
|
|
99
|
+
(0, _fs.mkdirSync)(_path.default.resolve(uatFolder, 'conf', 'default', 'actors', 'editions'), {
|
|
100
|
+
recursive: true
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
(0, _fs.writeFileSync)(_path.default.resolve(uatFolder, 'conf', 'default', 'actors', 'editions', 'free.json'), getSetupFileAsString('free-sample.json'), null, 2);
|
|
104
|
+
(0, _fs.writeFileSync)(_path.default.resolve(uatFolder, 'conf', 'default', 'actors', 'editions', 'index.js'), getSetupFileAsString('editions-index.js'), null, 2);
|
|
105
|
+
(0, _fs.writeFileSync)(_path.default.resolve(uatFolder, 'conf', 'default', 'actors', 'index.js'), getSetupFileAsString('actors-index.js'), null, 2);
|
|
89
106
|
} else {
|
|
90
107
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Something went wrong. Please re-initialize the @zohodesk/testinglibrary');
|
|
91
108
|
}
|