@zohodesk/testinglibrary 0.4.46-experimental → 0.4.48-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 (135) hide show
  1. package/.gitlab-ci.yml +2 -2
  2. package/README.md +54 -1
  3. package/build/core/playwright/builtInFixtures/page.js +32 -16
  4. package/build/core/playwright/clear-caches.js +7 -0
  5. package/build/core/playwright/constants/fileMutexConfig.js +4 -3
  6. package/build/core/playwright/fixtures.js +24 -0
  7. package/build/core/playwright/helpers/auth/loginSteps.js +11 -13
  8. package/build/core/playwright/helpers/configFileNameProvider.js +1 -1
  9. package/build/core/playwright/helpers/fileMutex.js +10 -12
  10. package/build/core/playwright/index.js +10 -23
  11. package/build/core/playwright/runner/SpawnRunner.js +2 -2
  12. package/build/core/playwright/setup/config-creator.js +15 -8
  13. package/build/core/playwright/setup/config-utils.js +8 -25
  14. package/build/core/playwright/tagProcessor.js +22 -34
  15. package/build/core/playwright/test-runner.js +2 -2
  16. package/build/decorators.d.ts +1 -1
  17. package/build/decorators.js +1 -1
  18. package/build/setup-folder-structure/samples/accountLogin-sample.js +19 -0
  19. package/build/setup-folder-structure/samples/actors-index.js +2 -0
  20. package/build/setup-folder-structure/samples/auth-setup-sample.js +10 -68
  21. package/build/setup-folder-structure/samples/editions-index.js +3 -0
  22. package/build/setup-folder-structure/samples/free-sample.json +25 -0
  23. package/build/setup-folder-structure/samples/settings.json +7 -0
  24. package/build/setup-folder-structure/samples/testSetup-sample.js +14 -0
  25. package/build/setup-folder-structure/samples/uat-config-sample.js +3 -1
  26. package/build/setup-folder-structure/setupProject.js +22 -5
  27. package/build/test/core/playwright/__tests__/tagProcessor.test.js +18 -19
  28. package/build/test/core/playwright/helpers/__tests__/configFileNameProvider.test.js +1 -1
  29. package/npm-shrinkwrap.json +10846 -0
  30. package/package.json +11 -10
  31. package/playwright.config.js +0 -48
  32. package/build/bdd-framework/cli/commands/env.js +0 -42
  33. package/build/bdd-framework/cli/commands/export.js +0 -62
  34. package/build/bdd-framework/cli/commands/test.js +0 -64
  35. package/build/bdd-framework/cli/index.js +0 -11
  36. package/build/bdd-framework/cli/options.js +0 -19
  37. package/build/bdd-framework/cli/worker.js +0 -13
  38. package/build/bdd-framework/config/configDir.js +0 -35
  39. package/build/bdd-framework/config/enrichReporterData.js +0 -23
  40. package/build/bdd-framework/config/env.js +0 -50
  41. package/build/bdd-framework/config/index.js +0 -94
  42. package/build/bdd-framework/config/lang.js +0 -14
  43. package/build/bdd-framework/cucumber/buildStepDefinition.js +0 -43
  44. package/build/bdd-framework/cucumber/createTestStep.js +0 -43
  45. package/build/bdd-framework/cucumber/formatter/EventDataCollector.js +0 -126
  46. package/build/bdd-framework/cucumber/formatter/GherkinDocumentParser.js +0 -72
  47. package/build/bdd-framework/cucumber/formatter/PickleParser.js +0 -25
  48. package/build/bdd-framework/cucumber/formatter/durationHelpers.js +0 -13
  49. package/build/bdd-framework/cucumber/formatter/getColorFns.js +0 -57
  50. package/build/bdd-framework/cucumber/formatter/index.js +0 -16
  51. package/build/bdd-framework/cucumber/formatter/locationHelpers.js +0 -16
  52. package/build/bdd-framework/cucumber/loadConfig.js +0 -17
  53. package/build/bdd-framework/cucumber/loadFeatures.js +0 -70
  54. package/build/bdd-framework/cucumber/loadSnippetBuilder.js +0 -20
  55. package/build/bdd-framework/cucumber/loadSteps.js +0 -47
  56. package/build/bdd-framework/cucumber/resolveFeaturePaths.js +0 -62
  57. package/build/bdd-framework/cucumber/stepArguments.js +0 -21
  58. package/build/bdd-framework/cucumber/types.js +0 -5
  59. package/build/bdd-framework/cucumber/valueChecker.js +0 -23
  60. package/build/bdd-framework/decorators.js +0 -18
  61. package/build/bdd-framework/gen/fixtures.js +0 -48
  62. package/build/bdd-framework/gen/formatter.js +0 -167
  63. package/build/bdd-framework/gen/i18n.js +0 -39
  64. package/build/bdd-framework/gen/index.js +0 -197
  65. package/build/bdd-framework/gen/specialTags.js +0 -70
  66. package/build/bdd-framework/gen/testFile.js +0 -470
  67. package/build/bdd-framework/gen/testMeta.js +0 -60
  68. package/build/bdd-framework/gen/testNode.js +0 -35
  69. package/build/bdd-framework/gen/testPoms.js +0 -133
  70. package/build/bdd-framework/hooks/scenario.js +0 -130
  71. package/build/bdd-framework/hooks/worker.js +0 -89
  72. package/build/bdd-framework/index.js +0 -52
  73. package/build/bdd-framework/playwright/fixtureParameterNames.js +0 -93
  74. package/build/bdd-framework/playwright/getLocationInFile.js +0 -79
  75. package/build/bdd-framework/playwright/loadConfig.js +0 -42
  76. package/build/bdd-framework/playwright/loadUtils.js +0 -33
  77. package/build/bdd-framework/playwright/testTypeImpl.js +0 -79
  78. package/build/bdd-framework/playwright/transform.js +0 -88
  79. package/build/bdd-framework/playwright/types.js +0 -12
  80. package/build/bdd-framework/playwright/utils.js +0 -56
  81. package/build/bdd-framework/reporter/cucumber/base.js +0 -52
  82. package/build/bdd-framework/reporter/cucumber/custom.js +0 -73
  83. package/build/bdd-framework/reporter/cucumber/helper.js +0 -12
  84. package/build/bdd-framework/reporter/cucumber/html.js +0 -40
  85. package/build/bdd-framework/reporter/cucumber/index.js +0 -74
  86. package/build/bdd-framework/reporter/cucumber/json.js +0 -312
  87. package/build/bdd-framework/reporter/cucumber/junit.js +0 -205
  88. package/build/bdd-framework/reporter/cucumber/message.js +0 -20
  89. package/build/bdd-framework/reporter/cucumber/messagesBuilder/AttachmentMapper.js +0 -82
  90. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Builder.js +0 -197
  91. package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocument.js +0 -43
  92. package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocumentClone.js +0 -52
  93. package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocuments.js +0 -105
  94. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Hook.js +0 -70
  95. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Meta.js +0 -45
  96. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Pickles.js +0 -27
  97. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Projects.js +0 -38
  98. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCase.js +0 -128
  99. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRun.js +0 -154
  100. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRunHooks.js +0 -123
  101. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepAttachments.js +0 -67
  102. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepRun.js +0 -114
  103. package/build/bdd-framework/reporter/cucumber/messagesBuilder/index.js +0 -30
  104. package/build/bdd-framework/reporter/cucumber/messagesBuilder/pwStepUtils.js +0 -70
  105. package/build/bdd-framework/reporter/cucumber/messagesBuilder/timing.js +0 -35
  106. package/build/bdd-framework/reporter/cucumber/messagesBuilder/types.js +0 -5
  107. package/build/bdd-framework/run/StepInvoker.js +0 -69
  108. package/build/bdd-framework/run/bddData/index.js +0 -59
  109. package/build/bdd-framework/run/bddData/types.js +0 -5
  110. package/build/bdd-framework/run/bddFixtures.js +0 -192
  111. package/build/bdd-framework/run/bddWorld.js +0 -79
  112. package/build/bdd-framework/run/bddWorldInternal.js +0 -11
  113. package/build/bdd-framework/snippets/index.js +0 -132
  114. package/build/bdd-framework/snippets/snippetSyntax.js +0 -43
  115. package/build/bdd-framework/snippets/snippetSyntaxDecorators.js +0 -26
  116. package/build/bdd-framework/snippets/snippetSyntaxTs.js +0 -18
  117. package/build/bdd-framework/stepDefinitions/createBdd.js +0 -66
  118. package/build/bdd-framework/stepDefinitions/decorators/class.js +0 -68
  119. package/build/bdd-framework/stepDefinitions/decorators/steps.js +0 -99
  120. package/build/bdd-framework/stepDefinitions/defineStep.js +0 -62
  121. package/build/bdd-framework/stepDefinitions/stepConfig.js +0 -24
  122. package/build/bdd-framework/steps/createBdd.js +0 -78
  123. package/build/bdd-framework/steps/decorators/class.js +0 -68
  124. package/build/bdd-framework/steps/decorators/steps.js +0 -98
  125. package/build/bdd-framework/steps/defineStep.js +0 -62
  126. package/build/bdd-framework/steps/stepConfig.js +0 -24
  127. package/build/bdd-framework/utils/AutofillMap.js +0 -20
  128. package/build/bdd-framework/utils/exit.js +0 -62
  129. package/build/bdd-framework/utils/index.js +0 -93
  130. package/build/bdd-framework/utils/jsStringWrap.js +0 -44
  131. package/build/bdd-framework/utils/logger.js +0 -30
  132. package/build/bdd-framework/utils/stripAnsiEscapes.js +0 -20
  133. package/build/setup-folder-structure/samples/authUsers-sample.json +0 -9
  134. package/build/setup-folder-structure/samples/env-config-sample.json +0 -21
  135. package/unit_reports/unit-report.html +0 -260
package/.gitlab-ci.yml CHANGED
@@ -1,4 +1,4 @@
1
- image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v2
1
+ image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v3
2
2
 
3
3
  workflow:
4
4
  rules:
@@ -14,7 +14,7 @@ stages:
14
14
 
15
15
  default:
16
16
  cache:
17
- key: node14-build-cache
17
+ key: build-cache
18
18
  paths:
19
19
  - node_modules
20
20
  - build
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
- ### v0.2.9 - 24-10-2024
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
 
@@ -27,7 +27,7 @@ function getCustomAccountDetails(tags) {
27
27
  const user = (0, _auth.getUserForSelectedEditionAndProfile)(editionInfo, profileInfo, betaFeature, portalInfo);
28
28
  return user;
29
29
  }
30
- return (0, _auth.getDefaultActor)();
30
+ return null;
31
31
  }
32
32
  const {
33
33
  testSetup
@@ -42,9 +42,19 @@ async function loginSteps(pageDetail) {
42
42
  await page.goto(process.env.domain);
43
43
  }
44
44
  }
45
- async function performDefaultPageSteps(testInfo) {
45
+ async function performDefaultPageSteps({
46
+ context,
47
+ $tags,
48
+ page
49
+ }) {
46
50
  if (testSetup.page && typeof testSetup.page === 'function') {
47
- await testSetup.page(testInfo);
51
+ await testSetup.page({
52
+ context,
53
+ $tags,
54
+ page
55
+ });
56
+ } else {
57
+ await page.goto(process.env.domain);
48
58
  }
49
59
  }
50
60
  async function verifyPageIsLoaded(testInfo) {
@@ -58,14 +68,7 @@ var _default = exports.default = {
58
68
  context,
59
69
  $tags,
60
70
  page
61
- }, use, testInfo) => {
62
- let testPortalDetails = getCustomAccountDetails($tags);
63
- let testDetails = {
64
- page,
65
- $tags,
66
- context,
67
- ...testPortalDetails
68
- };
71
+ }, use) => {
69
72
  try {
70
73
  //This block is used to skip the login process if the @unauthenticated tag is added to the script
71
74
  if ($tags.includes('@unauthenticated')) {
@@ -78,17 +81,30 @@ var _default = exports.default = {
78
81
  if (!isAuthMode) {
79
82
  return;
80
83
  }
81
- if (testPortalDetails && testInfo.project.name !== 'setup') {
84
+ const testPortalDetails = getCustomAccountDetails($tags);
85
+ if (testPortalDetails) {
82
86
  await context.clearCookies();
83
- await (0, _auth.performLoginSteps)(testDetails, async testInfo => {
87
+ const {
88
+ email
89
+ } = testPortalDetails;
90
+ await (0, _auth.performLoginSteps)({
91
+ page,
92
+ $tags,
93
+ context,
94
+ ...testPortalDetails
95
+ }, async testInfo => {
84
96
  return await verifyPageIsLoaded(testInfo);
85
97
  }, loginSteps);
86
98
  process.env.actorInfo = JSON.stringify(testPortalDetails);
87
99
  }
88
- } catch (e) {
89
- console.error('Error during page', e);
100
+ } catch (error) {
101
+ console.error('Error during page', error);
90
102
  } finally {
91
- await performDefaultPageSteps(testDetails);
103
+ await performDefaultPageSteps({
104
+ context,
105
+ $tags,
106
+ page
107
+ });
92
108
  await use(page);
93
109
  await context.close();
94
110
  }
@@ -9,6 +9,7 @@ var _path = _interopRequireDefault(require("path"));
9
9
  var _fileUtils = require("../../utils/fileUtils");
10
10
  var _logger = require("../../utils/logger");
11
11
  var _readConfigFile = require("./readConfigFile");
12
+ var _checkAuthDirectory = require("./helpers/checkAuthDirectory");
12
13
  function deleteAuthFiles(authFilePath) {
13
14
  authFilePath = _path.default.resolve(process.cwd(), authFilePath);
14
15
  const authFileFolder = _path.default.dirname(authFilePath);
@@ -24,6 +25,11 @@ function deleteGeneratedFeatures() {
24
25
  _logger.Logger.log(_logger.Logger.INFO_TYPE, `Deleting generated features at ${featuresGenPath}`);
25
26
  (0, _fileUtils.deleteFolder)(featuresGenPath);
26
27
  }
28
+ function deleteLockFiles() {
29
+ const lockFilePath = (0, _checkAuthDirectory.getLockDirectoryPath)();
30
+ _logger.Logger.log(_logger.Logger.INFO_TYPE, `Deleting lock files at ${lockFilePath}`);
31
+ (0, _fileUtils.deleteFolder)(lockFilePath);
32
+ }
27
33
  function clearCaches() {
28
34
  try {
29
35
  const {
@@ -33,6 +39,7 @@ function clearCaches() {
33
39
  deleteAuthFiles(authFilePath);
34
40
  deletePlaywrightReport(reportPath);
35
41
  deleteGeneratedFeatures();
42
+ deleteLockFiles();
36
43
  _logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Caches Cleared. Now you can try running npm run uat');
37
44
  } catch (err) {
38
45
  _logger.Logger.error(err);
@@ -5,10 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.LOGIN_MUTEX_TIMEOUT = void 0;
7
7
  const LOGIN_MUTEX_TIMEOUT = exports.LOGIN_MUTEX_TIMEOUT = {
8
- stale: 30000,
8
+ stale: 100000,
9
9
  retries: {
10
- retries: 15,
10
+ retries: 10,
11
11
  factor: 1,
12
- minTimeout: 2000
12
+ minTimeout: 10000,
13
+ maxTimeout: 20000
13
14
  }
14
15
  };
@@ -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
+ };
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _path = _interopRequireDefault(require("path"));
9
- var _fs = require("fs");
10
9
  var _fileMutex = _interopRequireDefault(require("../fileMutex"));
11
10
  var _fileMutexConfig = require("../../constants/fileMutexConfig");
12
11
  var _checkAuthCookies = require("./checkAuthCookies");
@@ -25,18 +24,17 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
25
24
  const fileMutex = new _fileMutex.default((0, _checkAuthDirectory.getLockDirectoryPath)(), lockFileName, _fileMutexConfig.LOGIN_MUTEX_TIMEOUT);
26
25
  try {
27
26
  await fileMutex.acquire();
28
- if ((0, _fs.existsSync)(authFile)) {
29
- console.log(`[DEBUG] Cookies file already exists for ${lockFileName}. Loading cookies.`);
30
- await (0, _checkAuthCookies.loadCookiesIfPresent)(page, authFile);
31
- } else {
32
- const isAlreadyLoggedIn = await isLoggedIn(testInfo);
33
- if (!isAlreadyLoggedIn) {
34
- await loginSteps(testInfo);
35
- await isLoggedIn(testInfo);
36
- await page.context().storageState({
37
- path: authFile
38
- });
39
- }
27
+ await (0, _checkAuthCookies.loadCookiesIfPresent)(page, authFile);
28
+ await page.goto(process.env.domain);
29
+ await Promise.race([page.waitForNavigation(), page.waitForLoadState('networkidle'), page.waitForTimeout(5000)]);
30
+ const isAlreadyLoggedIn = await isLoggedIn(testInfo);
31
+ if (!isAlreadyLoggedIn) {
32
+ await loginSteps(testInfo);
33
+ await page.goto(process.env.domain);
34
+ await isLoggedIn(testInfo);
35
+ await page.context().storageState({
36
+ path: authFile
37
+ });
40
38
  }
41
39
  } catch (error) {
42
40
  console.error(`Error during login for ${email}:`, error);
@@ -16,7 +16,7 @@ function getUATFileName(mode) {
16
16
  if (_fs.default.existsSync(uatConfFilePath)) {
17
17
  return uatConfFilePath;
18
18
  }
19
- return _path.default.resolve(process.cwd(), `uat.config.js`);
19
+ return _path.default.resolve(process.cwd(), `uat/conf/default/uat.config.js`);
20
20
  }
21
21
  function getEnvConfigFilePath(mode) {
22
22
  const confFilePath = _path.default.resolve(process.cwd(), `uat/conf/${mode}/settings.json`);
@@ -8,22 +8,20 @@ exports.default = void 0;
8
8
  var _path = _interopRequireDefault(require("path"));
9
9
  var _properLockfile = _interopRequireDefault(require("proper-lockfile"));
10
10
  var _fs = require("fs");
11
- function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
12
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
13
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
14
- var _getLockFilePath = /*#__PURE__*/new WeakSet();
15
- var _createDirectoryIfNotExist = /*#__PURE__*/new WeakSet();
11
+ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
12
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
13
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
14
+ var _FileMutex_brand = /*#__PURE__*/new WeakSet();
16
15
  class FileMutex {
17
16
  constructor(directory, lockFileName, options = {}) {
18
- _classPrivateMethodInitSpec(this, _createDirectoryIfNotExist);
19
- _classPrivateMethodInitSpec(this, _getLockFilePath);
17
+ _classPrivateMethodInitSpec(this, _FileMutex_brand);
20
18
  this.directory = directory;
21
19
  this.lockFileName = lockFileName + ".lock";
22
20
  this.options = options;
23
21
  }
24
22
  async acquire() {
25
- _classPrivateMethodGet(this, _createDirectoryIfNotExist, _createDirectoryIfNotExist2).call(this);
26
- const lockFilePath = _classPrivateMethodGet(this, _getLockFilePath, _getLockFilePath2).call(this);
23
+ _assertClassBrand(_FileMutex_brand, this, _createDirectoryIfNotExist).call(this);
24
+ const lockFilePath = _assertClassBrand(_FileMutex_brand, this, _getLockFilePath).call(this);
27
25
  try {
28
26
  if (!(0, _fs.existsSync)(lockFilePath)) {
29
27
  console.log(`[DEBUG] Creating missing lock file:`, this.lockFileName);
@@ -36,16 +34,16 @@ class FileMutex {
36
34
  }
37
35
  async release() {
38
36
  try {
39
- await _properLockfile.default.unlock(_classPrivateMethodGet(this, _getLockFilePath, _getLockFilePath2).call(this));
37
+ await _properLockfile.default.unlock(_assertClassBrand(_FileMutex_brand, this, _getLockFilePath).call(this));
40
38
  } catch (err) {
41
39
  throw new Error(`Failed to release lock: ${err.message}`);
42
40
  }
43
41
  }
44
42
  }
45
- function _getLockFilePath2() {
43
+ function _getLockFilePath() {
46
44
  return _path.default.resolve(_path.default.join(this.directory, this.lockFileName));
47
45
  }
48
- function _createDirectoryIfNotExist2() {
46
+ function _createDirectoryIfNotExist() {
49
47
  if (!(0, _fs.existsSync)(this.directory)) {
50
48
  (0, _fs.mkdirSync)(this.directory, {
51
49
  recursive: true
@@ -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
- Object.defineProperty(exports, "createBdd", {
6
+ exports.createBdd = void 0;
7
+ Object.defineProperty(exports, "expect", {
8
8
  enumerable: true,
9
9
  get: function () {
10
- return _bddFramework.createBdd;
10
+ return _test.expect;
11
11
  }
12
12
  });
13
- Object.defineProperty(exports, "expect", {
13
+ Object.defineProperty(exports, "test", {
14
14
  enumerable: true,
15
15
  get: function () {
16
- return _test.expect;
16
+ return _playwrightBdd.test;
17
17
  }
18
18
  });
19
- exports.test = void 0;
20
- var _bddFramework = require("../../bdd-framework");
19
+ var _playwrightBdd = require("playwright-bdd");
21
20
  var _test = require("@playwright/test");
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);
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(__dirname, '../', '../', '../', 'bdd-framework', 'cli', 'index.js');
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,21 @@ const testDir = (0, _configUtils.getTestDir)(bddMode, process.cwd(), {
39
40
  featureFilesFolder,
40
41
  stepDefinitionsFolder
41
42
  });
42
- const testOptions = (0, _configUtils.getTestUseOptions)({
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'], ['json', {
53
+ outputFile: _path.default.join(process.cwd(), 'uat', 'test-results', 'test-results.json')
54
+ }], ['./custom-reporter.js']];
55
+ if (customReporter) {
56
+ reporter = [customReporter, ...reporter];
57
+ }
48
58
 
49
59
  /**
50
60
  * Playwright configuration object
@@ -57,15 +67,12 @@ function getPlaywrightConfig() {
57
67
  globalTimeout: globalTimeout || 3600000,
58
68
  outputDir: _path.default.join(process.cwd(), 'uat', 'test-results'),
59
69
  fullyParallel: true,
60
- reporter: [['html', {
61
- outputFolder: reportPath,
62
- open: openReportOn
63
- }], ['list'], ['./custom-reporter.js']],
70
+ reporter,
64
71
  timeout: testTimeout,
65
72
  expect: {
66
73
  timeout: expectTimeout
67
74
  },
68
- use: testOptions,
75
+ use,
69
76
  projects: isAuthMode ? [{
70
77
  name: 'setup',
71
78
  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 _bddFramework = require("../../../bdd-framework");
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, _bddFramework.defineBddConfig)({
152
- paths: getPathsForFeatureFiles(cwd),
153
- import: [_path.default.join(cwd, 'uat', '**', stepDefinitionsFolder, '*.spec.js')],
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
  }
@@ -1,62 +1,50 @@
1
1
  "use strict";
2
2
 
3
3
  var _logger = require("../../utils/logger");
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();
4
+ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
5
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
6
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
7
+ var _TagProcessor_brand = /*#__PURE__*/new WeakSet();
13
8
  class TagProcessor {
14
9
  constructor(editionOrder) {
15
- _classPrivateMethodInitSpec(this, _buildEditionTags);
16
- _classPrivateMethodInitSpec(this, _getEditionArgs);
17
- _classPrivateMethodInitSpec(this, _processMultipleEditions);
18
- _classPrivateMethodInitSpec(this, _processSingleEdition);
19
- _classPrivateMethodInitSpec(this, _parseEdition);
20
- _classPrivateMethodInitSpec(this, _buildTagsString);
10
+ _classPrivateMethodInitSpec(this, _TagProcessor_brand);
21
11
  this.editionOrder = editionOrder;
22
12
  }
23
- processTags(config) {
24
- const {
25
- tags,
26
- edition
27
- } = config.getAll();
28
- if (!edition) return tags;
13
+ processTags(userArgs) {
14
+ const tagArgs = userArgs['tags'] || '';
15
+ const edition = userArgs['edition'] || null;
16
+ if (!edition) return tagArgs;
29
17
  const editionsArray = edition.split(',');
30
- const editionTags = editionsArray.length === 1 ? _classPrivateMethodGet(this, _processSingleEdition, _processSingleEdition2).call(this, editionsArray[0], tags) : _classPrivateMethodGet(this, _processMultipleEditions, _processMultipleEditions2).call(this, editionsArray, tags);
18
+ const editionTags = editionsArray.length === 1 ? _assertClassBrand(_TagProcessor_brand, this, _processSingleEdition).call(this, editionsArray[0], tagArgs) : _assertClassBrand(_TagProcessor_brand, this, _processMultipleEditions).call(this, editionsArray, tagArgs);
31
19
  return editionTags;
32
20
  }
33
21
  }
34
- function _buildTagsString2(tags, editionTags) {
22
+ function _buildTagsString(tags, editionTags) {
35
23
  return tags && tags !== '' ? `${tags} and not (${editionTags})` : `not (${editionTags})`;
36
24
  }
37
- function _parseEdition2(edition) {
25
+ function _parseEdition(edition) {
38
26
  if (edition.startsWith('<=')) return ['<=', edition.slice(2)];
39
27
  if (edition.startsWith('>=')) return ['>=', edition.slice(2)];
40
28
  if (edition.startsWith('<')) return ['<', edition.slice(1)];
41
29
  if (edition.startsWith('>')) return ['>', edition.slice(1)];
42
30
  return [null, edition];
43
31
  }
44
- function _processSingleEdition2(selectedEdition, tagArgs) {
45
- const editionArgs = _classPrivateMethodGet(this, _getEditionArgs, _getEditionArgs2).call(this, selectedEdition);
32
+ function _processSingleEdition(selectedEdition, tagArgs) {
33
+ const editionArgs = _assertClassBrand(_TagProcessor_brand, this, _getEditionArgs).call(this, selectedEdition);
46
34
  if (editionArgs && editionArgs.length > 0) {
47
- const editionTags = _classPrivateMethodGet(this, _buildEditionTags, _buildEditionTags2).call(this, editionArgs, 'or');
48
- return _classPrivateMethodGet(this, _buildTagsString, _buildTagsString2).call(this, tagArgs, editionTags);
35
+ const editionTags = _assertClassBrand(_TagProcessor_brand, this, _buildEditionTags).call(this, editionArgs, 'or');
36
+ return _assertClassBrand(_TagProcessor_brand, this, _buildTagsString).call(this, tagArgs, editionTags);
49
37
  }
50
38
  _logger.Logger.log(_logger.Logger.INFO_TYPE, `No matching editions for ${selectedEdition} found. Running with default edition`);
51
39
  return tagArgs;
52
40
  }
53
- function _processMultipleEditions2(editionsArray, tagArgs) {
41
+ function _processMultipleEditions(editionsArray, tagArgs) {
54
42
  const filteredEditions = this.editionOrder.filter(edition => !editionsArray.includes(edition));
55
- const editionTags = _classPrivateMethodGet(this, _buildEditionTags, _buildEditionTags2).call(this, filteredEditions, 'or');
56
- return _classPrivateMethodGet(this, _buildTagsString, _buildTagsString2).call(this, tagArgs, editionTags);
43
+ const editionTags = _assertClassBrand(_TagProcessor_brand, this, _buildEditionTags).call(this, filteredEditions, 'or');
44
+ return _assertClassBrand(_TagProcessor_brand, this, _buildTagsString).call(this, tagArgs, editionTags);
57
45
  }
58
- function _getEditionArgs2(selectedEdition) {
59
- const [operator, editionValue] = _classPrivateMethodGet(this, _parseEdition, _parseEdition2).call(this, selectedEdition.toLowerCase());
46
+ function _getEditionArgs(selectedEdition) {
47
+ const [operator, editionValue] = _assertClassBrand(_TagProcessor_brand, this, _parseEdition).call(this, selectedEdition.toLowerCase());
60
48
  const index = this.editionOrder.findIndex(edition => edition.toLowerCase() === editionValue);
61
49
  if (index === -1) {
62
50
  _logger.Logger.log(_logger.Logger.INFO_TYPE, `No matching editions for ${selectedEdition} found. Running with default edition`);
@@ -75,7 +63,7 @@ function _getEditionArgs2(selectedEdition) {
75
63
  return this.editionOrder.filter((_, i) => i !== index);
76
64
  }
77
65
  }
78
- function _buildEditionTags2(editionArgs, operator = 'or') {
66
+ function _buildEditionTags(editionArgs, operator = 'or') {
79
67
  return editionArgs.map(edition => `@edition_${edition}`).join(` ${operator} `);
80
68
  }
81
69
  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(__dirname, '../', '../', 'bdd-framework', 'cli', 'index.js');
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');
@@ -104,7 +104,7 @@ function main() {
104
104
  //This is only used for pass the user arguments to need places in legacy code. We need to rewamp that also.
105
105
  const userArgsObject = userArgConfig.getAll();
106
106
  const tagProcessor = new _tagProcessor.default(editionOrder);
107
- const tagArgs = tagProcessor.processTags(uatConfig);
107
+ const tagArgs = tagProcessor.processTags(userArgsObject);
108
108
  const runnerObj = new _Runner.default();
109
109
  runnerObj.setTagArgs(tagArgs);
110
110
  runnerObj.setUserArgs(userArgsObject);
@@ -1 +1 @@
1
- export * from './bdd-framework/decorators';
1
+ export * from 'playwright-bdd/decorators';
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _decorators = require("./bdd-framework/decorators");
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;
@@ -0,0 +1,2 @@
1
+ const editions = require('./editions/index');
2
+ module.exports = { editions }