@zohodesk/testinglibrary 0.3.8-experimental → 0.4.0-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.
package/README.md CHANGED
@@ -24,4 +24,9 @@
24
24
  - Added support for writing unitcases for framework implementations
25
25
 
26
26
  ### Bug fix
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.
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
+
29
+ ### v0.2.9 - 08-10-2024
30
+
31
+ #### Feature
32
+ - Added support for scenario level tag support
@@ -11,7 +11,7 @@ var _readConfigFile = require("../readConfigFile");
11
11
  /* eslint-disable global-require */
12
12
 
13
13
  function getTagInputFromSelectedTags(tags, inputString) {
14
- const selectedTag = tags.find(tag => tag.startsWith(inputString));
14
+ const selectedTag = [...tags].reverse().find(tag => tag.startsWith(inputString));
15
15
  let tagInput = null;
16
16
  if (selectedTag) {
17
17
  tagInput = selectedTag.split(`${inputString}_`).pop().toLowerCase();
@@ -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,12 +13,17 @@ 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 {
19
22
  uatDirectory: _path.default.join(process.cwd(), 'uat'),
20
23
  headless: false,
21
24
  browsers: ['Chrome'],
25
+ forbidOnly: false,
26
+ retries: 0,
22
27
  trace: false,
23
28
  video: false,
24
29
  isAuthMode: false,
@@ -108,18 +113,18 @@ function getConfigFilePath() {
108
113
  return _path.default.resolve(process.cwd(), (0, _configFileNameProvider.getUATFileName)());
109
114
  }
110
115
  function generateConfigFromFile() {
111
- if (cachedConfig !== null) {
112
- 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();
113
126
  }
114
- const filePath = getConfigFilePath();
115
- if ((0, _fs.existsSync)(filePath)) {
116
- /** @type {UserConfig} */
117
- const config = require(filePath);
118
- const modifiedConfiguration = combineDefaultConfigWithUserConfig(config);
119
- cachedConfig = modifiedConfiguration;
120
- return modifiedConfiguration;
121
- }
122
- return {};
127
+ return cachedConfig;
123
128
  }
124
129
  function isUserConfigFileAvailable() {
125
130
  const filePath = getConfigFilePath();
@@ -9,6 +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
+ const uatConfig = (0, _readConfigFile.generateConfigFromFile)();
12
13
  const {
13
14
  browsers,
14
15
  trace,
@@ -25,7 +26,7 @@ const {
25
26
  stepDefinitionsFolder,
26
27
  testIdAttribute,
27
28
  globalTimeout
28
- } = (0, _readConfigFile.generateConfigFromFile)();
29
+ } = uatConfig;
29
30
  const projects = (0, _configUtils.getProjects)({
30
31
  browsers,
31
32
  isAuthMode,
@@ -51,12 +52,11 @@ const testOptions = (0, _configUtils.getTestUseOptions)({
51
52
  * @returns {import('@playwright/test').PlaywrightTestConfig}
52
53
  */
53
54
  function getPlaywrightConfig() {
54
- return {
55
+ const playwrightConfig = {
55
56
  testDir,
56
57
  globalTimeout: globalTimeout || 3600000,
57
58
  outputDir: _path.default.join(process.cwd(), 'uat', 'test-results'),
58
59
  fullyParallel: true,
59
- retries: process.env.CI ? 2 : 0,
60
60
  reporter: [['html', {
61
61
  outputFolder: reportPath,
62
62
  open: openReportOn
@@ -75,7 +75,9 @@ function getPlaywrightConfig() {
75
75
  name: 'cleanup',
76
76
  testMatch: /.*\.teardown\.js/,
77
77
  testDir: _path.default.join(process.cwd(), 'uat')
78
- }, ...projects] : [...projects]
78
+ }, ...projects] : [...projects],
79
+ ...uatConfig
79
80
  };
81
+ return playwrightConfig;
80
82
  }
81
83
  var _default = exports.default = (0, _test.defineConfig)(getPlaywrightConfig());
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.2.1",
3
+ "version": "0.3.8-experimental",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.3.8-experimental",
3
+ "version": "0.4.0-experimental",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {