@zohodesk/testinglibrary 0.0.19-n20-experimental → 0.0.20-n20-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/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.0.19-n20-experimental",
4
- "description": "",
3
+ "version": "0.0.20-n20-experimental",
5
4
  "main": "./build/index.js",
6
5
  "scripts": {
7
6
  "postinstall": "node bin/postinstall.js",
@@ -36,8 +35,7 @@
36
35
  "jsonpath": "1.1.1",
37
36
  "msw": "2.11.6",
38
37
  "playwright": "1.56.1",
39
- "playwright-bdd": "8.4.2",
40
- "properties-reader": "2.3.0",
38
+ "playwright-bdd": "8.4.1",
41
39
  "supports-color": "10.2.2"
42
40
  },
43
41
  "bin": {
@@ -55,7 +53,7 @@
55
53
  "@babel/plugin-transform-runtime": "7.28.3",
56
54
  "@babel/preset-env": "7.28.3",
57
55
  "@babel/runtime": "7.28.4",
58
- "commander": "14.0.2",
56
+ "commander": "14.0.1",
59
57
  "jest-html-reporter": "4.3.0"
60
58
  }
61
59
  }
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- class configConstants {
8
- static DEFAULT_CONFIG_DIR = 'default';
9
- static BETA_DIR = 'beta';
10
- static ACTOR_DIR = 'actors';
11
- static UAT_CONFIG_FILE = 'uat.config.js';
12
- static INDEX_FILE = 'index.js';
13
- static SETTINGS_FILE = 'settings.json';
14
- static TEST_SUMMARY_FILE = 'test-summary.json';
15
- static STAGE_CONFIG_MAP_FILE = 'uat/conf_path_map.properties';
16
- }
17
- exports.default = configConstants;
@@ -1,38 +0,0 @@
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
- }
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _fs = _interopRequireDefault(require("fs"));
5
- var _path = _interopRequireDefault(require("path"));
6
- var _propertiesReader = _interopRequireDefault(require("properties-reader"));
7
- var _configPathResolver = require("../../../../../core/playwright/helpers/configPathResolver");
8
- var _logger = require("../../../../../utils/logger");
9
- var _configConstants = _interopRequireDefault(require("../../../../../core/playwright/constants/configConstants"));
10
- jest.mock('fs');
11
- jest.mock('path');
12
- jest.mock('properties-reader');
13
- jest.mock('../../../../../utils/logger', () => ({
14
- Logger: {
15
- log: jest.fn(),
16
- INFO_TYPE: 'info',
17
- FAILURE_TYPE: 'failure'
18
- }
19
- }));
20
- describe('getConfigPath', () => {
21
- const mockProps = {
22
- get: jest.fn(),
23
- set: jest.fn()
24
- };
25
- beforeEach(() => {
26
- jest.clearAllMocks();
27
- _propertiesReader.default.mockReturnValue(mockProps);
28
- _path.default.resolve.mockImplementation((...args) => args.join('/'));
29
- });
30
- test('should return config path when properties file exists and has mapping', () => {
31
- _fs.default.existsSync.mockReturnValue(true);
32
- mockProps.get.mockReturnValue('uat/conf');
33
- const result = (0, _configPathResolver.getConfigPath)('uat');
34
- expect(_fs.default.existsSync).toHaveBeenCalledWith(expect.stringContaining(_configConstants.default.STAGE_CONFIG_MAP_FILE));
35
- expect(_propertiesReader.default).toHaveBeenCalled();
36
- expect(mockProps.get).toHaveBeenCalledWith('uat');
37
- expect(result).toBe('uat/conf');
38
- expect(_logger.Logger.log).not.toHaveBeenCalledWith(_logger.Logger.FAILURE_TYPE, expect.any(String));
39
- });
40
- test('should log info and use default mapping if file does not exist', () => {
41
- _fs.default.existsSync.mockReturnValue(false);
42
- mockProps.get.mockImplementation(key => key === 'uat' ? 'uat/conf' : undefined);
43
- const result = (0, _configPathResolver.getConfigPath)('uat');
44
- expect(_logger.Logger.log).toHaveBeenCalledWith(_logger.Logger.INFO_TYPE, expect.stringContaining('not found'));
45
- expect(mockProps.set).toHaveBeenCalledWith('uat', 'uat/conf');
46
- expect(result).toBe('uat/conf');
47
- });
48
- test('should log failure if config mapping not found for stage', () => {
49
- _fs.default.existsSync.mockReturnValue(true);
50
- mockProps.get.mockReturnValue(undefined);
51
- const result = (0, _configPathResolver.getConfigPath)('stageX');
52
- expect(_logger.Logger.log).toHaveBeenCalledWith(_logger.Logger.FAILURE_TYPE, expect.stringContaining('stageX'));
53
- expect(result).toBeUndefined();
54
- });
55
- });