@zohodesk/testinglibrary 0.4.43-experimental → 0.4.45-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 (36) hide show
  1. package/.gitlab-ci.yml +20 -12
  2. package/build/bdd-framework/cucumber/formatter/EventDataCollector.js +1 -1
  3. package/build/bdd-framework/reporter/cucumber/json.js +1 -1
  4. package/build/bdd-framework/reporter/cucumber/messagesBuilder/Meta.js +1 -1
  5. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepAttachments.js +1 -1
  6. package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepRun.js +1 -1
  7. package/build/core/playwright/builtInFixtures/page.js +64 -46
  8. package/build/core/playwright/constants/fileMutexConfig.js +3 -4
  9. package/build/core/playwright/custom-commands.js +1 -1
  10. package/build/core/playwright/helpers/auth/loginSteps.js +26 -18
  11. package/build/core/playwright/helpers/fileMutex.js +13 -11
  12. package/build/core/playwright/tagProcessor.js +32 -24
  13. package/build/core/playwright/test-runner.js +1 -1
  14. package/build/test/core/playwright/__tests__/tagProcessor.test.js +18 -19
  15. package/nobdd/README.md +1 -0
  16. package/nobdd/package.json +17 -0
  17. package/nobdd/src/App.js +7 -0
  18. package/nobdd/uat/conf/default/actors/editions/enterprise.json +24 -0
  19. package/nobdd/uat/conf/default/actors/editions/index.js +4 -0
  20. package/nobdd/uat/conf/default/actors/index.js +2 -0
  21. package/nobdd/uat/conf/default/settings.json +6 -0
  22. package/nobdd/uat/conf/nobdd/uat.config.js +36 -0
  23. package/nobdd/uat/env-config.json +20 -0
  24. package/nobdd/uat/fixtures/auth.setup.js +44 -0
  25. package/nobdd/uat/fixtures/setup.teardown.js +33 -0
  26. package/nobdd/uat/modules/nobdd/steps/VerifyNoBDD.feature.spec.js +16 -0
  27. package/nobdd/uat/shared/commands/_index-custom-fixtures.js +9 -0
  28. package/nobdd/uat/shared/commands/i18n.js +25 -0
  29. package/nobdd/uat/shared/commands/unauthenticatedPage.js +8 -0
  30. package/nobdd/uat/shared/index.js +7 -0
  31. package/nobdd/uat/shared/onboardings/onboardingUpdate.js +44 -0
  32. package/nobdd/uat/shared/url-helpers/getUrlOrigin.js +6 -0
  33. package/nobdd/uat.config.js +37 -0
  34. package/npm-shrinkwrap.json +1305 -1470
  35. package/package.json +5 -6
  36. package/unit_reports/unit-report.html +0 -260
package/.gitlab-ci.yml CHANGED
@@ -14,23 +14,18 @@ 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
21
- - npm-shrinkwrap.json
22
21
 
23
22
  # Install dependencies stage
24
23
  build:
25
24
  stage: build
26
25
  script:
27
- - npm -v
28
- - node -v
29
26
  - npm install --ignore-scripts
30
27
  - npm run build
31
28
  - npm install
32
- - npm shrinkwrap
33
- - npm run build
34
29
 
35
30
  # Unit tests stage
36
31
  unit:
@@ -50,7 +45,9 @@ uat-auth:
50
45
  - npm install $(npm pack ../../testing-framework | tail -1)
51
46
  - output=$(npm run uatauth)
52
47
  - echo "$output"
53
- - node ../ValidateUATReport.js examples
48
+ - if [[ "$output" == *"failed"* ]]; then
49
+ - exit 1
50
+ - fi
54
51
 
55
52
  artifacts:
56
53
  when: always
@@ -64,7 +61,9 @@ uat-noauth:
64
61
  - npm install $(npm pack ../../testing-framework | tail -1)
65
62
  - output=$(npm run uatnoauth)
66
63
  - echo "$output"
67
- - node ../ValidateUATReport.js examples
64
+ - if [[ "$output" == *"failed"* ]]; then
65
+ - exit 1
66
+ - fi
68
67
 
69
68
  artifacts:
