@zohodesk/testinglibrary 0.4.22-experimental → 0.4.24-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.
Files changed (140) hide show
  1. package/.gitlab-ci.yml +6 -19
  2. package/README.md +27 -1
  3. package/build/core/playwright/fixtures.js +24 -0
  4. package/build/core/playwright/helpers/fileMutex.js +10 -12
  5. package/build/core/playwright/index.js +10 -23
  6. package/build/core/playwright/runner/SpawnRunner.js +2 -2
  7. package/build/core/playwright/setup/config-creator.js +3 -3
  8. package/build/core/playwright/setup/config-utils.js +8 -25
  9. package/build/core/playwright/tagProcessor.js +18 -28
  10. package/build/core/playwright/test-runner.js +1 -1
  11. package/build/decorators.d.ts +1 -1
  12. package/build/decorators.js +1 -1
  13. package/build/setup-folder-structure/samples/auth-setup-sample.js +14 -66
  14. package/build/setup-folder-structure/samples/editions-index.js +3 -0
  15. package/build/setup-folder-structure/samples/free-sample.json +25 -0
  16. package/{nobdd/uat/conf/default → build/setup-folder-structure/samples}/settings.json +4 -3
  17. package/build/setup-folder-structure/setupProject.js +18 -5
  18. package/npm-shrinkwrap.json +7308 -3184
  19. package/package.json +8 -8
  20. package/unit_reports/unit-report.html +260 -0
  21. package/build/bdd-framework/cli/commands/env.js +0 -42
  22. package/build/bdd-framework/cli/commands/export.js +0 -62
  23. package/build/bdd-framework/cli/commands/test.js +0 -64
  24. package/build/bdd-framework/cli/index.js +0 -11
  25. package/build/bdd-framework/cli/options.js +0 -19
  26. package/build/bdd-framework/cli/worker.js +0 -13
  27. package/build/bdd-framework/config/configDir.js +0 -35
  28. package/build/bdd-framework/config/enrichReporterData.js +0 -23
  29. package/build/bdd-framework/config/env.js +0 -50
  30. package/build/bdd-framework/config/index.js +0 -94
  31. package/build/bdd-framework/config/lang.js +0 -14
  32. package/build/bdd-framework/cucumber/buildStepDefinition.js +0 -43
  33. package/build/bdd-framework/cucumber/createTestStep.js +0 -43
  34. package/build/bdd-framework/cucumber/formatter/EventDataCollector.js +0 -126
  35. package/build/bdd-framework/cucumber/formatter/GherkinDocumentParser.js +0 -72
  36. package/build/bdd-framework/cucumber/formatter/PickleParser.js +0 -25
  37. package/build/bdd-framework/cucumber/formatter/durationHelpers.js +0 -13
  38. package/build/bdd-framework/cucumber/formatter/getColorFns.js +0 -57
  39. package/build/bdd-framework/cucumber/formatter/index.js +0 -16
  40. package/build/bdd-framework/cucumber/formatter/locationHelpers.js +0 -16
  41. package/build/bdd-framework/cucumber/loadConfig.js +0 -17
  42. package/build/bdd-framework/cucumber/loadFeatures.js +0 -70
  43. package/build/bdd-framework/cucumber/loadSnippetBuilder.js +0 -20
  44. package/build/bdd-framework/cucumber/loadSteps.js +0 -47
  45. package/build/bdd-framework/cucumber/resolveFeaturePaths.js +0 -62
  46. package/build/bdd-framework/cucumber/stepArguments.js +0 -21
  47. package/build/bdd-framework/cucumber/types.js +0 -5
  48. package/build/bdd-framework/cucumber/valueChecker.js +0 -23
  49. package/build/bdd-framework/decorators.js +0 -18
  50. package/build/bdd-framework/gen/fixtures.js +0 -48
  51. package/build/bdd-framework/gen/formatter.js +0 -167
  52. package/build/bdd-framework/gen/i18n.js +0 -39
  53. package/build/bdd-framework/gen/index.js +0 -197
  54. package/build/bdd-framework/gen/specialTags.js +0 -70
  55. package/build/bdd-framework/gen/testFile.js +0 -470
  56. package/build/bdd-framework/gen/testMeta.js +0 -60
  57. package/build/bdd-framework/gen/testNode.js +0 -35
  58. package/build/bdd-framework/gen/testPoms.js +0 -133
  59. package/build/bdd-framework/hooks/scenario.js +0 -130
  60. package/build/bdd-framework/hooks/worker.js +0 -89
  61. package/build/bdd-framework/index.js +0 -52
  62. package/build/bdd-framework/playwright/fixtureParameterNames.js +0 -93
  63. package/build/bdd-framework/playwright/getLocationInFile.js +0 -79
  64. package/build/bdd-framework/playwright/loadConfig.js +0 -42
  65. package/build/bdd-framework/playwright/loadUtils.js +0 -33
  66. package/build/bdd-framework/playwright/testTypeImpl.js +0 -79
  67. package/build/bdd-framework/playwright/transform.js +0 -88
  68. package/build/bdd-framework/playwright/types.js +0 -12
  69. package/build/bdd-framework/playwright/utils.js +0 -56
  70. package/build/bdd-framework/reporter/cucumber/base.js +0 -52
  71. package/build/bdd-framework/reporter/cucumber/custom.js +0 -73
  72. package/build/bdd-framework/reporter/cucumber/helper.js +0 -12
  73. package/build/bdd-framework/reporter/cucumber/html.js +0 -40
  74. package/build/bdd-framework/reporter/cucumber/index.js +0 -74
  75. package/build/bdd-framework/reporter/cucumber/json.js +0 -312
  76. package/build/bdd-framework/reporter/cucumber/junit.js +0 -205
  77. package/build/bdd-framework/reporter/cucumber/message.js +0 -20
  78. package/build/bdd-framework/reporter/cucumber/messagesBuilder/AttachmentMapper.js +0 -82
  79. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Builder.js +0 -197
  80. package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocument.js +0 -43
  81. package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocumentClone.js +0 -52
  82. package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocuments.js +0 -105
  83. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Hook.js +0 -70
  84. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Meta.js +0 -45
  85. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Pickles.js +0 -27
  86. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Projects.js +0 -38
  87. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCase.js +0 -128
  88. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRun.js +0 -154
  89. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRunHooks.js +0 -123
  90. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepAttachments.js +0 -67
  91. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepRun.js +0 -114
  92. package/build/bdd-framework/reporter/cucumber/messagesBuilder/index.js +0 -30
  93. package/build/bdd-framework/reporter/cucumber/messagesBuilder/pwStepUtils.js +0 -70
  94. package/build/bdd-framework/reporter/cucumber/messagesBuilder/timing.js +0 -35
  95. package/build/bdd-framework/reporter/cucumber/messagesBuilder/types.js +0 -5
  96. package/build/bdd-framework/run/StepInvoker.js +0 -69
  97. package/build/bdd-framework/run/bddData/index.js +0 -59
  98. package/build/bdd-framework/run/bddData/types.js +0 -5
  99. package/build/bdd-framework/run/bddFixtures.js +0 -192
  100. package/build/bdd-framework/run/bddWorld.js +0 -79
  101. package/build/bdd-framework/run/bddWorldInternal.js +0 -11
  102. package/build/bdd-framework/snippets/index.js +0 -132
  103. package/build/bdd-framework/snippets/snippetSyntax.js +0 -43
  104. package/build/bdd-framework/snippets/snippetSyntaxDecorators.js +0 -26
  105. package/build/bdd-framework/snippets/snippetSyntaxTs.js +0 -18
  106. package/build/bdd-framework/stepDefinitions/createBdd.js +0 -66
  107. package/build/bdd-framework/stepDefinitions/decorators/class.js +0 -68
  108. package/build/bdd-framework/stepDefinitions/decorators/steps.js +0 -99
  109. package/build/bdd-framework/stepDefinitions/defineStep.js +0 -62
  110. package/build/bdd-framework/stepDefinitions/stepConfig.js +0 -24
  111. package/build/bdd-framework/steps/createBdd.js +0 -78
  112. package/build/bdd-framework/steps/decorators/class.js +0 -68
  113. package/build/bdd-framework/steps/decorators/steps.js +0 -98
  114. package/build/bdd-framework/steps/defineStep.js +0 -62
  115. package/build/bdd-framework/steps/stepConfig.js +0 -24
  116. package/build/bdd-framework/utils/AutofillMap.js +0 -20
  117. package/build/bdd-framework/utils/exit.js +0 -62
  118. package/build/bdd-framework/utils/index.js +0 -93
  119. package/build/bdd-framework/utils/jsStringWrap.js +0 -44
  120. package/build/bdd-framework/utils/logger.js +0 -30
  121. package/build/bdd-framework/utils/stripAnsiEscapes.js +0 -20
  122. package/build/setup-folder-structure/samples/authUsers-sample.json +0 -9
  123. package/build/setup-folder-structure/samples/env-config-sample.json +0 -21
  124. package/nobdd/README.md +0 -1
  125. package/nobdd/package.json +0 -17
  126. package/nobdd/uat/conf/default/actors/editions/enterprise.json +0 -24
  127. package/nobdd/uat/conf/default/actors/editions/index.js +0 -4
  128. package/nobdd/uat/conf/nobdd/uat.config.js +0 -36
  129. package/nobdd/uat/env-config.json +0 -20
  130. package/nobdd/uat/fixtures/auth.setup.js +0 -44
  131. package/nobdd/uat/fixtures/setup.teardown.js +0 -33
  132. package/nobdd/uat/modules/nobdd/steps/VerifyNoBDD.feature.spec.js +0 -16
  133. package/nobdd/uat/shared/commands/_index-custom-fixtures.js +0 -9
  134. package/nobdd/uat/shared/commands/i18n.js +0 -25
  135. package/nobdd/uat/shared/commands/unauthenticatedPage.js +0 -8
  136. package/nobdd/uat/shared/index.js +0 -7
  137. package/nobdd/uat/shared/onboardings/onboardingUpdate.js +0 -44
  138. package/nobdd/uat/shared/url-helpers/getUrlOrigin.js +0 -6
  139. package/nobdd/uat.config.js +0 -37
  140. /package/{nobdd/uat/conf/default/actors/index.js → build/setup-folder-structure/samples/actors-index.js} +0 -0
