@zohodesk/testinglibrary 0.5.10-n18-experimental → 0.5.12-n18-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 (28) hide show
  1. package/.gitlab-ci.yml +11 -11
  2. package/README.md +0 -8
  3. package/build/core/playwright/clear-caches.js +5 -2
  4. package/build/core/playwright/configuration/ConfigurationHelper.js +7 -5
  5. package/build/core/playwright/constants/configConstants.js +14 -0
  6. package/build/core/playwright/constants/reporterConstants.js +6 -2
  7. package/build/core/playwright/custom-commands.js +1 -1
  8. package/build/core/playwright/env-initializer.js +10 -9
  9. package/build/core/playwright/helpers/auth/getUsers.js +14 -14
  10. package/build/core/playwright/helpers/auth/index.js +8 -1
  11. package/build/core/playwright/helpers/auth/loginDefaultStepsHelper.js +0 -2
  12. package/build/core/playwright/helpers/auth/loginSteps.js +5 -13
  13. package/build/core/playwright/helpers/configFileNameProvider.js +15 -8
  14. package/build/core/playwright/helpers/configPathResolver.js +38 -0
  15. package/build/core/playwright/readConfigFile.js +8 -9
  16. package/build/core/playwright/setup/ProjectConfiguration.js +9 -26
  17. package/build/core/playwright/setup/config-creator.js +8 -5
  18. package/build/core/playwright/setup/config-utils.js +7 -3
  19. package/build/core/playwright/setup/qc-custom-reporter.js +4 -1
  20. package/build/core/playwright/test-runner.js +4 -6
  21. package/build/index.js +6 -0
  22. package/build/test/core/playwright/helpers/__tests__/configFileNameProvider.test.js +54 -13
  23. package/build/test/core/playwright/helpers/__tests__/configPathResolver.test.js +55 -0
  24. package/build/test/core/playwright/helpers/__tests__/getUsers_ListOfActors.test.js +29 -26
  25. package/build/utils/commonUtils.js +4 -1
  26. package/npm-shrinkwrap.json +146 -194
  27. package/package.json +2 -1
  28. package/playwright.config.js +10 -7
package/.gitlab-ci.yml CHANGED
@@ -55,7 +55,7 @@ uat-auth:
55
55
  artifacts:
56
56
  when: always
57
57
  paths:
58
- - examples/uat/playwright-report
58
+ - examples/test-slices/uat/playwright-report
59
59
 
60
60
  uat-noauth:
61
61
  stage: uat
@@ -69,7 +69,7 @@ uat-noauth:
69
69
  artifacts:
70
70
  when: always
71
71
  paths:
72
- - examples/uat/playwright-report
72
+ - examples/test-slices/uat/playwright-report
73
73
 
74
74
  uat-profile:
75
75
  stage: uat
@@ -83,7 +83,7 @@ uat-profile:
83
83
  artifacts:
84
84
  when: always
85
85
  paths:
86
- - examples/uat/playwright-report
86
+ - examples/test-slices/uat/playwright-report
87
87
 
88
88
 
89
89
  uat-unauth:
@@ -99,7 +99,7 @@ uat-unauth:
99
99
  artifacts:
100
100
  when: always
101
101
  paths:
102
- - examples/uat/playwright-report
102
+ - examples/test-slices/uat/playwright-report
103
103
 
104
104
  uat-nobdd:
105
105
  stage: uat
@@ -114,7 +114,7 @@ uat-nobdd:
114
114
  artifacts:
115
115
  when: always
116
116
  paths:
117
- - nobdd/uat/playwright-report
117
+ - nobdd/test-slices/uat/playwright-report
118
118
 
119
119
 
120
120
  uatmodule:
@@ -130,7 +130,7 @@ uatmodule:
130
130
  artifacts:
131
131
  when: always
132
132
  paths:
133
- - examples/uat/playwright-report
133
+ - examples/test-slices/uat/playwright-report
134
134
 
135
135
  uatconfigmodule:
136
136
  stage: uat
@@ -144,7 +144,7 @@ uatconfigmodule:
144
144
  artifacts:
145
145
  when: always
146
146
  paths:
147
- - examples/uat/playwright-report
147
+ - examples/test-slices/uat/playwright-report
148
148
 
149
149
  uat-smoketest:
150
150
  stage: uat
@@ -158,7 +158,7 @@ uat-smoketest:
158
158
  artifacts:
159
159
  when: always
160
160
  paths:
161
- - examples/uat/playwright-report
161
+ - examples/test-slices/uat/playwright-report
162
162
 
163
163
  uat-multiactor:
164
164
  stage: uat
@@ -172,7 +172,7 @@ uat-multiactor:
172
172
  artifacts:
173
173
  when: always
174
174
  paths:
175
- - examples/uat/playwright-report
175
+ - examples/test-slices/uat/playwright-report
176
176
 
177
177
  uat-data_generator:
178
178
  stage: uat
@@ -186,7 +186,7 @@ uat-data_generator:
186
186
  artifacts:
187
187
  when: always
188
188
  paths:
189
- - examples/uat/playwright-report
189
+ - examples/test-slices/uat/playwright-report
190
190
 
191
191
  # uat-search_indexing:
192
192
  # stage: uat
@@ -200,7 +200,7 @@ uat-data_generator:
200
200
  # artifacts:
201
201
  # when: always
202
202
  # paths:
203
- # - examples/uat/playwright-report
203
+ # - examples/test-slices/uat/playwright-report
204
204
 
205
205
 
206
206
 
package/README.md CHANGED
@@ -40,14 +40,6 @@
40
40
 
41
41
  - New step a search entity using {string} provided for search indexing, This step will use run time data generation response as input for the indexing
42
42
 
43
- ### Issue fix
44
- - Custom teardown comment provided
45
-
46
- ### v3.2.10 - 09-10-2025
47
-
48
- #### Enhancement
49
- - A teardown option has been introduced in the configuration to manage and clean up login sessions stored in the NFS environment.
50
-
51
43
 
52
44
  ### v3.2.9 - 26-09-2025
53
45
 
@@ -10,6 +10,9 @@ var _fileUtils = require("../../utils/fileUtils");
10
10
  var _logger = require("../../utils/logger");
11
11
  var _readConfigFile = require("./readConfigFile");
12
12
  var _checkAuthDirectory = require("./helpers/checkAuthDirectory");
