@zohodesk/testinglibrary 0.1.4-exp.3 → 0.1.4-exp.5

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.
@@ -11,8 +11,6 @@ exports.isUserConfigFileAvailable = isUserConfigFileAvailable;
11
11
  var _fs = require("fs");
12
12
  var _path = _interopRequireDefault(require("path"));
13
13
  var _logger = require("../../utils/logger");
14
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
14
  const fileName = 'uat.config.js';
17
15
  exports.fileName = fileName;
18
16
  function getDefaultConfig() {
@@ -97,7 +95,7 @@ function generateConfigFromFile() {
97
95
  const filePath = _path.default.resolve(process.cwd(), fileName);
98
96
  if ((0, _fs.existsSync)(filePath)) {
99
97
  /** @type {UserConfig} */
100
- const config = (specifier => new Promise(r => r(`${specifier}`)).then(s => _interopRequireWildcard(require(s))))(filePath).then(v => v.default);
98
+ const config = require(filePath);
101
99
  const modifiedConfiguration = combineDefaultConfigWithUserConfig(config);
102
100
  return modifiedConfiguration;
103
101
  }
@@ -6,8 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _path = _interopRequireDefault(require("path"));
9
+ var _readline = _interopRequireDefault(require("readline"));
9
10
  var _fileUtils = require("../../../utils/fileUtils");
10
11
  var _readConfigFile = require("../readConfigFile");
12
+ var _logger = require("../../../utils/logger");
11
13
  class JSONSummaryReporter {
12
14
  constructor() {
13
15
  this.durationInMS = -1;
@@ -20,6 +22,7 @@ class JSONSummaryReporter {
20
22
  this.flakey = [];
21
23
  this.status = 'unknown';
22
24
  this.startedAt = 0;
25
+ this._open = (0, _readConfigFile.generateConfigFromFile)().openReportOn;
23
26
  }
24
27
  onBegin() {
25
28
  this.startedAt = Date.now();
@@ -83,6 +86,16 @@ class JSONSummaryReporter {
83
86
  } = (0, _readConfigFile.generateConfigFromFile)();
84
87
  (0, _fileUtils.writeFileContents)(_path.default.join(reportPath, './', 'test-summary.json'), JSON.stringify(this, null, ' '));
85
88
  }
89
+ onExit() {
90
+ const shouldClearLastLine = this._open !== 'always' || this._open !== 'on-failure';
91
+ if (shouldClearLastLine) {
92
+ /**Below code is to replace the playwright default report commond with abstraction tool command */
93
+ _readline.default.moveCursor(process.stdout, 0, -2); // up two line
94
+ _readline.default.clearLine(process.stdout, 1); // from cursor to end
95
+ _logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'npx ZDTestingFramework report or npm run uat-report');
96
+ return;
97
+ }
98
+ }
86
99
  }
87
100
  var _default = JSONSummaryReporter;
88
101
  exports.default = _default;
@@ -66,7 +66,6 @@ function runPlaywright(command, args) {
66
66
  });
67
67
  childProcessForRunningPlaywright.on('exit', (code, signal) => {
68
68
  if (code !== 0) {
69
- _logger.Logger.log(_logger.Logger.FAILURE_TYPE, `Child Process Exited with Code ${code} and Signal ${signal}`);
70
69
  reject(`Child Process Exited with Code ${code} and Signal ${signal}`);
71
70
  } else {
72
71
  _logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Test Ran Successfully');
@@ -74,11 +73,11 @@ function runPlaywright(command, args) {
74
73
  }
75
74
  });
76
75
  process.on('exit', () => {
77
- //childProcessForRunningPlaywright.kill();
76
+ childProcessForRunningPlaywright.kill();
78
77
  reject('Terminating Playwright Process...');
79
78
  });
80
79
  process.on('SIGINT', () => {
81
- //childProcessForRunningPlaywright.kill();
80
+ childProcessForRunningPlaywright.kill();
82
81
  reject('Cleaning up...');
83
82
  });
84
83
  });