@@ -1,62 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.exit = exit;
7
- exports.withExitHandler = withExitHandler;
8
- var _worker_threads = require("worker_threads");
9
- /**
10
- * Exit utils.
11
- *
12
- * When calling process.exit() in worker thread used for test-file generation,
13
- * logs are not flushed (https://github.com/vitalets/playwright-bdd/issues/59).
14
- * That's why instead of process.exit we throw ExitError
15
- * that just sets process.exitCode = 1 and allow program to exit normally.
16
- * This esnured by wrapping code with withExitHandler().
17
- *
18
- * On the other hand, when running in the main thread, especially inside Playwright,
19
- * thrown error is captured by Playwright and show with additional messages (e.g. no tests found).
20
- * That's why in main thread we to call process.exit() to show only needed error.
21
- *
22
- * Relevant discussions:
23
- * - https://github.com/nodejs/node/issues/6379
24
- * - https://github.com/nodejs/node-v0.x-archive/issues/3737
25
- * - https://github.com/cucumber/cucumber-js/pull/123
26
- */
27
-
28
- class ExitError extends Error {
29
- get stack() {
30
- return '';
31
- }
32
- }
33
- async function withExitHandler(fn) {
34
- try {
35
- return await fn();
36
- } catch (e) {
37
- if (e instanceof ExitError) {
38
- if (e.message) {
39
- // eslint-disable-next-line no-console
40
- console.error(e.message);
41
- }
42
- process.exitCode = 1;
43
- } else {
44
- throw e;
45
- }
46
- }
47
- }
48
- function exit(...messages) {
49
- messages = messages.filter(Boolean);
50
- if (_worker_threads.isMainThread) {
51
- // use console.error() here instead of logger.error() to have less stack
52
- // for flushing messages to stderr.
53
-
54
- if (messages.length) {
55
- // eslint-disable-next-line no-console, max-depth
56
- console.error('Error:', ...messages);
57
- }
58
- process.exit(1);
59
- } else {
60
- throw new ExitError(messages.join(' '));
61
- }
62
- }
@@ -1,93 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.callWithTimeout = callWithTimeout;
8
- exports.extractTemplateParams = extractTemplateParams;
9
- exports.getPackageVersion = getPackageVersion;
10
- exports.getSymbolByName = getSymbolByName;
11
- exports.omit = omit;
12
- exports.removeDuplicates = removeDuplicates;
13
- exports.resolvePackageRoot = resolvePackageRoot;
14
- exports.stringifyLocation = stringifyLocation;
15
- exports.template = template;
16
- exports.toPosixPath = toPosixPath;
17
- var _fs = _interopRequireDefault(require("fs"));
18
- var _path = _interopRequireDefault(require("path"));
19
- var _util = require("util");
20
- const setTimeoutPromise = (0, _util.promisify)(setTimeout);
21
- /**
22
- * Returns Symbol by name.
23
- * See: https://stackoverflow.com/questions/50453640/how-can-i-get-the-value-of-a-symbol-property
24
- */
25
- function getSymbolByName(target, name) {
26
- const ownKeys = Reflect.ownKeys(target);
27
- const symbol = ownKeys.find(key => key.toString() === `Symbol(${name})`);
28
- if (!symbol) {
29
- throw new Error(`Symbol "${name}" not found in target. ownKeys: ${ownKeys}`);
30
- }
31
- return symbol;
32
- }
33
- /**
34
- * Inserts params into template.
35
- * Params defined as <param>.
36
- */
37
- function template(t, params = {}) {
38
- return t.replace(/<(.+?)>/g, (match, key) => {
39
- return params[key] !== undefined ? String(params[key]) : match;
40
- });
41
- }
42
- /**
43
- * Extracts all template params from string.
44
- * Params defined as <param>.
45
- */
46
- function extractTemplateParams(t) {
47
- return [...t.matchAll(/<(.+?)>/g)].map(m => m[1]);
48
- }
49
- function removeDuplicates(arr) {
50
- return [...new Set(arr)];
51
- }
52
- function resolvePackageRoot(packageName) {
53
- const packageJsonPath = require.resolve(`${packageName}/package.json`);
54
- return _path.default.dirname(packageJsonPath);
55
- }
56
- function getPackageVersion(packageName) {
57
- const packageRoot = resolvePackageRoot(packageName);
58
- const packageJsonPath = _path.default.join(packageRoot, 'package.json');
59
- const packageJson = JSON.parse(_fs.default.readFileSync(packageJsonPath, 'utf8'));
60
- return packageJson.version || '';
61
- }
62
- async function callWithTimeout(fn, timeout, timeoutMsg) {
63
- if (!timeout) {
64
- return fn();
65
- }
66
- const ac = new AbortController();
67
- return Promise.race([fn(), setTimeoutPromise(timeout, null, {
68
- ref: false,
69
- signal: ac.signal
70
- }).then(() => {
71
- throw new Error(timeoutMsg || `Function timeout (${timeout} ms)`);
72
- })]).finally(() => ac.abort());
73
- }
74
- function stringifyLocation({
75
- line,
76
- column
77
- }) {
78
- return `${line}:${column}`;
79
- }
80
- function omit(obj, key) {
81
- const res = {
82
- ...obj
83
- };
84
- delete res[key];
85
- return res;
86
- }
87
- /**
88
- * Returns path with "/" separator on all platforms.
89
- * See: https://stackoverflow.com/questions/53799385/how-can-i-convert-a-windows-path-to-posix-path-using-node-path
90
- */
91
- function toPosixPath(somePath) {
92
- return somePath.split(_path.default.sep).join(_path.default.posix.sep);
93
- }
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.jsStringWrap = jsStringWrap;
7
- /**
8
- * Adopted version of https://github.com/joliss/js-string-escape
9
- * - added support of backticks
10
- * - added 'quotes' option to indicate which quotes to escape
11
- * - wrap result string with provided quotes
12
- *
13
- * Considered alternative is https://github.com/mathiasbynens/jsesc,
14
- * but it provides additional functionality and much slower
15
- * See: https://github.com/mathiasbynens/jsesc/issues/16
16
- */
17
- function jsStringWrap(str, {
18
- quotes = 'single'
19
- } = {}) {
20
- const wrapQuote = quotes === 'single' ? "'" : quotes === 'double' ? '"' : '`';
21
- // eslint-disable-next-line complexity
22
- const escapedStr = ('' + str).replace(/["'`\\\n\r\u2028\u2029]/g, character => {
23
- // Escape all characters not included in SingleStringCharacters and
24
- // DoubleStringCharacters on
25
- // http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4
26
- switch (character) {
27
- case wrapQuote:
28
- case '\\':
29
- return '\\' + character;
30
- // Four possible LineTerminator characters need to be escaped:
31
- case '\n':
32
- return '\\n';
33
- case '\r':
34
- return '\\r';
35
- case '\u2028':
36
- return '\\u2028';
37
- case '\u2029':
38
- return '\\u2029';
39
- default:
40
- return character;
41
- }
42
- });
43
- return `${wrapQuote}${escapedStr}${wrapQuote}`;
44
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.logger = exports.Logger = void 0;
7
- /**
8
- * Simple logger
9
- */
10
- class Logger {
11
- options;
12
- constructor(options = {}) {
13
- this.options = options;
14
- }
15
- log(...args) {
16
- if (this.options.verbose) {
17
- console.log(...args);
18
- }
19
- }
20
- warn(...args) {
21
- // using log() to output warnings to stdout, not stderr
22
- console.log(...args);
23
- }
24
- error(...args) {
25
- console.error(...args);
26
- }
27
- }
28
- // default logger
29
- exports.Logger = Logger;
30
- const logger = exports.logger = new Logger();
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.stripAnsiEscapes = stripAnsiEscapes;
7
- /**
8
- * Copied from Playwright.
9
- * See: https://github.com/microsoft/playwright/blob/main/packages/playwright/src/reporters/base.ts#L529
10
- *
11
- * Note: there is also 'strip-ansi' package, but is't ESM only.
12
- * Adding it is tricky now.
13
- * See: https://www.npmjs.com/package/strip-ansi
14
- */
15
- const ansiRegex = new RegExp(
16
- // eslint-disable-next-line max-len, no-control-regex
17
- '([\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~])))', 'g');
18
- function stripAnsiEscapes(str) {
19
- return str.replace(ansiRegex, '');
20
- }
@@ -1,9 +0,0 @@
1
- [
2
- {
3
- "useremail": "/ user name /",
4
- "password": "/ password /",
5
- "description": "/ description/",
6
- "filename": "user.json",
7
- "locator": "/ selector to identify page has been loaded completely /"
8
- }
9
- ]
@@ -1,21 +0,0 @@
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
- }
package/nobdd/README.md DELETED
@@ -1 +0,0 @@
1
- npm install $(npm pack ../ | tail -1)
@@ -1,17 +0,0 @@
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
- }
@@ -1,24 +0,0 @@
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
- ]
@@ -1,4 +0,0 @@
1
- const enterprise = require('./enterprise.json');
2
- const editions = {enterprise};
3
-
4
- module.exports = editions;
@@ -1,36 +0,0 @@
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
- };
@@ -1,20 +0,0 @@
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
- }
@@ -1,44 +0,0 @@
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
- });
@@ -1,33 +0,0 @@
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
- }
@@ -1,16 +0,0 @@
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
- });
@@ -1,9 +0,0 @@
1
- const i18n = require('./i18n');
2
- const unAuthenticatedPage = require('./unauthenticatedPage');
3
-
4
- const customFixtures = {
5
- ...i18n,
6
- ...unAuthenticatedPage
7
- };
8
-
9
- module.exports = customFixtures;
@@ -1,25 +0,0 @@
1
- /* eslint-disable no-param-reassign */
2
-
3
- // Note: We are duplicating below method from @zohodesk/i18n. We are not importing it as react package not yet availble in test environment.
4
- function replaceI18NValuesWithRegex(i18nStr, values) {
5
- if (typeof values !== 'undefined') {
6
- if (Array.isArray(values)) {
7
- for (let i = 0; i < values.length; i++) {
8
- i18nStr = i18nStr.replace(new RegExp(`\\{${i}\\}`, 'g'), values[i]);
9
- }
10
- } else {
11
- i18nStr = i18nStr.replace(new RegExp('\\{0\\}', 'g'), values);
12
- }
13
- }
14
- return i18nStr;
15
- }
16
-
17
- module.exports = {
18
- i18N: async ({ page }, use) => {
19
- await use(async (key, values) => {
20
- const i18nValue = await page.evaluate((i18nKey) => window.i18n[i18nKey], key);
21
- const i18nStr = replaceI18NValuesWithRegex(i18nValue, values)
22
- return i18nStr;
23
- })
24
- }
25
- }
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- unauthenticatedPage: async ({ browser }, use) => {
3
- const context = await browser.newContext({ storageState: null });
4
- const unauthenticatedPage = await context.newPage();
5
- await use(unauthenticatedPage);
6
- await context.close();
7
- }
8
- }
@@ -1,7 +0,0 @@
1
- const completeOnboardings = require("./onboardings/onboardingUpdate")
2
-
3
-
4
-
5
- module.exports = {
6
- completeOnboardings
7
- }
@@ -1,44 +0,0 @@
1
- async function get_cookie(page) {
2
- return page.evaluate(async () => {
3
- const results = document.cookie.match(`crmcsr=(.*?)(;|$)`);
4
- if (results) {
5
- return unescape(results[1]);
6
- }
7
- return null;
8
- });
9
- }
10
-
11
- async function getOnboardings({ page, cookieVal }) {
12
- return page.evaluate(
13
- async (cookieVal) =>
14
- fetch('/api/v1/onboardingStatus', {
15
- method: 'GET',
16
- headers: {
17
- orgId: window.currentOrg.id,
18
- 'X-ZCSRF-TOKEN': `crmcsrfparam=${cookieVal}`
19
- }
20
- }).then((r) => (r.ok ? r.json() : Promise.reject(r))),
21
- cookieVal
22
- );
23
- }
24
-
25
- async function completeOnboardings({ page }) {
26
- const cookieVal = await get_cookie(page);
27
- const onboardings = await getOnboardings({ page });
28
- if (onboardings.pending.length) {
29
- await page.evaluate(
30
- async ({ cookieVal, onboardings }) =>
31
- fetch('/api/v1/onboardingStatus/markComplete', {
32
- method: 'POST',
33
- headers: {
34
- orgId: window.currentOrg.id,
35
- 'X-ZCSRF-TOKEN': `crmcsrfparam=${cookieVal}`
36
- },
37
- body: JSON.stringify({ items: onboardings.pending })
38
- }),
39
- { cookieVal, onboardings }
40
- );
41
- }
42
- }
43
-
44
- module.exports = completeOnboardings;
@@ -1,6 +0,0 @@
1
- function getUrlOrigin(url) {
2
- const { origin } = new URL(url);
3
- return origin;
4
- }
5
-
6
- module.exports = getUrlOrigin;
@@ -1,37 +0,0 @@
1
- const customFixtures = require('./uat/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
- url:""
37
- };