70
69
  when: always
@@ -78,7 +77,9 @@ uat-profile:
78
77
  - npm install $(npm pack ../../testing-framework | tail -1)
79
78
  - output=$(npm run uatprofile)
80
79
  - echo "$output"
81
- - node ../ValidateUATReport.js examples
80
+ - if [[ "$output" == *"failed"* ]]; then
81
+ - exit 1
82
+ - fi
82
83
 
83
84
  artifacts:
84
85
  when: always
@@ -88,12 +89,17 @@ uat-profile:
88
89
 
89
90
  uat-unauth:
90
91
  stage: uat
92
+ image: repository.desk.csez.zohocorpin.com/base-image/testing-framework-gitlab-runne-base:v2
91
93
  script:
94
+ - npm install
95
+ - npm run build
92
96
  - cd examples
93
97
  - npm install $(npm pack ../../testing-framework | tail -1)
94
98
  - output=$(npm run uatunauth)
95
99
  - echo "$output"
96
- - node ../ValidateUATReport.js examples
100
+ - if [[ "$output" == *"failed"* ]]; then
101
+ - exit 1
102
+ - fi
97
103
 
98
104
 
99
105
  artifacts:
@@ -106,9 +112,11 @@ uat-nobdd:
106
112
  script:
107
113
  - cd nobdd
108
114
  - npm install $(npm pack ../../testing-framework | tail -1)
109
- - output=$(npm run uatnobdd -- --headless)
115
+ - output=$(npm run uatnobdd)
110
116
  - echo "$output"
111
- - node ../ValidateUATReport.js nobdd
117
+ - if [[ "$output" == *"failed"* ]]; then
118
+ - exit 1
119
+ - fi
112
120
 
113
121
 
114
122
  artifacts:
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
  var messages = _interopRequireWildcard(require("@cucumber/messages"));
8
8
  var _valueChecker = require("../valueChecker");
9
9
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
11
  /**
12
12
  * Groups Cucumber messages for easier access.
13
13
  * Based on Cucumber, with some changes due to strictNullChecks errors.
@@ -16,7 +16,7 @@ var _locationHelpers = require("../../cucumber/formatter/locationHelpers");
16
16
  var _GherkinDocument = require("./messagesBuilder/GherkinDocument");
17
17
  var _Projects = require("./messagesBuilder/Projects");
18
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
19
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
20
  /**
21
21
  * Cucumber json reporter.
22
22
  * Based on: https://github.com/cucumber/cucumber-js/blob/main/src/formatter/json_formatter.ts
@@ -9,7 +9,7 @@ var _os = _interopRequireDefault(require("os"));
9
9
  var messages = _interopRequireWildcard(require("@cucumber/messages"));
10
10
  var _utils = require("../../../utils");
11
11
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
13
  /**
14
14
  * Builds meta message.
15
15
  * See: https://github.com/cucumber/cucumber-js/blob/main/src/cli/helpers.ts#L100
@@ -9,7 +9,7 @@ var _fs = _interopRequireDefault(require("fs"));
9
9
  var messages = _interopRequireWildcard(require("@cucumber/messages"));
10
10
  var _path = _interopRequireDefault(require("path"));
11
11
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
13
  /**
14
14
  * Class for getting attachment messages for a particular step.
15
15
  */
@@ -9,7 +9,7 @@ var _stripAnsiEscapes = require("../../../utils/stripAnsiEscapes");
9
9
  var _timing = require("./timing");
10
10
  var _TestStepAttachments = require("./TestStepAttachments");
11
11
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
13
  class TestStepRun {
14
14
  testCaseRun;
15
15
  testStep;
@@ -1,10 +1,12 @@
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
7
  exports.default = void 0;
7
8
  var _auth = require("../helpers/auth");
9
+ var _getUrlOrigin = _interopRequireDefault(require("../helpers/auth/getUrlOrigin"));
8
10
  var _readConfigFile = require("../readConfigFile");
9
11
  /* eslint-disable global-require */
10
12
 
@@ -27,68 +29,84 @@ function getCustomAccountDetails(tags) {
27
29
  const user = (0, _auth.getUserForSelectedEditionAndProfile)(editionInfo, profileInfo, betaFeature, portalInfo);
28
30
  return user;
29
31
  }
30
- return (0, _auth.getDefaultActor)();
32
+ return null;
31
33
  }