13
+ var _configConstants = _interopRequireDefault(require("./constants/configConstants"));
14
+ var _ConfigurationHelper = require("./configuration/ConfigurationHelper");
15
+ const stage = (0, _ConfigurationHelper.getRunStage)();
13
16
  function deleteAuthFiles(authFilePath) {
14
17
  authFilePath = _path.default.resolve(process.cwd(), authFilePath);
15
18
  const authFileFolder = _path.default.dirname(authFilePath);
@@ -21,7 +24,7 @@ function deletePlaywrightReport(reportPath) {
21
24
  (0, _fileUtils.deleteFolder)(reportPath);
22
25
  }
23
26
  function deleteGeneratedFeatures() {
24
- const featuresGenPath = _path.default.resolve(process.cwd(), 'uat', '.features-gen');
27
+ const featuresGenPath = _path.default.resolve(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER, stage, '.features-gen');
25
28
  _logger.Logger.log(_logger.Logger.INFO_TYPE, `Deleting generated features at ${featuresGenPath}`);
26
29
  (0, _fileUtils.deleteFolder)(featuresGenPath);
27
30
  }
@@ -43,7 +46,7 @@ function clearCaches() {
43
46
  _logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Caches Cleared. Now you can try running npm run uat');
44
47
  } catch (err) {
45
48
  _logger.Logger.error(err);
46
- _logger.Logger.log(_logger.Logger.FAILURE_TYPE, 'Error While clearing cookies. Try manually delete folder uat/playwright and uat/playwright-report');
49
+ _logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Error While clearing cookies. Try manually delete folder ${_configConstants.default.TEST_SLICE_FOLDER}/playwright and ${_configConstants.default.TEST_SLICE_FOLDER}/playwright-report`);
47
50
  }
48
51
  }
49
52
  var _default = exports.default = clearCaches;
@@ -1,17 +1,15 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.combineConfiguration = combineConfiguration;
8
7
  exports.getApplicationConfig = getApplicationConfig;
9
- var _path = _interopRequireDefault(require("path"));
8
+ exports.getRunStage = getRunStage;
10
9
  var _logger = require("../../../utils/logger");
11
10
  var _configFileNameProvider = require("../helpers/configFileNameProvider");
12
11
  var _mergeObjects = require("../helpers/mergeObjects");
13
12
  var _fs = require("fs");
14
- const Configuration = require("./Configuration");
15
13
  function combineConfiguration(defaultConfig, userConfiguration) {
16
14
  let configurationObj = {};
17
15
  Object.keys(userConfiguration).forEach(configKey => {
@@ -26,10 +24,10 @@ function combineConfiguration(defaultConfig, userConfiguration) {
26
24
  });
27
25
  return (0, _mergeObjects.mergeObjects)(defaultConfig, configurationObj);
28
26
  }
29
- function getApplicationConfig(mode) {
27
+ function getApplicationConfig(stage, mode) {
30
28
  let filePath = "";
31
29
  try {
32
- filePath = _path.default.resolve(process.cwd(), (0, _configFileNameProvider.getUATFileName)(mode));
30
+ filePath = (0, _configFileNameProvider.getUATFileName)(stage, mode);
33
31
  if (!(0, _fs.existsSync)(filePath)) {
34
32
  throw new Error("Exception while getting the uat file from the application - " + filePath);
35
33
  }
@@ -40,4 +38,8 @@ function getApplicationConfig(mode) {
40
38
  _logger.Logger.error(err);
41
39
  return {};
42
40
  }
41
+ }
42
+ function getRunStage() {
43
+ const stage = process.env.stage;
44
+ return stage || 'uat';
43
45
  }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ class configConstants {
4
+ static DEFAULT_CONFIG_DIR = 'default';
5
+ static BETA_DIR = 'beta';
6
+ static ACTOR_DIR = 'actors';
7
+ static UAT_CONFIG_FILE = 'uat.config.js';
8
+ static INDEX_FILE = 'index.js';
9
+ static SETTINGS_FILE = 'settings.json';
10
+ static TEST_SUMMARY_FILE = 'test-summary.json';
11
+ static STAGE_CONFIG_MAP_FILE = 'test-slices/conf_path_map.properties';
12
+ static TEST_SLICE_FOLDER = 'test-slices';
13
+ }
14
+ module.exports = configConstants;
@@ -1,11 +1,15 @@
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;
8
+ var _configConstants = _interopRequireDefault(require("./configConstants"));
9
+ var _ConfigurationHelper = require("../configuration/ConfigurationHelper");
10
+ const stage = (0, _ConfigurationHelper.getRunStage)();
7
11
  class ReporterConstants {
8
- static DEFAULT_REPORTER_PATH = 'uat/test-results/playwright-test-results.json';
9
- static LAST_RUN_REPORTER_PATH = 'uat/test-results/.last-run.json';
12
+ static DEFAULT_REPORTER_PATH = `${_configConstants.default.TEST_SLICE_FOLDER}/${stage}/test-results/playwright-test-results.json`;
13
+ static LAST_RUN_REPORTER_PATH = `${_configConstants.default.TEST_SLICE_FOLDER}/${stage}/test-results/.last-run.json`;
10
14
  }
11
15
  exports.default = ReporterConstants;
@@ -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', 'modules', 'isTearDown'];
7
+ const CUSTOM_COMMANDS = exports.CUSTOM_COMMANDS = ['stage', 'mode', 'tags', 'edition', 'browsers', 'filePath', 'headless', 'modules', 'isTearDown'];
@@ -17,19 +17,20 @@ function setEnvironmentVariables(configJSON) {
17
17
  }
18
18
  function addHelperLogsForEnvInitialization() {
19
19
  _logger.Logger.log(_logger.Logger.INFO_TYPE, `Mode under which test cases should run has not been specified in args.`);
20
- _logger.Logger.log(_logger.Logger.INFO_TYPE, `Please specify --mode='dev/prod' while running ZDTestingFramework test`);
20
+ _logger.Logger.log(_logger.Logger.INFO_TYPE, `Please specify --mode='dev/ci/cd/devautomation' while running ZDTestingFramework test`);
21
21
  _logger.Logger.log(_logger.Logger.INFO_TYPE, `Going to use default mode as dev`);
22
22
  }
23
- function initializeEnvConfig(mode, isAuthMode) {
23
+ function initializeEnvConfig(stage, mode, isAuthMode) {
24
+ if (!mode) {
25
+ addHelperLogsForEnvInitialization();
26
+ mode = 'dev';
27
+ }
28
+ const configFilePath = (0, _fs.readFileSync)(_path.default.resolve(process.cwd(), `./${(0, _configFileNameProvider.getEnvConfigFilePath)(stage, mode)}`));
24
29
  try {
25
- if (!mode) {
26
- addHelperLogsForEnvInitialization();
27
- mode = 'dev';
28
- }
29
- const configFile = (0, _fs.readFileSync)(_path.default.resolve(process.cwd(), `./${(0, _configFileNameProvider.getEnvConfigFilePath)(mode)}`));
30
- const configJSON = JSON.parse(configFile);
30
+ const configJSON = JSON.parse(configFilePath);
31
31
  setEnvironmentVariables({
32
32
  ...configJSON,
33
+ stage,
33
34
  mode
34
35
  });
35
36
  if (isAuthMode) {
@@ -38,6 +39,6 @@ function initializeEnvConfig(mode, isAuthMode) {
38
39
  }
39
40
  } catch (err) {
40
41
  _logger.Logger.error(err);
41
- throw new Error(`Config File Not Exists. Please provide a config file ${(0, _configFileNameProvider.getEnvConfigFilePath)(mode)} to intiailize the environment variables `);
42
+ throw new Error(`Config File Not Exists. Please provide a ${configFilePath} to initialize the environment variables`);
42
43
  }
43
44
  }
@@ -13,7 +13,9 @@ exports.isCI = isCI;
13
13
  exports.isDevelopmentSetup = isDevelopmentSetup;
14
14
  var _path = _interopRequireDefault(require("path"));
15
15
  var _fs = require("fs");
16
- var _readConfigFile = require("../../readConfigFile");
16
+ var _configPathResolver = require("../configPathResolver");
17
+ var _ConfigurationHelper = require("./../../configuration/ConfigurationHelper");
18
+ var _configConstants = _interopRequireDefault(require("../../constants/configConstants"));
17
19
  /* eslint-disable global-require */
18
20
  function getRunMode() {
19
21
  let {
@@ -30,19 +32,18 @@ function isDevelopmentSetup() {
30
32
  return mode === 'DEV' || mode === 'dev';
31
33
  }
32
34
  function getDefaultActorConf() {
33
- const {
34
- uatDirectory
35
- } = (0, _readConfigFile.generateConfigFromFile)();
36
- const modeSettingsFile = `conf/${getRunMode()}/settings.json`;
37
- const filePath = _path.default.join(uatDirectory, modeSettingsFile);
35
+ const stage = (0, _ConfigurationHelper.getRunStage)();
36
+ const stagePath = (0, _configPathResolver.getConfigPath)(stage);
37
+ const modeSettingsFile = `${stagePath}/${getRunMode()}/${_configConstants.default.SETTINGS_FILE}`;
38
+ const filePath = _path.default.join(_path.default.resolve(process.cwd(), modeSettingsFile));
38
39
  try {
39
40
  if (!(0, _fs.existsSync)(filePath)) {
40
- const defaultSettingsFile = _path.default.join(uatDirectory, `conf/default/settings.json`);
41
+ const defaultSettingsFile = _path.default.join(_path.default.resolve(process.cwd(), `${stagePath}/${_configConstants.default.DEFAULT_CONFIG_DIR}/${_configConstants.default.SETTINGS_FILE}`));
41
42
  return require(defaultSettingsFile);
42
43
  }
43
44
  return require(filePath);
44
45
  } catch (error) {
45
- throw new Error(`${defaultSettingFile} ${filePath} both files are missing.`);
46
+ throw new Error(`${filePath} file missing.`);
46
47
  }
47
48
  }
48
49
  function getDefaultActor() {
@@ -53,18 +54,17 @@ function getDefaultActor() {
53
54
  return getUserForSelectedEditionAndProfile(edition, profile);
54
55
  }
55
56
  function getListOfActors(betaFeature) {
56
- const {
57
- uatDirectory
58
- } = (0, _readConfigFile.generateConfigFromFile)();
59
57
  const mode = getRunMode();
60
- let configFile = _path.default.join(uatDirectory, `conf/${mode}/actors/index.js`);
58
+ const stage = (0, _ConfigurationHelper.getRunStage)();
59
+ const stagePath = (0, _configPathResolver.getConfigPath)(stage);
60
+ let configFile = _path.default.join(_path.default.resolve(process.cwd(), `${stagePath}/${mode}/${_configConstants.default.ACTOR_DIR}/${_configConstants.default.INDEX_FILE}`));
61
61
  let betaReference = mode;
62
62
  if (!(0, _fs.existsSync)(configFile)) {
63
- configFile = _path.default.join(uatDirectory, `conf/default/actors/index.js`);
63
+ configFile = _path.default.join(_path.default.resolve(process.cwd(), `${stagePath}/${_configConstants.default.DEFAULT_CONFIG_DIR}/${_configConstants.default.ACTOR_DIR}/${_configConstants.default.INDEX_FILE}`));
64
64
  betaReference = "default";
65
65
  }
66
66
  if (betaFeature) {
67
- configFile = _path.default.join(uatDirectory, `conf/${betaReference}/actors/beta/${betaFeature}/index.js`);
67
+ configFile = _path.default.join(_path.default.resolve(process.cwd(), `${stagePath}/${betaReference}/${_configConstants.default.ACTOR_DIR}/${_configConstants.default.BETA_DIR}/${betaFeature}/${_configConstants.default.INDEX_FILE}`));
68
68
  if (!(0, _fs.existsSync)(configFile)) {
69
69
  throw new Error(`There is no beta feature configured with the name "${betaFeature}"`);
70
70
  }
@@ -34,6 +34,12 @@ Object.defineProperty(exports, "getRunMode", {
34
34
  return _getUsers.getRunMode;
35
35
  }
36
36
  });
37
+ Object.defineProperty(exports, "getRunStage", {
38
+ enumerable: true,
39
+ get: function () {
40
+ return _ConfigurationHelper.getRunStage;
41
+ }
42
+ });
37
43
  Object.defineProperty(exports, "getUserForSelectedEditionAndProfile", {
38
44
  enumerable: true,
39
45
  get: function () {
@@ -73,4 +79,5 @@ Object.defineProperty(exports, "verifyIfCookieFileExists", {
73
79
  var _accountLogin = _interopRequireDefault(require("./accountLogin"));
74
80
  var _checkAuthCookies = require("./checkAuthCookies");
75
81
  var _getUsers = require("./getUsers");
76
- var _loginSteps = _interopRequireDefault(require("./loginSteps"));
82
+ var _loginSteps = _interopRequireDefault(require("./loginSteps"));
83
+ var _ConfigurationHelper = require("../../configuration/ConfigurationHelper");
@@ -41,8 +41,6 @@ async function executeDefaultLoginSteps(context, testInfo, testDetails, testPort
41
41
  }
42
42
  try {
43
43
  const projectName = testInfo.project.name;
44
- const authFileName = process.env.authFileName;
45
- testDetails.authFilePrefix = authFileName;
46
44
  if (testPortalDetails && projectName !== 'setup' && projectName !== 'cleanup') {
47
45
  await context.clearCookies();
48
46
  await (0, _auth.performLoginSteps)(testDetails, async testInfo => {
@@ -18,22 +18,14 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
18
18
  authFilePrefix,
19
19
  email
20
20
  } = testInfo;
21
- let authFileName;
22
- if (!authFilePrefix) {
23
- authFileName = email;
24
- } else if (authFilePrefix.includes(email)) {
25
- authFileName = authFilePrefix;
26
- } else {
27
- authFileName = authFilePrefix + email;
28
- }
29
- process.env.authFileName = authFileName;
30
- const authFile = _path.default.resolve(_path.default.join((0, _checkAuthCookies.getAuthFileDirectory)(), `${authFileName}-cookies.json`));
31
- const lockFileName = authFileName.replace(/[@.]/g, '_');
21
+ authFilePrefix = authFilePrefix || email;
22
+ const authFile = _path.default.resolve(_path.default.join((0, _checkAuthCookies.getAuthFileDirectory)(), `${authFilePrefix}-cookies.json`));
23
+ const lockFileName = email.replace(/[@.]/g, '_');
32
24
  const fileMutex = new _fileMutex.default((0, _checkAuthDirectory.getLockDirectoryPath)(), lockFileName, _fileMutexConfig.fileDeletionTimeoutConfig);
33
25
  let loginUsingCookie = false;
34
26
  try {
35
27
  if ((0, _checkAuthCookies.verifyIfCookieFileExists)(authFile)) {
36
- console.log(`${authFileName} Cookie file exists. Loading cookies, worker index - ${process.env.TEST_WORKER_INDEX}`);
28
+ console.log(`${email} Cookie file exists. Loading cookies, worker index - ${process.env.TEST_WORKER_INDEX}`);
37
29
  loginUsingCookie = true;
38
30
  } else {
39
31
  await fileMutex.acquire();
@@ -48,7 +40,7 @@ async function performLoginSteps(testInfo, isLoggedIn, loginSteps) {
48
40
  });
49
41
  }
50
42
  } catch (error) {
51
- console.error(`Error during login for ${authFileName}:`, error);
43
+ console.error(`Error during login for ${email}:`, error);
52
44
  } finally {
53
45
  if (!loginUsingCookie) {
54
46
  await fileMutex.release();
@@ -10,22 +10,29 @@ exports.getUATFileName = getUATFileName;
10
10
  var _path = _interopRequireDefault(require("path"));
11
11
  var _fs = _interopRequireDefault(require("fs"));
12
12
  var _auth = require("./auth");
13
- function getUATFileName(mode) {
13
+ var _ConfigurationHelper = require("./../configuration/ConfigurationHelper");
14
+ var _configPathResolver = require("./configPathResolver");
15
+ var _configConstants = _interopRequireDefault(require("../constants/configConstants"));
16
+ function getUATFileName(stage, mode) {
17
+ stage = stage || (0, _ConfigurationHelper.getRunStage)();
14
18
  mode = mode || (0, _auth.getRunMode)();
15
- const uatConfFilePath = _path.default.resolve(process.cwd(), `uat/conf/${mode}/uat.config.js`);
19
+ const stagePath = (0, _configPathResolver.getConfigPath)(stage);
20
+ const uatConfFilePath = _path.default.resolve(process.cwd(), `${stagePath}/${mode}/${_configConstants.default.UAT_CONFIG_FILE}`);
16
21
  if (_fs.default.existsSync(uatConfFilePath)) {
17
22
  return uatConfFilePath;
18
23
  }
19
- return _path.default.resolve(process.cwd(), `uat/conf/default/uat.config.js`);
24
+ ;
25
+ return _path.default.resolve(process.cwd(), `${stagePath}/${_configConstants.default.DEFAULT_CONFIG_DIR}/${_configConstants.default.UAT_CONFIG_FILE}`);
20
26
  }
21
- function getEnvConfigFilePath(mode) {
22
- const confFilePath = _path.default.resolve(process.cwd(), `uat/conf/${mode}/settings.json`);
27
+ function getEnvConfigFilePath(stage, mode) {
28
+ const stagePath = (0, _configPathResolver.getConfigPath)(stage);
29
+ const confFilePath = `${stagePath}/${mode}/${_configConstants.default.SETTINGS_FILE}`;
23
30
  // TODO: Actors Mode as config
24
31
  if (_fs.default.existsSync(confFilePath)) {
25
- return `uat/conf/${mode}/settings.json`;
32
+ return confFilePath;
26
33
  }
27
- return `uat/conf/default/settings.json`;
34
+ return `${stagePath}/${_configConstants.default.DEFAULT_CONFIG_DIR}/${_configConstants.default.SETTINGS_FILE}`;
28
35
  }
29
36
  function getReportFileName() {
30
- return `test-summary.json`;
37
+ return `${_configConstants.default.TEST_SUMMARY_FILE}`;
31
38
  }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getConfigPath = getConfigPath;
8
+ var _fs = _interopRequireDefault(require("fs"));
9
+ var _path = _interopRequireDefault(require("path"));
10
+ var _propertiesReader = _interopRequireDefault(require("properties-reader"));
11
+ var _logger = require("../../../utils/logger");
12
+ var _configConstants = _interopRequireDefault(require("../constants/configConstants"));
13
+ //This function reads a properties file and returns the entire properties
14
+
15
+ function readPropertiesFile(relativeFilePath) {
16
+ const filePath = _path.default.resolve(process.cwd(), relativeFilePath);
17
+ let properties;
18
+ if (_fs.default.existsSync(filePath)) {
19
+ properties = (0, _propertiesReader.default)(filePath);
20
+ } else {
21
+ // we have to remove this logic after adding all the projects with proper config files
22
+ _logger.Logger.log(_logger.Logger.INFO_TYPE, `Properties file ${filePath} not found. Using default configurations.`);
23
+ properties = (0, _propertiesReader.default)();
24
+ properties.set('uat', 'uat/conf');
25
+ }
26
+ return properties;
27
+ }
28
+
29
+ // This function return the value for the passed arguments key
30
+
31
+ function getConfigPath(stage) {
32
+ const props = readPropertiesFile(_configConstants.default.STAGE_CONFIG_MAP_FILE);
33
+ const configPath = props.get(stage);
34
+ if (!configPath) {
35
+ _logger.Logger.log(_logger.Logger.FAILURE_TYPE, `No config mapping found for stage: "${stage}"`);
36
+ }
37
+ return configPath;
38
+ }
@@ -16,15 +16,13 @@ var _mergeObjects = require("./helpers/mergeObjects");
16
16
  var _Configuration = _interopRequireDefault(require("./configuration/Configuration"));
17
17
  var _UserArgs = _interopRequireDefault(require("./configuration/UserArgs"));
18
18
  var _ConfigurationHelper = require("./configuration/ConfigurationHelper");
19
+ var _configConstants = _interopRequireDefault(require("./constants/configConstants"));
20
+ const stage = (0, _ConfigurationHelper.getRunStage)();
19
21
  let cachedConfig = null;
20
- function getPrimaryCookiePath() {
21
- const authFileName = process.env.authFileName;
22
- return `uat/playwright/.auth/${authFileName}-cookies.json`;
23
- }
24
22
  function getDefaultConfig() {
25
23
  return {
26
24
  isTearDown: true,
27
- uatDirectory: _path.default.join(process.cwd(), 'uat'),
25
+ uatDirectory: _path.default.join(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER, stage),
28
26
  headless: false,
29
27
  browsers: ['Chrome'],
30
28
  forbidOnly: false,
@@ -33,11 +31,11 @@ function getDefaultConfig() {
33
31
  video: false,
34
32
  isAuthMode: false,
35
33
  openReportOn: 'never',
36
- reportPath: _path.default.join(process.cwd(), 'uat', 'playwright-report'),
34
+ reportPath: _path.default.join(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER, stage, 'playwright-report'),
37
35
  bddMode: false,
38
36
  expectTimeout: 5 * 1000,
39
37
  testTimeout: 60 * 1000,
40
- authFilePath: getPrimaryCookiePath(),
38
+ authFilePath: _path.default.join(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER, stage, 'playwright/.auth/user.json'),
41
39
  viewport: {
42
40
  width: 1280,
43
41
  height: 720
@@ -115,15 +113,16 @@ function combineDefaultConfigWithUserConfig(userConfiguration) {
115
113
  */
116
114
 
117
115
  function getConfigFilePath() {
118
- return _path.default.resolve(process.cwd(), (0, _configFileNameProvider.getUATFileName)());
116
+ return (0, _configFileNameProvider.getUATFileName)();
119
117
  }
120
118
  function generateConfigFromFile() {
121
119
  if (cachedConfig === null) {
122
120
  // Getting the default config's from framework
123
121
  const uatConfig = new _Configuration.default(getDefaultConfig());
124
122
  // overriding the application config's from project
125
- const appConfig = new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)());
126
123
  const userArgConfig = new _Configuration.default(_UserArgs.default.parseToObject(process.argv.slice(2)));
124
+ const stage = userArgConfig.get("stage");
125
+ const appConfig = new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)(stage));
127
126
  // overriding the user config's from CLI
128
127
  uatConfig.addAll(appConfig);
129
128
  uatConfig.addAll(userArgConfig);
@@ -11,6 +11,9 @@ var _path = _interopRequireDefault(require("path"));
11
11
  var _Project = require("./Project");
12
12
  var _configUtils = require("./config-utils");
13
13
  var _readConfigFile = require("../readConfigFile");
14
+ var _configConstants = _interopRequireDefault(require("../constants/configConstants"));
15
+ var _ConfigurationHelper = require("../configuration/ConfigurationHelper");
16
+ const stage = (0, _ConfigurationHelper.getRunStage)();
14
17
  const uatConfig = (0, _readConfigFile.generateConfigFromFile)();
15
18
  const {
16
19
  isAuthMode,
@@ -25,7 +28,7 @@ const {
25
28
  function setupConfig() {
26
29
  const setupProject = new _Project.Project('setup');
27
30
  setupProject.setTestMatch(/.*\.setup\.js/);
28
- setupProject.setTestDir(_path.default.join(process.cwd(), 'uat'));
31
+ setupProject.setTestDir(_path.default.join(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER));
29
32
  const isTearDown = JSON.parse(process.env.tearDown);
30
33
  setupProject.setTearDown(isTearDown ? 'cleanup' : '');
31
34
  const setupProjectConfig = [setupProject.getProperties()];
@@ -34,10 +37,10 @@ function setupConfig() {
34
37
  function smokeTestConfig() {
35
38
  const smokeTestProject = new _Project.Project('smokeTest');
36
39
  const smokeTestDir = (0, _configUtils.getTestDir)(bddMode, {
37
- featureFilesFolder: _path.default.join(process.cwd(), 'uat', 'smokeTest', '**', '*.feature'),
38
- stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '**', 'steps', '*.spec.js'),
39
- outputDir: _path.default.join(process.cwd(), 'uat', '.features-smoke-gen'),
40
- uatPath: _path.default.join(process.cwd(), 'uat', 'smokeTest')
40
+ featureFilesFolder: _path.default.join(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER, stage, 'smokeTest', '**', '*.feature'),
41
+ stepDefinitionsFolder: _path.default.join(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER, '**', '**', 'steps', '*.spec.js'),
42
+ outputDir: _path.default.join(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER, stage, '.features-smoke-gen'),
43
+ uatPath: _path.default.join(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER, stage, 'smokeTest')
41
44
  });
42
45
  const commonConfig = {
43
46
  storageState: isAuthMode ? (0, _readConfigFile.getAuthFilePath)(_path.default.resolve(process.cwd(), authFilePath)) : {}
@@ -51,30 +54,10 @@ function smokeTestConfig() {
51
54
  const smokeTestProjectConfig = [smokeTestProject.getProperties()];
52
55
  return smokeTestProjectConfig;
53
56
  }
54
- function defaultConfig() {
55
- const defaultProject = new _Project.Project('default');
56
- const testDir = (0, _configUtils.getTestDir)(bddMode, {
57
- featureFilesFolder: (0, _configUtils.getPathsForFeatureFiles)(process.cwd()),
58
- stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '**', 'steps', '*.spec.js'),
59
- outputDir: _path.default.join(process.cwd(), 'uat', '.features-gen'),
60
- uatPath: _path.default.join(process.cwd(), 'uat')
61
- });
62
- const use = {
63
- trace,
64
- video,
65
- viewport,
66
- testIdAttribute
67
- };
68
- defaultProject.setUse(use);
69
- defaultProject.setTestDir(testDir);
70
- defaultProject.setDependencies(isSmokeTest ? ['smokeTest'] : []);
71
- const defaultProjectConfig = [defaultProject.getProperties()];
72
- return defaultProjectConfig;
73
- }
74
57
  function cleanupConfig() {
75
58
  const cleanupProject = new _Project.Project('cleanup');
76
59
  cleanupProject.setTestMatch(/.*\.teardown\.js/);
77
- cleanupProject.setTestDir(_path.default.join(process.cwd(), 'uat'));
60
+ cleanupProject.setTestDir(_path.default.join(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER));
78
61
  const cleanupProjectConfig = [cleanupProject.getProperties()];
79
62
  return cleanupProjectConfig;
80
63
  }
@@ -10,7 +10,10 @@ var _path = _interopRequireDefault(require("path"));
10
10
  var _readConfigFile = require("../readConfigFile");
11
11
  var _configUtils = require("./config-utils");
12
12
  var _ProjectConfiguration = require("./ProjectConfiguration");
13
+ var _ConfigurationHelper = require("../configuration/ConfigurationHelper");
14
+ var _configConstants = _interopRequireDefault(require("../constants/configConstants"));
13
15
  const uatConfig = (0, _readConfigFile.generateConfigFromFile)();
16
+ const stage = (0, _ConfigurationHelper.getRunStage)();
14
17
  const {
15
18
  bddMode,
16
19
  browsers,
@@ -41,7 +44,7 @@ let reporter = [['html', {
41
44
  outputFolder: reportPath,
42
45
  open: openReportOn
43
46
  }], ['list'], ['json', {
44
- outputFile: _path.default.join(process.cwd(), 'uat', 'test-results', 'playwright-test-results.json')
47
+ outputFile: _path.default.join(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER, stage, 'test-results', 'playwright-test-results.json')
45
48
  }], ['./custom-reporter.js'], ['./qc-custom-reporter.js']];
46
49
  if (customReporter) {
47
50
  reporter = [customReporter, ...reporter];
@@ -61,9 +64,9 @@ const use = {
61
64
  };
62
65
  const testDir = (0, _configUtils.getTestDir)(bddMode, {
63
66
  featureFilesFolder: (0, _configUtils.getPathsForFeatureFiles)(process.cwd()),
64
- stepDefinitionsFolder: _path.default.join(process.cwd(), 'uat', '**', 'steps', '*.spec.js'),
65
- outputDir: _path.default.join(process.cwd(), 'uat', '.features-gen'),
66
- uatPath: _path.default.join(process.cwd(), 'uat')
67
+ stepDefinitionsFolder: _path.default.join(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER, '**', '**', 'steps', '*.spec.js'),
68
+ outputDir: _path.default.join(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER, stage, '.features-gen'),
69
+ uatPath: _path.default.join(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER, stage)
67
70
  });
68
71
  function getPlaywrightConfig() {
69
72
  const smokeTestProject = isSmokeTest ? (0, _ProjectConfiguration.smokeTestConfig)() : [];
@@ -73,7 +76,7 @@ function getPlaywrightConfig() {
73
76
  const playwrightConfig = {
74
77
  testDir,
75
78
  globalTimeout: globalTimeout || 3600000,
76
- outputDir: _path.default.join(process.cwd(), 'uat', 'test-results'),
79
+ outputDir: _path.default.join(process.cwd(), _configConstants.default.TEST_SLICE_FOLDER, stage, 'test-results'),
77
80
  fullyParallel: true,
78
81
  reporter,
79
82
  timeout: testTimeout,