@zohodesk/testinglibrary 0.4.67-n18-experimental → 0.4.68-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.
package/.gitlab-ci.yml CHANGED
@@ -115,3 +115,35 @@ uat-nobdd:
115
115
  when: always
116
116
  paths:
117
117
  - nobdd/uat/playwright-report
118
+
119
+
120
+ uatmodule:
121
+ stage: uat
122
+ script:
123
+ - cd examples
124
+ - npm install $(npm pack ../../testing-framework | tail -1)
125
+ - output=$(npm run uatmodule)
126
+ - echo "$output"
127
+ - node ../ValidateUATReport.js examples
128
+
129
+
130
+ artifacts:
131
+ when: always
132
+ paths:
133
+ - examples/uat/playwright-report
134
+
135
+ uatconfigmodule:
136
+ stage: uat
137
+ script:
138
+ - cd examples
139
+ - npm install $(npm pack ../../testing-framework | tail -1)
140
+ - output=$(npm run uatconfigmodule)
141
+ - echo "$output"
142
+ - node ../ValidateUATReport.js examples
143
+
144
+ artifacts:
145
+ when: always
146
+ paths:
147
+ - examples/uat/playwright-report
148
+
149
+
@@ -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', 'headless', 'modules'];
@@ -13,7 +13,7 @@ async function accountLogin(page, useremail, password) {
13
13
  await page.locator('#nextbtn').click();
14
14
  const domainUrlOrigin = (0, _getUrlOrigin.default)(process.env.domain);
15
15
  await page.waitForNavigation();
16
- if (page.url().includes('announcement')) {
16
+ if (!page.url().includes(domainUrlOrigin)) {
17
17
  await page.goto(domainUrlOrigin);
18
18
  }
19
19
  await page.waitForURL(`${domainUrlOrigin}/**`);
@@ -50,7 +50,7 @@ let reporter = [['html', {
50
50
  outputFolder: reportPath,
51
51
  open: openReportOn
52
52
  }], ['list'], ['json', {
53
- outputFile: _path.default.join(process.cwd(), 'uat', 'test-results', 'test-results.json')
53
+ outputFile: _path.default.join(process.cwd(), 'uat', 'json-test-results', 'test-results.json')
54
54
  }], ['./custom-reporter.js'], ['./qc-custom-reporter.js']];
55
55
  if (customReporter) {
56
56
  reporter = [customReporter, ...reporter];
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.getBrowsersList = getBrowsersList;
8
+ exports.getModulePathForFeatureFiles = getModulePathForFeatureFiles;
8
9
  exports.getProjects = getProjects;
9
10
  exports.getTestDir = getTestDir;
10
11
  var _test = require("@playwright/test");
@@ -140,9 +141,27 @@ function getPathsForFeatureFiles(cwd) {
140
141
  _logger.Logger.log(_logger.Logger.INFO_TYPE, `Unable to read test summary from the ${reportPath}. Verify If File Exists in the path`);
141
142
  _logger.Logger.log(_logger.Logger.INFO_TYPE, 'Going to run all test cases');
142
143
  }
144
+ } else if (process.env.modules !== 'undefined' && process.env.modules.length > 0) {
145
+ let modules = process.env.modules;
146
+ let moduleList = modules.split(',');
147
+ return getModulePathForFeatureFiles(moduleList);
143
148
  }
144
149
  return [_path.default.join(cwd, 'uat', '**', '*.feature')];
145
150
  }
151
+ function getModulePathForFeatureFiles(moduleList) {
152
+ let validModuleList = [];
153
+ moduleList.forEach(moduleName => {
154
+ let modulePath = _path.default.join(process.cwd(), 'uat', 'modules', '**', `${moduleName}`);
155
+ if ((0, _fileUtils.checkIfFolderExistsWithPattern)(modulePath)) {
156
+ validModuleList.push(_path.default.join(modulePath, '**', '*.feature'));
157
+ } else {
158
+ _logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Module ${moduleName} does not exist, Please check the module name`);
159
+ validModuleList = [];
160
+ return validModuleList;
161
+ }
162
+ });
163
+ return validModuleList;
164
+ }
146
165
  function getTestDir(bddMode, cwd, {
147
166
  stepDefinitionsFolder
148
167
  }) {
@@ -12,7 +12,7 @@ class CustomJsonReporter {
12
12
  constructor({
13
13
  outputFile = 'test-results.json'
14
14
  } = {}) {
15
- this.outputFile = _path.default.resolve(process.cwd(), 'uat/playwright-report/', outputFile);
15
+ this.outputFile = _path.default.resolve(process.cwd(), 'uat/test-results/', outputFile);
16
16
  this.rootSuite = null;
17
17
  this.report = {
18
18
  config: {},
@@ -83,15 +83,16 @@ function runPlaywright(command, args) {
83
83
  function main() {
84
84
  // Getting the default config's from framework
85
85
  const uatConfig = new _Configuration.default((0, _readConfigFile.getDefaultConfig)());
86
-
87
86
  // overriding the application config's from project
88
-
89
87
  const userArgConfig = new _Configuration.default(_UserArgs.default.parseToObject(process.argv.slice(2)));
90
88
  const mode = userArgConfig.get("mode");
91
89
  uatConfig.addAll(new _Configuration.default((0, _ConfigurationHelper.getApplicationConfig)(mode)));
92
-
93
90
  // overriding the user config's from CLI
94
91
  uatConfig.addAll(userArgConfig);
92
+ const modules = uatConfig.get('modules');
93
+
94
+ //We need to change this process.env variable to pass the module name in future.
95
+ process.env.modules = modules;
95
96
  const {
96
97
  isAuthMode,
97
98
  editionOrder,
@@ -39,5 +39,6 @@
39
39
  * @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
40
40
  * @property {Array} editionOrder: Order in the form of larger editions in the back. Edition with the most privelages should be last
41
41
  * @property {testSetupConfig} testSetup: Specify page and context functions that will be called while intilaizing fixtures.
42
+ * @property {string} modules: Modules name to be used for running the specific module test cases.
42
43
  */
43
44
  "use strict";
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.checkIfFileExists = checkIfFileExists;
8
+ exports.checkIfFolderExistsWithPattern = checkIfFolderExistsWithPattern;
8
9
  exports.deleteFile = deleteFile;
9
10
  exports.deleteFolder = deleteFolder;
10
11
  exports.readFileContents = readFileContents;
@@ -12,6 +13,9 @@ exports.writeFileContents = writeFileContents;
12
13
  var _fs = _interopRequireDefault(require("fs"));
13
14
  var _path = _interopRequireDefault(require("path"));
14
15
  var _logger = require("./logger");
16
+ var glob = _interopRequireWildcard(require("glob"));
17
+ 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); }
18
+ 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; }
15
19
  function checkIfFileExists(file) {
16
20
  try {
17
21
  _fs.default.accessSync(file, _fs.default.constants.F_OK);
@@ -69,4 +73,18 @@ function deleteFolder(folderPath) {
69
73
  throw new Error(`Error while deleting the test data file: ${folderPath}`);
70
74
  }
71
75
  }
76
+ }
77
+
78
+ // This function uses glob to check if a folder exists with a specific pattern
79
+ // Glob is define patterns for matching file and directory names based on wildcards
80
+ function checkIfFolderExistsWithPattern(folderPath) {
81
+ try {
82
+ if (glob.sync(folderPath).length > 0) {
83
+ return true;
84
+ }
85
+ return false;
86
+ } catch (err) {
87
+ _logger.Logger.error(err);
88
+ return false;
89
+ }
72
90
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.4.67-n18-experimental",
3
+ "version": "0.4.68-n18-experimental",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@zohodesk/testinglibrary",
9
- "version": "0.4.67-n18-experimental",
9
+ "version": "0.4.68-n18-experimental",
10
10
  "hasInstallScript": true,
11
11
  "license": "ISC",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.4.67-n18-experimental",
3
+ "version": "0.4.68-n18-experimental",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -8,10 +8,7 @@ export default defineConfig({
8
8
  outputDir: path.join(process.cwd(), 'uat', 'test-results'),
9
9
  fullyParallel: true,
10
10
  retries: process.env.CI ? 2 : 0,
11
- reporter: [
12
- ['html', { outputFolder: path.join(process.cwd(), 'uat', 'playwright-report'), open: "always" }],
13
- ['./src/core/playwright/setup/qc-custom-reporter.js']
14
- ],
11
+ reporter: [['html', { outputFolder: path.join(process.cwd(), 'uat', 'playwright-report'), open: "always" }]],
15
12
  timeout: 60 * 1000,
16
13
  expect: {
17
14
  timeout: 5 * 1000,