32
34
  const {
33
35
  testSetup
34
36
  } = (0, _readConfigFile.generateConfigFromFile)();
35
- async function loginSteps(pageDetail) {
36
- const {
37
- page
38
- } = pageDetail;
39
- if (testSetup.loginSteps && typeof testSetup.loginSteps === 'function') {
40
- return await testSetup.loginSteps(pageDetail);
37
+ async function performDefaultPageSteps({
38
+ context,
39
+ $tags,
40
+ page
41
+ }) {
42
+ if (testSetup.page && typeof testSetup.page === 'function') {
43
+ await testSetup.page({
44
+ context,
45
+ $tags,
46
+ page
47
+ });
41
48
  } else {
42
49
  await page.goto(process.env.domain);
43
50
  }
44
51
  }
45
- async function performDefaultPageSteps(testInfo) {
46
- if (testSetup.page && typeof testSetup.page === 'function') {
47
- await testSetup.page(testInfo);
48
- }
49
- }
50
- async function verifyPageIsLoaded(testInfo) {
51
- if (testSetup.validateLogin && typeof testSetup.validateLogin === 'function') {
52
- return await testSetup.validateLogin(testInfo);
52
+ async function verifyPageIsLoaded(page) {
53
+ const urlOrigin = (0, _getUrlOrigin.default)(page.url());
54
+ const domainOrigin = (0, _getUrlOrigin.default)(process.env.domain);
55
+ if (urlOrigin === domainOrigin) {
56
+ return true;
53
57
  }
54
- return true;
58
+ return false;
55
59
  }
56
60
  var _default = exports.default = {
57
61
  page: async ({
58
62
  context,
59
63
  $tags,
60
64
  page
61
- }, use, testInfo) => {
62
- let testPortalDetails = getCustomAccountDetails($tags);
63
- let testDetails = {
64
- page,
65
- $tags,
66
- context,
67
- ...testPortalDetails
68
- };
69
- try {
70
- //This block is used to skip the login process if the @unauthenticated tag is added to the script
71
- if ($tags.includes('@unauthenticated')) {
72
- await context.clearCookies();
73
- return;
74
- }
65
+ }, use) => {
66
+ const {
67
+ isAuthMode
68
+ } = (0, _readConfigFile.generateConfigFromFile)();
69
+ if (!isAuthMode) {
70
+ await use(page);
71
+ return;
72
+ }
73
+
74
+ //This block is used to skip the login process if the @unauthenticated tag is added to the script
75
+ if ($tags.includes('@unauthenticated')) {
76
+ await context.clearCookies();
77
+ await use(page);
78
+ return;
79
+ }
80
+ const testPortalDetails = getCustomAccountDetails($tags);
81
+ if (testPortalDetails === null) {
82
+ await performDefaultPageSteps({
83
+ context,
84
+ $tags,
85
+ page
86
+ });
87
+ const user = (0, _auth.getDefaultActor)();
88
+ process.env.actorInfo = JSON.stringify(user);
89
+ await use(page);
90
+ } else {
91
+ await context.clearCookies();
75
92
  const {
76
- isAuthMode
77
- } = (0, _readConfigFile.generateConfigFromFile)();
78
- if (!isAuthMode) {
79
- return;
80
- }
81
- if (testPortalDetails && testInfo.project.name !== 'setup') {
82
- await context.clearCookies();
83
- await (0, _auth.performLoginSteps)(testDetails, async testInfo => {
84
- return await verifyPageIsLoaded(testInfo);
85
- }, loginSteps);
86
- process.env.actorInfo = JSON.stringify(testPortalDetails);
87
- }
88
- } catch (e) {
89
- console.error('Error during page', e);
90
- } finally {
91
- await performDefaultPageSteps(testDetails);
93
+ email,
94
+ password
95
+ } = testPortalDetails;
96
+ await (0, _auth.performLoginSteps)({
97
+ page,
98
+ authFilePrefix: email,
99
+ useremail: email,
100
+ password: password
101
+ }, async () => {
102
+ return await verifyPageIsLoaded(page);
103
+ });
104
+ process.env.actorInfo = JSON.stringify(testPortalDetails);
105
+ await performDefaultPageSteps({
106
+ context,
107
+ $tags,
108
+ page
109
+ });
92
110
  await use(page);
93
111
  await context.close();
94
112
  }
@@ -5,11 +5,10 @@ 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: 100000,
8
+ stale: 10000,
9
9
  retries: {
10
- retries: 10,
10
+ retries: 30,
11
11
  factor: 1,
12
- minTimeout: 10000,
13
- maxTimeout: 20000
12
+ minTimeout: 1000
14
13
  }
15
14
  };
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.CUSTOM_COMMANDS = void 0;
7
- const CUSTOM_COMMANDS = exports.CUSTOM_COMMANDS = ['mode', 'tags', 'edition', 'browsers', 'filePath', 'headless'];
7
+ const CUSTOM_COMMANDS = exports.CUSTOM_COMMANDS = ['mode', 'tags', 'edition', 'browsers', 'filePath'];
@@ -6,40 +6,48 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _path = _interopRequireDefault(require("path"));
9
+ var _fs = require("fs");
9
10
  var _fileMutex = _interopRequireDefault(require("../fileMutex"));
10
11
  var _fileMutexConfig = require("../../constants/fileMutexConfig");
12
+ var _accountLogin = _interopRequireDefault(require("./accountLogin"));
11
13
  var _checkAuthCookies = require("./checkAuthCookies");
12
14
  var _checkAuthDirectory = require("../checkAuthDirectory");
13
15
  /* eslint-disable no-console */
14
16
 
15
- async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
16
- let {
17
- page,
18
- authFilePrefix,
19
- email
20
- } = testInfo;
21
- authFilePrefix = authFilePrefix || email;
17
+ async function performLoginSteps({
18
+ page,
19
+ authFilePrefix,
20
+ useremail,
21
+ password
22
+ }, isLoggedIn) {
22
23
  const authFile = _path.default.resolve(_path.default.join((0, _checkAuthCookies.getAuthFileDirectory)(), `${authFilePrefix}-cookies.json`));
23
- const lockFileName = email.replace(/[@.]/g, '_');
24
+ const lockFileName = useremail.replace(/[@.]/g, '_');
24
25
  const fileMutex = new _fileMutex.default((0, _checkAuthDirectory.getLockDirectoryPath)(), lockFileName, _fileMutexConfig.LOGIN_MUTEX_TIMEOUT);
25
26
  try {
26
27
  await fileMutex.acquire();
27
- await (0, _checkAuthCookies.loadCookiesIfPresent)(page, authFile);
28
- const isAlreadyLoggedIn = await isLoggedIn(testInfo);
29
- if (!isAlreadyLoggedIn) {
30
- await loginSteps(testInfo);
31
- await isLoggedIn(testInfo);
32
- await page.context().storageState({
33
- path: authFile
34
- });
28
+ if ((0, _fs.existsSync)(authFile)) {
29
+ console.log(`[DEBUG] Cookies file already exists for ${useremail}. Loading cookies.`);
30
+ await (0, _checkAuthCookies.loadCookiesIfPresent)(page, authFile);
31
+ } else {
32
+ await page.goto(process.env.domain);
33
+ await Promise.race([page.waitForNavigation(), page.waitForLoadState('networkidle'), page.waitForTimeout(5000)]);
34
+ const isAlreadyLoggedIn = await isLoggedIn(page);
35
+ if (!isAlreadyLoggedIn) {
36
+ await (0, _accountLogin.default)(page, useremail, password);
37
+ await page.goto(process.env.domain);
38
+ await isLoggedIn(page);
39
+ await page.context().storageState({
40
+ path: authFile
41
+ });
42
+ }
35
43
  }
36
44
  } catch (error) {
37
- console.error(`Error during login for ${email}:`, error);
45
+ console.error(`Error during login for ${useremail}:`, error);
38
46
  } finally {
39
47
  try {
40
48
  await fileMutex.release();
41
49
  } catch (releaseError) {
42
- console.error(`Error releasing lock for ${email}:`, releaseError);
50
+ console.error(`Error releasing lock for ${useremail}:`, releaseError);
43
51
  }
44
52
  }
45
53
  }
@@ -8,42 +8,44 @@ 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(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();
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();
15
16
  class FileMutex {
16
17
  constructor(directory, lockFileName, options = {}) {
17
- _classPrivateMethodInitSpec(this, _FileMutex_brand);
18
+ _classPrivateMethodInitSpec(this, _createDirectoryIfNotExist);
19
+ _classPrivateMethodInitSpec(this, _getLockFilePath);
18
20
  this.directory = directory;
19
21
  this.lockFileName = lockFileName + ".lock";
20
22
  this.options = options;
21
23
  }
22
24
  async acquire() {
23
- _assertClassBrand(_FileMutex_brand, this, _createDirectoryIfNotExist).call(this);
24
- const lockFilePath = _assertClassBrand(_FileMutex_brand, this, _getLockFilePath).call(this);
25
+ _classPrivateMethodGet(this, _createDirectoryIfNotExist, _createDirectoryIfNotExist2).call(this);
26
+ const lockFilePath = _path.default.resolve(this.directory, this.lockFileName);
25
27
  try {
26
28
  if (!(0, _fs.existsSync)(lockFilePath)) {
27
29
  console.log(`[DEBUG] Creating missing lock file:`, this.lockFileName);
28
30
  (0, _fs.writeFileSync)(lockFilePath, 'locked');
29
31
  }
30
- await _properLockfile.default.lock(lockFilePath, this.options);
32
+ await _properLockfile.default.lock(_classPrivateMethodGet(this, _getLockFilePath, _getLockFilePath2).call(this), this.options);
31
33
  } catch (err) {
32
34
  throw new Error(`Failed to acquire lock after ${this.options.retries.retries} attempts: ${err.message}`);
33
35
  }
34
36
  }
35
37
  async release() {
36
38
  try {
37
- await _properLockfile.default.unlock(_assertClassBrand(_FileMutex_brand, this, _getLockFilePath).call(this));
39
+ await _properLockfile.default.unlock(_classPrivateMethodGet(this, _getLockFilePath, _getLockFilePath2).call(this));
38
40
  } catch (err) {
39
41
  throw new Error(`Failed to release lock: ${err.message}`);
40
42
  }
41
43
  }
42
44
  }
43
- function _getLockFilePath() {
45
+ function _getLockFilePath2() {
44
46
  return _path.default.resolve(_path.default.join(this.directory, this.lockFileName));
45
47
  }
46
- function _createDirectoryIfNotExist() {
48
+ function _createDirectoryIfNotExist2() {
47
49
  if (!(0, _fs.existsSync)(this.directory)) {
48
50
  (0, _fs.mkdirSync)(this.directory, {
49
51
  recursive: true
@@ -1,52 +1,60 @@
1
1
  "use strict";
2
2
 
3
3
  var _logger = require("../../utils/logger");
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();
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, _TagProcessor_brand);
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
- processTags(config) {
14
- const {
15
- tags,
16
- edition
17
- } = config.getAll();
18
- if (!edition) return tags;
23
+ processTags(userArgs) {
24
+ const tagArgs = userArgs['tags'] || '';
25
+ const edition = userArgs['edition'] || null;
26
+ if (!edition) return tagArgs;
19
27
  const editionsArray = edition.split(',');
20
- const editionTags = editionsArray.length === 1 ? _assertClassBrand(_TagProcessor_brand, this, _processSingleEdition).call(this, editionsArray[0], tags) : _assertClassBrand(_TagProcessor_brand, this, _processMultipleEditions).call(this, editionsArray, tags);
28
+ const editionTags = editionsArray.length === 1 ? _classPrivateMethodGet(this, _processSingleEdition, _processSingleEdition2).call(this, editionsArray[0], tagArgs) : _classPrivateMethodGet(this, _processMultipleEditions, _processMultipleEditions2).call(this, editionsArray, tagArgs);
21
29
  return editionTags;
22
30
  }
23
31
  }
24
- function _buildTagsString(tags, editionTags) {
32
+ function _buildTagsString2(tags, editionTags) {
25
33
  return tags && tags !== '' ? `${tags} and not (${editionTags})` : `not (${editionTags})`;
26
34
  }
27
- function _parseEdition(edition) {
35
+ function _parseEdition2(edition) {
28
36
  if (edition.startsWith('<=')) return ['<=', edition.slice(2)];
29
37
  if (edition.startsWith('>=')) return ['>=', edition.slice(2)];
30
38
  if (edition.startsWith('<')) return ['<', edition.slice(1)];
31
39
  if (edition.startsWith('>')) return ['>', edition.slice(1)];
32
40
  return [null, edition];
33
41
  }
34
- function _processSingleEdition(selectedEdition, tagArgs) {
35
- const editionArgs = _assertClassBrand(_TagProcessor_brand, this, _getEditionArgs).call(this, selectedEdition);
42
+ function _processSingleEdition2(selectedEdition, tagArgs) {
43
+ const editionArgs = _classPrivateMethodGet(this, _getEditionArgs, _getEditionArgs2).call(this, selectedEdition);
36
44
  if (editionArgs && editionArgs.length > 0) {
37
- const editionTags = _assertClassBrand(_TagProcessor_brand, this, _buildEditionTags).call(this, editionArgs, 'or');
38
- return _assertClassBrand(_TagProcessor_brand, this, _buildTagsString).call(this, tagArgs, editionTags);
45
+ const editionTags = _classPrivateMethodGet(this, _buildEditionTags, _buildEditionTags2).call(this, editionArgs, 'or');
46
+ return _classPrivateMethodGet(this, _buildTagsString, _buildTagsString2).call(this, tagArgs, editionTags);
39
47
  }
40
48
  _logger.Logger.log(_logger.Logger.INFO_TYPE, `No matching editions for ${selectedEdition} found. Running with default edition`);
41
49
  return tagArgs;
42
50
  }
43
- function _processMultipleEditions(editionsArray, tagArgs) {
51
+ function _processMultipleEditions2(editionsArray, tagArgs) {
44
52
  const filteredEditions = this.editionOrder.filter(edition => !editionsArray.includes(edition));
45
- const editionTags = _assertClassBrand(_TagProcessor_brand, this, _buildEditionTags).call(this, filteredEditions, 'or');
46
- return _assertClassBrand(_TagProcessor_brand, this, _buildTagsString).call(this, tagArgs, editionTags);
53
+ const editionTags = _classPrivateMethodGet(this, _buildEditionTags, _buildEditionTags2).call(this, filteredEditions, 'or');
54
+ return _classPrivateMethodGet(this, _buildTagsString, _buildTagsString2).call(this, tagArgs, editionTags);
47
55
  }
48
- function _getEditionArgs(selectedEdition) {
49
- const [operator, editionValue] = _assertClassBrand(_TagProcessor_brand, this, _parseEdition).call(this, selectedEdition.toLowerCase());
56
+ function _getEditionArgs2(selectedEdition) {
57
+ const [operator, editionValue] = _classPrivateMethodGet(this, _parseEdition, _parseEdition2).call(this, selectedEdition.toLowerCase());
50
58
  const index = this.editionOrder.findIndex(edition => edition.toLowerCase() === editionValue);
51
59
  if (index === -1) {
52
60
  _logger.Logger.log(_logger.Logger.INFO_TYPE, `No matching editions for ${selectedEdition} found. Running with default edition`);
@@ -65,7 +73,7 @@ function _getEditionArgs(selectedEdition) {
65
73
  return this.editionOrder.filter((_, i) => i !== index);
66
74
  }
67
75
  }
68
- function _buildEditionTags(editionArgs, operator = 'or') {
76
+ function _buildEditionTags2(editionArgs, operator = 'or') {
69
77
  return editionArgs.map(edition => `@edition_${edition}`).join(` ${operator} `);
70
78
  }
71
79
  module.exports = TagProcessor;
@@ -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);