@zohodesk/testinglibrary 0.4.21-experimental → 0.4.22-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 +4 -1
- package/README.md +1 -27
- 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/helpers/fileMutex.js +12 -10
- package/build/core/playwright/index.js +23 -10
- package/build/core/playwright/setup/config-creator.js +3 -3
- package/build/core/playwright/setup/config-utils.js +25 -8
- package/build/core/playwright/tagProcessor.js +28 -18
- 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/auth-setup-sample.js +66 -14
- package/build/setup-folder-structure/samples/authUsers-sample.json +9 -0
- package/build/setup-folder-structure/samples/env-config-sample.json +21 -0
- package/build/setup-folder-structure/setupProject.js +5 -18
- package/nobdd/README.md +1 -0
- package/nobdd/package.json +17 -0
- package/nobdd/uat/conf/default/actors/editions/enterprise.json +24 -0
- package/nobdd/uat/conf/default/actors/editions/index.js +4 -0
- package/{build/setup-folder-structure/samples → nobdd/uat/conf/default}/settings.json +3 -4
- package/nobdd/uat/conf/nobdd/uat.config.js +36 -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 +33 -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 +37 -0
- package/npm-shrinkwrap.json +1404 -2003
- package/package.json +8 -8
- package/build/core/playwright/fixtures.js +0 -24
- package/build/setup-folder-structure/samples/editions-index.js +0 -3
- package/build/setup-folder-structure/samples/free-sample.json +0 -25
- /package/{build/setup-folder-structure/samples/actors-index.js → nobdd/uat/conf/default/actors/index.js} +0 -0
|
@@ -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);
|
|
@@ -39,12 +39,12 @@ const testDir = (0, _configUtils.getTestDir)(bddMode, process.cwd(), {
|
|
|
39
39
|
featureFilesFolder,
|
|
40
40
|
stepDefinitionsFolder
|
|
41
41
|
});
|
|
42
|
-
const
|
|
42
|
+
const testOptions = (0, _configUtils.getTestUseOptions)({
|
|
43
43
|
trace,
|
|
44
44
|
video,
|
|
45
45
|
viewport,
|
|
46
46
|
testIdAttribute
|
|
47
|
-
};
|
|
47
|
+
});
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Playwright configuration object
|
|
@@ -65,7 +65,7 @@ function getPlaywrightConfig() {
|
|
|
65
65
|
expect: {
|
|
66
66
|
timeout: expectTimeout
|
|
67
67
|
},
|
|
68
|
-
use,
|
|
68
|
+
use: testOptions,
|
|
69
69
|
projects: isAuthMode ? [{
|
|
70
70
|
name: 'setup',
|
|
71
71
|
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
|
}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _logger = require("../../utils/logger");
|
|
4
|
-
function _classPrivateMethodInitSpec(
|
|
5
|
-
function _checkPrivateRedeclaration(
|
|
6
|
-
function
|
|
7
|
-
var
|
|
4
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
5
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
6
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
7
|
+
var _buildTagsString = /*#__PURE__*/new WeakSet();
|
|
8
|
+
var _parseEdition = /*#__PURE__*/new WeakSet();
|
|
9
|
+
var _processSingleEdition = /*#__PURE__*/new WeakSet();
|
|
10
|
+
var _processMultipleEditions = /*#__PURE__*/new WeakSet();
|
|
11
|
+
var _getEditionArgs = /*#__PURE__*/new WeakSet();
|
|
12
|
+
var _buildEditionTags = /*#__PURE__*/new WeakSet();
|
|
8
13
|
class TagProcessor {
|
|
9
14
|
constructor(editionOrder) {
|
|
10
|
-
_classPrivateMethodInitSpec(this,
|
|
15
|
+
_classPrivateMethodInitSpec(this, _buildEditionTags);
|
|
16
|
+
_classPrivateMethodInitSpec(this, _getEditionArgs);
|
|
17
|
+
_classPrivateMethodInitSpec(this, _processMultipleEditions);
|
|
18
|
+
_classPrivateMethodInitSpec(this, _processSingleEdition);
|
|
19
|
+
_classPrivateMethodInitSpec(this, _parseEdition);
|
|
20
|
+
_classPrivateMethodInitSpec(this, _buildTagsString);
|
|
11
21
|
this.editionOrder = editionOrder;
|
|
12
22
|
}
|
|
13
23
|
processTags(userArgs) {
|
|
@@ -15,36 +25,36 @@ class TagProcessor {
|
|
|
15
25
|
const edition = userArgs['edition'] || null;
|
|
16
26
|
if (!edition) return tagArgs;
|
|
17
27
|
const editionsArray = edition.split(',');
|
|
18
|
-
const editionTags = editionsArray.length === 1 ?
|
|
28
|
+
const editionTags = editionsArray.length === 1 ? _classPrivateMethodGet(this, _processSingleEdition, _processSingleEdition2).call(this, editionsArray[0], tagArgs) : _classPrivateMethodGet(this, _processMultipleEditions, _processMultipleEditions2).call(this, editionsArray, tagArgs);
|
|
19
29
|
return editionTags;
|
|
20
30
|
}
|
|
21
31
|
}
|
|
22
|
-
function
|
|
32
|
+
function _buildTagsString2(tags, editionTags) {
|
|
23
33
|
return tags && tags !== '' ? `${tags} and not (${editionTags})` : `not (${editionTags})`;
|
|
24
34
|
}
|
|
25
|
-
function
|
|
35
|
+
function _parseEdition2(edition) {
|
|
26
36
|
if (edition.startsWith('<=')) return ['<=', edition.slice(2)];
|
|
27
37
|
if (edition.startsWith('>=')) return ['>=', edition.slice(2)];
|
|
28
38
|
if (edition.startsWith('<')) return ['<', edition.slice(1)];
|
|
29
39
|
if (edition.startsWith('>')) return ['>', edition.slice(1)];
|
|
30
40
|
return [null, edition];
|
|
31
41
|
}
|
|
32
|
-
function
|
|
33
|
-
const editionArgs =
|
|
42
|
+
function _processSingleEdition2(selectedEdition, tagArgs) {
|
|
43
|
+
const editionArgs = _classPrivateMethodGet(this, _getEditionArgs, _getEditionArgs2).call(this, selectedEdition);
|
|
34
44
|
if (editionArgs && editionArgs.length > 0) {
|
|
35
|
-
const editionTags =
|
|
36
|
-
return
|
|
45
|
+
const editionTags = _classPrivateMethodGet(this, _buildEditionTags, _buildEditionTags2).call(this, editionArgs, 'or');
|
|
46
|
+
return _classPrivateMethodGet(this, _buildTagsString, _buildTagsString2).call(this, tagArgs, editionTags);
|
|
37
47
|
}
|
|
38
48
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, `No matching editions for ${selectedEdition} found. Running with default edition`);
|
|
39
49
|
return tagArgs;
|
|
40
50
|
}
|
|
41
|
-
function
|
|
51
|
+
function _processMultipleEditions2(editionsArray, tagArgs) {
|
|
42
52
|
const filteredEditions = this.editionOrder.filter(edition => !editionsArray.includes(edition));
|
|
43
|
-
const editionTags =
|
|
44
|
-
return
|
|
53
|
+
const editionTags = _classPrivateMethodGet(this, _buildEditionTags, _buildEditionTags2).call(this, filteredEditions, 'or');
|
|
54
|
+
return _classPrivateMethodGet(this, _buildTagsString, _buildTagsString2).call(this, tagArgs, editionTags);
|
|
45
55
|
}
|
|
46
|
-
function
|
|
47
|
-
const [operator, editionValue] =
|
|
56
|
+
function _getEditionArgs2(selectedEdition) {
|
|
57
|
+
const [operator, editionValue] = _classPrivateMethodGet(this, _parseEdition, _parseEdition2).call(this, selectedEdition.toLowerCase());
|
|
48
58
|
const index = this.editionOrder.findIndex(edition => edition.toLowerCase() === editionValue);
|
|
49
59
|
if (index === -1) {
|
|
50
60
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, `No matching editions for ${selectedEdition} found. Running with default edition`);
|
|
@@ -63,7 +73,7 @@ function _getEditionArgs(selectedEdition) {
|
|
|
63
73
|
return this.editionOrder.filter((_, i) => i !== index);
|
|
64
74
|
}
|
|
65
75
|
}
|
|
66
|
-
function
|
|
76
|
+
function _buildEditionTags2(editionArgs, operator = 'or') {
|
|
67
77
|
return editionArgs.map(edition => `@edition_${edition}`).join(` ${operator} `);
|
|
68
78
|
}
|
|
69
79
|
module.exports = TagProcessor;
|
|
@@ -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(__dirname, '../', '../', 'bdd-framework', 'cli', 'index.js');
|
|
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 './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;
|
|
@@ -1,21 +1,73 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import { test as setup, expect } from '@zohodesk/testinglibrary';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from '
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
5
|
+
import { getAuthFileDirectory } from '../../core/playwright';
|
|
6
|
+
import { Logger } from '../../utils/logger';
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const userdata = require('./authUsers.json');
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const authContent = { cookies: [] };
|
|
11
|
+
|
|
12
|
+
const LOGIN_ERR_MESSAGE = 'Need go be logged in';
|
|
13
|
+
// const AUTH_ERR_MESSAGE = `Founded Path - ${path.resolve(process.cwd(),'uat','playwright','.auth')} \n Find if file is Properly Created. Cookies Cannot Be Read .. `
|
|
14
|
+
|
|
15
|
+
function convertCookiesToParse(cookies, authFilePath) {
|
|
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 });
|
|
14
33
|
}
|
|
15
34
|
|
|
16
|
-
|
|
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);
|
|
17
68
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
69
|
+
await page.context().storageState({ path: authFile });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dev": {
|
|
3
|
+
"domain": "https://desk.localzoho.com/agent",
|
|
4
|
+
"orgName": "org-name",
|
|
5
|
+
"deptName": "dept-name",
|
|
6
|
+
"moduleName": "module-name",
|
|
7
|
+
"devURL": "Provide your devURL here"
|
|
8
|
+
},
|
|
9
|
+
"prod": {
|
|
10
|
+
"domain": "https://desk.localzoho.com/agent",
|
|
11
|
+
"orgName": "org-name",
|
|
12
|
+
"deptName": "dept-name",
|
|
13
|
+
"moduleName": "module-name"
|
|
14
|
+
},
|
|
15
|
+
"k8test": {
|
|
16
|
+
"domain": "https://desk.localzoho.com/agent",
|
|
17
|
+
"orgName": "org-name",
|
|
18
|
+
"deptName": "dept-name",
|
|
19
|
+
"moduleName": "module-name"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -10,9 +10,8 @@ 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=
|
|
15
|
-
"uat-validate": "ZDTestingFramework validate",
|
|
13
|
+
"uat": "ZDTestingFramework test --mode=prod --headed",
|
|
14
|
+
"uat-debug": "ZDTestingFramework test --mode=prod --debug",
|
|
16
15
|
"uat-report": "ZDTestingFramework report --port=9009",
|
|
17
16
|
"codegen": "ZDTestingFramework codegen deskclientapp.localzoho.com/agent"
|
|
18
17
|
};
|
|
@@ -72,6 +71,7 @@ function createAuthenticationFile() {
|
|
|
72
71
|
});
|
|
73
72
|
}
|
|
74
73
|
(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
76
|
} catch (err) {
|
|
77
77
|
_logger.Logger.error(err);
|
|
@@ -84,21 +84,8 @@ function createAuthenticationFile() {
|
|
|
84
84
|
function createConfigJson() {
|
|
85
85
|
const uatFolder = _path.default.resolve(process.cwd(), 'uat');
|
|
86
86
|
if ((0, _fs.existsSync)(uatFolder)) {
|
|
87
|
-
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Creating
|
|
88
|
-
|
|
89
|
-
(0, _fs.mkdirSync)(_path.default.resolve(uatFolder, 'conf', 'default'), {
|
|
90
|
-
recursive: true
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
(0, _fs.writeFileSync)(_path.default.resolve(uatFolder, 'conf', 'default', './settings.json'), getSetupFileAsString('settings.json'), null, 2);
|
|
94
|
-
if (!(0, _fs.existsSync)(_path.default.resolve(uatFolder, 'conf', 'default', 'actors', 'editions'))) {
|
|
95
|
-
(0, _fs.mkdirSync)(_path.default.resolve(uatFolder, 'conf', 'default', 'actors', 'editions'), {
|
|
96
|
-
recursive: true
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
(0, _fs.writeFileSync)(_path.default.resolve(uatFolder, 'conf', 'default', 'actors', 'editions', 'free.json'), getSetupFileAsString('free-sample.json'), null, 2);
|
|
100
|
-
(0, _fs.writeFileSync)(_path.default.resolve(uatFolder, 'conf', 'default', 'actors', 'editions', 'index.js'), getSetupFileAsString('editions-index.js'), null, 2);
|
|
101
|
-
(0, _fs.writeFileSync)(_path.default.resolve(uatFolder, 'conf', 'default', 'actors', 'index.js'), getSetupFileAsString('actors-index.js'), null, 2);
|
|
87
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Creating env-config file inside UAT Folder');
|
|
88
|
+
(0, _fs.writeFileSync)(_path.default.resolve(uatFolder, './env-config.json'), getSetupFileAsString('env-config-sample.json'), null, 2);
|
|
102
89
|
} else {
|
|
103
90
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Something went wrong. Please re-initialize the @zohodesk/testinglibrary');
|
|
104
91
|
}
|
package/nobdd/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm install $(npm pack ../ | tail -1)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "testingframeworknobdd",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "collection of examples that we can use for testing",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"author": "",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"uat": "ZDTestingFramework test --mode=dev --headed",
|
|
10
|
+
"uatnobdd": "ZDTestingFramework test --mode=nobdd",
|
|
11
|
+
"uat-ci": "ZDTestingFramework test --mode=ci --headed",
|
|
12
|
+
"uat-clean": "ZDTestingFramework clearCaches",
|
|
13
|
+
"uat-debug": "ZDTestingFramework test --mode=dev --debug",
|
|
14
|
+
"uat-report": "ZDTestingFramework report --port=9009",
|
|
15
|
+
"codegen": "ZDTestingFramework codegen deskclientapp.localzoho.com/agent"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "1",
|
|
4
|
+
"edition": "enterprise",
|
|
5
|
+
"orgName": "zohodeskteam",
|
|
6
|
+
"profiles": [
|
|
7
|
+
{
|
|
8
|
+
"profile": "admin",
|
|
9
|
+
"email": "solairaj.m+26jun2023@zohotest.com",
|
|
10
|
+
"password": "Demo@1201"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"profile": "agent",
|
|
14
|
+
"email": "anitha.m+agentat@zohotest.com",
|
|
15
|
+
"password": "Desk@1234"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"profile": "lightagent",
|
|
19
|
+
"email": "anitha.m+admin@zohotest.com",
|
|
20
|
+
"password": "Moon@2018"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const customFixtures = require('../../shared/commands/_index-custom-fixtures');
|
|
2
|
+
|
|
3
|
+
const { getDefaultActor } = require('@zohodesk/testinglibrary/helpers');
|
|
4
|
+
|
|
5
|
+
function getPrimaryCookiePath() {
|
|
6
|
+
const { email } = getDefaultActor();
|
|
7
|
+
return `uat/playwright/.auth/${email}-cookies.json`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents the user configuration object.
|
|
12
|
+
* @typedef {import('@zohodesk/testinglibrary').UserConfig} UserConfig
|
|
13
|
+
*/
|
|
14
|
+
module.exports = {
|
|
15
|
+
headless: false,
|
|
16
|
+
retries:1,
|
|
17
|
+
openReportOn: 'never',
|
|
18
|
+
browsers: ['Chrome'],
|
|
19
|
+
isAuthMode: true,
|
|
20
|
+
authFilePath: getPrimaryCookiePath(),
|
|
21
|
+
trace: 'retain-on-failure',
|
|
22
|
+
video: 'retain-on-failure',
|
|
23
|
+
retries:1,
|
|
24
|
+
bddMode: false,
|
|
25
|
+
expectTimeout: 10 * 1000,
|
|
26
|
+
testTimeout: 60 * 1000,
|
|
27
|
+
globalTimeout: 2 * 60 * 60 * 1000,
|
|
28
|
+
featureFilesFolder: 'feature-files',
|
|
29
|
+
stepDefinitionsFolder: 'steps',
|
|
30
|
+
viewport: { width: 1280, height: 720 },
|
|
31
|
+
testIdAttribute: 'data-id',
|
|
32
|
+
editionOrder: ['Free', 'Express', 'Standard', 'Professional', 'Enterprise'],
|
|
33
|
+
additionalPages: {
|
|
34
|
+
...customFixtures
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dev": {
|
|
3
|
+
"domain": "https://zdesk-devops16.csez.zohocorpin.com:31025/agent",
|
|
4
|
+
"orgName": "org-name",
|
|
5
|
+
"deptName": "dept-name",
|
|
6
|
+
"moduleName": "module-name"
|
|
7
|
+
},
|
|
8
|
+
"prod": {
|
|
9
|
+
"domain": "https://zdesk-devops16.csez.zohocorpin.com:31025/agent",
|
|
10
|
+
"orgName": "sangeetha.t@zohocorp.com",
|
|
11
|
+
"deptName": "sangeethat",
|
|
12
|
+
"moduleName": "sangeethat"
|
|
13
|
+
},
|
|
14
|
+
"ci": {
|
|
15
|
+
"domain": "https://zdesk-devops16.csez.zohocorpin.com:31025/agent",
|
|
16
|
+
"orgName": "clientcicdk8",
|
|
17
|
+
"deptName": "clientcicdk8",
|
|
18
|
+
"moduleName": "tickets"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import {
|
|
3
|
+
test as setup,
|
|
4
|
+
expect
|
|
5
|
+
} from '@zohodesk/testinglibrary';
|
|
6
|
+
import {
|
|
7
|
+
getDefaultActor,
|
|
8
|
+
getUserForSelectedEditionAndProfile,
|
|
9
|
+
performLoginSteps
|
|
10
|
+
} from '@zohodesk/testinglibrary/helpers'
|
|
11
|
+
import { SETUP_HOME_PAGE_SELECTORS } from '../modules/Setup/dom-selectors/SetupSelectors';
|
|
12
|
+
import getUrlOrigin from '../shared/url-helpers/getUrlOrigin';
|
|
13
|
+
|
|
14
|
+
const { edition, profile } = getDefaultActor();
|
|
15
|
+
|
|
16
|
+
const user = getUserForSelectedEditionAndProfile(edition, profile);
|
|
17
|
+
|
|
18
|
+
async function verifyPageIsLoaded(page) {
|
|
19
|
+
const urlOrigin = getUrlOrigin(page.url());
|
|
20
|
+
const domainOrigin = getUrlOrigin(process.env.domain);
|
|
21
|
+
if (urlOrigin === domainOrigin) {
|
|
22
|
+
await expect(
|
|
23
|
+
page
|
|
24
|
+
.locator('header')
|
|
25
|
+
.getByLabel(SETUP_HOME_PAGE_SELECTORS.SETUP_ICON_LABEL)
|
|
26
|
+
).toBeVisible();
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
setup(`${user.edition} - Authentication`, async ({ page }) => {
|
|
33
|
+
const { email, password } = user;
|
|
34
|
+
await performLoginSteps(
|
|
35
|
+
{
|
|
36
|
+
page,
|
|
37
|
+
authFilePrefix: email,
|
|
38
|
+
useremail: email,
|
|
39
|
+
password: password
|
|
40
|
+
},
|
|
41
|
+
verifyPageIsLoaded
|
|
42
|
+
);
|
|
43
|
+
//await completeOnboardings({ page });
|
|
44
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import {
|
|
4
|
+
test as teardown,
|
|
5
|
+
expect
|
|
6
|
+
} from '@zohodesk/testinglibrary';
|
|
7
|
+
import { isDevelopmentSetup, loadCookiesIfPresent } from '@zohodesk/testinglibrary/helpers'
|
|
8
|
+
import getUrlOrigin from '../shared/url-helpers/getUrlOrigin';
|
|
9
|
+
|
|
10
|
+
// We are adding teardown logic only in CI mode
|
|
11
|
+
if (!isDevelopmentSetup()) {
|
|
12
|
+
teardown(`Log out scenarios`, async ({ page }) => {
|
|
13
|
+
const authDirectory = path.resolve(
|
|
14
|
+
process.cwd(),
|
|
15
|
+
'uat',
|
|
16
|
+
'playwright',
|
|
17
|
+
'.auth'
|
|
18
|
+
);
|
|
19
|
+
const files = fs.readdirSync(authDirectory);
|
|
20
|
+
const promises = files.map(async file => {
|
|
21
|
+
const authFilePath = path.join(authDirectory, file);
|
|
22
|
+
await loadCookiesIfPresent(page, authFilePath);
|
|
23
|
+
const domainOrigin = getUrlOrigin(process.env.domain);
|
|
24
|
+
const logoutURL = `${domainOrigin}/support/logout.sas`;
|
|
25
|
+
await page.goto(logoutURL);
|
|
26
|
+
await page.waitForNavigation();
|
|
27
|
+
await expect(page.locator('[id="signin_flow"]')).toBeVisible();
|
|
28
|
+
await fs.rmSync(authFilePath);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
await Promise.all(promises);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { test, expect } from "@zohodesk/testinglibrary";
|
|
2
|
+
|
|
3
|
+
test.describe("Verify no authentication required @nobdd", () => {
|
|
4
|
+
|
|
5
|
+
test("Verify the page is not logged in", async ({ page }) => {
|
|
6
|
+
|
|
7
|
+
await page.goto(process.env.domain);
|
|
8
|
+
|
|
9
|
+
await page.waitForSelector('#login');
|
|
10
|
+
|
|
11
|
+
const isLoggedIn = await page.isVisible('#login');
|
|
12
|
+
expect(isLoggedIn).toBe(true);
|
|
13
|
+
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
});
|