@zohodesk/testinglibrary 0.3.9-experimental → 0.4.1-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.
@@ -18,5 +18,8 @@ class Configuration {
18
18
  getAll() {
19
19
  return this.properties;
20
20
  }
21
+ delete(key) {
22
+ delete this.properties[key];
23
+ }
21
24
  }
22
25
  module.exports = Configuration;
@@ -13,6 +13,9 @@ var _path = _interopRequireDefault(require("path"));
13
13
  var _logger = require("../../utils/logger");
14
14
  var _configFileNameProvider = require("./helpers/configFileNameProvider");
15
15
  var _mergeObjects = require("./helpers/mergeObjects");
16
+ var _Configuration = _interopRequireDefault(require("./configuration/Configuration"));
17
+ var _UserArgs = _interopRequireDefault(require("./configuration/UserArgs"));
18
+ var _ConfigurationHelper = require("./configuration/ConfigurationHelper");
16
19
  let cachedConfig = null;
17
20
  function getDefaultConfig() {
18
21
  return {
@@ -110,18 +113,18 @@ function getConfigFilePath() {
110
113
  return _path.default.resolve(process.cwd(), (0, _configFileNameProvider.getUATFileName)());
111
114
  }
112
115
  function generateConfigFromFile() {
113
- if (cachedConfig !== null) {
114
- return cachedConfig; // If cached, return the cached configuration
116
+ if (cachedConfig === null) {
117
+ // Getting the default config's from framework
118
+ const uatConfig = new _Configuration.default(getDefaultConfig());
119
+ // overriding the application config's from project
120
+ const appConfig = new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)());
121
+ const userArgConfig = new _Configuration.default(_UserArgs.default.parseToObject(process.argv.slice(2)));
122
+ // overriding the user config's from CLI
123
+ uatConfig.addAll(appConfig);
124
+ uatConfig.addAll(userArgConfig);
125
+ cachedConfig = uatConfig.getAll();
115
126
  }
116
- const filePath = getConfigFilePath();
117
- if ((0, _fs.existsSync)(filePath)) {
118
- /** @type {UserConfig} */
119
- const config = require(filePath);
120
- const modifiedConfiguration = combineDefaultConfigWithUserConfig(config);
121
- cachedConfig = modifiedConfiguration;
122
- return modifiedConfiguration;
123
- }
124
- return {};
127
+ return cachedConfig;
125
128
  }
126
129
  function isUserConfigFileAvailable() {
127
130
  const filePath = getConfigFilePath();
@@ -9,15 +9,7 @@ var _test = require("@playwright/test");
9
9
  var _path = _interopRequireDefault(require("path"));
10
10
  var _readConfigFile = require("../readConfigFile");
11
11
  var _configUtils = require("./config-utils");
12
- var _Configuration = _interopRequireDefault(require("./../configuration/Configuration"));
13
- var _UserArgs = _interopRequireDefault(require("./../configuration/UserArgs"));
14
- var _ConfigurationHelper = require("../configuration/ConfigurationHelper");
15
- // overriding the application config's from project
16
- const uatConfig = new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)());
17
- const userArgConfig = new _Configuration.default(_UserArgs.default.parseToObject(process.argv.slice(2)));
18
-
19
- // overriding the user config's from CLI
20
- uatConfig.addAll(userArgConfig);
12
+ const uatConfig = (0, _readConfigFile.generateConfigFromFile)();
21
13
  const {
22
14
  browsers,
23
15
  trace,
@@ -34,7 +26,7 @@ const {
34
26
  stepDefinitionsFolder,
35
27
  testIdAttribute,
36
28
  globalTimeout
37
- } = uatConfig.getAll();
29
+ } = uatConfig;
38
30
  const projects = (0, _configUtils.getProjects)({
39
31
  browsers,
40
32
  isAuthMode,
@@ -65,7 +57,6 @@ function getPlaywrightConfig() {
65
57
  globalTimeout: globalTimeout || 3600000,
66
58
  outputDir: _path.default.join(process.cwd(), 'uat', 'test-results'),
67
59
  fullyParallel: true,
68
- forbidOnly: false,
69
60
  reporter: [['html', {
70
61
  outputFolder: reportPath,
71
62
  open: openReportOn
@@ -85,7 +76,7 @@ function getPlaywrightConfig() {
85
76
  testMatch: /.*\.teardown\.js/,
86
77
  testDir: _path.default.join(process.cwd(), 'uat')
87
78
  }, ...projects] : [...projects],
88
- ...uatConfig.getAll()
79
+ ...uatConfig
89
80
  };
90
81
  return playwrightConfig;
91
82
  }
@@ -36,6 +36,9 @@ function cliArgsToObject(cliArgs, isKeyNeedToBeAdded) {
36
36
  value = true;
37
37
  }
38
38
  processEnv[key] = value;
39
+ if (!isNaN(parseInt(value))) {
40
+ processEnv[key] = parseInt(value);
41
+ }
39
42
  }
40
43
  });
41
44
  return processEnv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.3.9-experimental",
3
+ "version": "0.4.1-experimental",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {