@zeesoft/i18n-verify 2.0.2 → 2.1.3

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.
Files changed (39) hide show
  1. package/dist/driver/adapters/cypress.js +2 -1
  2. package/dist/driver/adapters/nightwatch.js +69 -4
  3. package/dist/driver/adapters/selenium.js +0 -4
  4. package/dist/driver/baseDriver.js +24 -0
  5. package/dist/index.js +10 -5
  6. package/dist/lib/i18n.js +125 -43
  7. package/dist/{utils → lib}/reports.js +48 -28
  8. package/dist/lib/validator/string.js +2 -2
  9. package/dist/template/report.html +1678 -0
  10. package/dist/utils/cache.js +15 -15
  11. package/dist/utils/constants.js +8 -5
  12. package/dist/utils/file.js +8 -4
  13. package/dist/utils/logs.js +34 -16
  14. package/dist/utils/objects/cacheData.js +14 -33
  15. package/dist/utils/objects/metaData.js +7 -26
  16. package/dist/utils/objects/reportData.js +0 -18
  17. package/dist/utils/objects/statData.js +43 -28
  18. package/dist/utils/objects/stringData.js +4 -7
  19. package/dist/utils/reportFactory/base.js +15 -7
  20. package/dist/utils/reportFactory/html/index.js +24 -9
  21. package/dist/utils/reportFactory/html/template/body.js +117 -0
  22. package/dist/utils/reportFactory/html/template/css.js +471 -409
  23. package/dist/utils/reportFactory/html/template/html.js +17 -112
  24. package/dist/utils/reportFactory/html/template/javascript/data.js +59 -1
  25. package/dist/utils/reportFactory/html/template/javascript/global.js +45 -0
  26. package/dist/utils/reportFactory/html/template/javascript/grid.js +54 -80
  27. package/dist/utils/reportFactory/html/template/javascript/index.js +9 -7
  28. package/dist/utils/reportFactory/html/template/javascript/insight.js +225 -201
  29. package/dist/utils/reportFactory/html/template/javascript/log.js +19 -0
  30. package/dist/utils/reportFactory/html/template/javascript/menuBar.js +40 -35
  31. package/dist/utils/reportFactory/html/template/javascript/overview.js +725 -533
  32. package/dist/utils/reportFactory/index.js +4 -6
  33. package/dist/utils/reportFactory/table.js +95 -0
  34. package/dist/utils/resource.js +10 -6
  35. package/dist/utils/runtime.js +23 -3
  36. package/dist/utils/scripts/postinstall.js +3 -2
  37. package/package.json +8 -3
  38. package/types/index.d.ts +46 -0
  39. package/dist/utils/reportsTable.js +0 -71
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _cypress = require("../../utils/cypress.js");
8
8
  var _baseDriver = _interopRequireDefault(require("../baseDriver.js"));
9
+ var _logs = _interopRequireDefault(require("../../utils/logs.js"));
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
11
  class CypressDriver extends _baseDriver.default {
11
12
  /**
@@ -141,7 +142,7 @@ class CypressDriver extends _baseDriver.default {
141
142
  }
142
143
  });
143
144
  } catch (textError) {
144
- console.error('Error getting text of element:', textError);
145
+ _logs.default.error('Error getting text of element:', textError);
145
146
  }
146
147
  return elementStrings;
147
148
  }
@@ -5,7 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _baseDriver = _interopRequireDefault(require("../baseDriver.js"));
8
+ var _logs = _interopRequireDefault(require("../../utils/logs.js"));
9
+ var _chromeRemoteInterface = _interopRequireDefault(require("chrome-remote-interface"));
10
+ var _fs = _interopRequireDefault(require("fs"));
8
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ // Default import to access CDP
13
+
9
14
  class NightWatchDriver extends _baseDriver.default {
10
15
  constructor(driver) {
11
16
  super(driver);
@@ -40,14 +45,20 @@ class NightWatchDriver extends _baseDriver.default {
40
45
  async getValue(element) {
41
46
  return await element.getAttribute('value');
42
47
  }
48
+ async getElementID(element) {
49
+ return await element.getAttribute('id');
50
+ }
43
51
  async getElementDimension(element) {
44
52
  const eleSize = await element.getRect();
45
53
  if (![null, '', undefined].includes(eleSize)) {
46
54
  return [eleSize.x, eleSize.y, eleSize.height, eleSize.width];
47
55
  }
48
56
  }
49
- isElementDisplayed(element) {
50
- return this.$driver.isVisible(element);
57
+ async isElementDisplayed(element) {
58
+ return await this.$driver.isVisible(element);
59
+ }
60
+ async isElementPresent(element) {
61
+ return await this.$driver.isPresent(element);
51
62
  }
52
63
  async getElementStrings(element) {
53
64
  const elementStrings = [];
@@ -86,10 +97,64 @@ class NightWatchDriver extends _baseDriver.default {
86
97
  return eleStr;
87
98
  }
88
99
  async captureScreenshot(file) {
89
- await this.$driver.saveScreenshot(file);
100
+ await captureFullPage(this.$driver, file);
90
101
  }
91
102
  async getElementsCount(elements) {
92
103
  return elements.length;
93
104
  }
105
+ async switchIframe(frameValue) {
106
+ await this.$driver.frame(frameValue, () => {
107
+ _logs.default.debug(`Switching to ${frameValue} frame`);
108
+ });
109
+ }
110
+ async switchToParentframe() {
111
+ await this.$driver.frame(null);
112
+ }
113
+ pause(time) {
114
+ this.$driver.pause(time * 1000);
115
+ }
116
+ async onScreenStringHighlight(el, color) {
117
+ await this.$driver.execute((el, color) => {
118
+ el.style.border = `3px solid ${color}`;
119
+ setTimeout(() => {
120
+ el.style.border = 'none';
121
+ }, 50);
122
+ }, [el, color]);
123
+ }
124
+ async checkIfIframeIsPresent() {
125
+ return new Promise(res => {
126
+ this.$driver.isPresent({
127
+ selector: '//iframe',
128
+ locateStrategy: 'xpath',
129
+ suppressNotFoundErrors: true
130
+ }, result => {
131
+ res(result.value);
132
+ });
133
+ });
134
+ }
135
+ async checkIfIframeBodyIsEmpty() {
136
+ const bodyContent = await this.$driver.executeScript('return document.body.innerHTML');
137
+ return (await bodyContent.trim()) === '' ? true : false;
138
+ }
94
139
  }
95
- exports.default = NightWatchDriver;
140
+ exports.default = NightWatchDriver;
141
+ const captureFullPage = async ($driver, filePath) => {
142
+ const client = await (0, _chromeRemoteInterface.default)({
143
+ host: 'localhost',
144
+ port: 9222
145
+ });
146
+ const {
147
+ Page
148
+ } = client;
149
+ await Page.enable();
150
+ const {
151
+ data
152
+ } = await Page.captureScreenshot({
153
+ format: 'png',
154
+ captureBeyondViewport: true
155
+ });
156
+ const screenshotBuffer = Buffer.from(data, 'base64');
157
+ _fs.default.writeFileSync(filePath, screenshotBuffer);
158
+ console.log(`Screenshot saved as: ${filePath}`);
159
+ await client.close();
160
+ };
@@ -83,10 +83,6 @@ class SeleniumDriver extends _baseDriver.default {
83
83
  });
84
84
  return elementStrings;
85
85
  }
86
- async captureScreenshot(file) {
87
- const screenshot = await this.driver.takeScreenshot();
88
- _fs.default.writeFileSync(file, screenshot, 'base64');
89
- }
90
86
  async getElementsCount(elements) {
91
87
  return elements.length;
92
88
  }
@@ -47,9 +47,15 @@ class BaseDriver {
47
47
  getElementDimension() {
48
48
  throw new Error('implementation is missing');
49
49
  }
50
+ getElementID() {
51
+ throw new Error('implementation is missing');
52
+ }
50
53
  isElementDisplayed() {
51
54
  throw new Error('implementation is missing');
52
55
  }
56
+ isElementPresent() {
57
+ throw new Error('implementation is missing');
58
+ }
53
59
  getElementString() {
54
60
  throw new Error('implementation is missing');
55
61
  }
@@ -62,6 +68,24 @@ class BaseDriver {
62
68
  getElementsCount() {
63
69
  throw new Error('implementation is missing');
64
70
  }
71
+ switchIframe() {
72
+ throw new Error('implementation is missing');
73
+ }
74
+ switchToParentframe() {
75
+ throw new Error('implementation is missing');
76
+ }
77
+ pause() {
78
+ throw new Error('implementation is missing');
79
+ }
80
+ onScreenStringHighlight() {
81
+ throw new Error('implementation is missing');
82
+ }
83
+ checkIfIframeIsPresent() {
84
+ throw new Error('implementation is missing');
85
+ }
86
+ checkIfIframeBodyIsEmpty() {
87
+ throw new Error('implementation is missing');
88
+ }
65
89
  printOnConsole(str) {
66
90
  console.log(str);
67
91
  }
package/dist/index.js CHANGED
@@ -3,13 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.verify = exports.systems = exports.setLocale = exports.getReportCounts = exports.getLocale = exports.config = void 0;
6
+ exports.verify = exports.systems = exports.setLocale = exports.logger = exports.getLocale = exports.genReportTable = exports.config = void 0;
7
7
  var _i18n = _interopRequireDefault(require("./lib/i18n.js"));
8
8
  var _constants = require("./utils/constants.js");
9
9
  var _config = _interopRequireDefault(require("./lib/config.js"));
10
10
  var _runtime = require("./utils/runtime.js");
11
- var _reportsTable = _interopRequireDefault(require("./utils/reportsTable.js"));
11
+ var _reports = _interopRequireDefault(require("./lib/reports.js"));
12
+ var _logs = _interopRequireDefault(require("./utils/logs.js"));
12
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ /// <reference path="../types/index.d.ts" />
15
+
16
+ const logger = exports.logger = _logs.default;
13
17
  const config = (driver, locale) => {
14
18
  _config.default.set(driver, locale);
15
19
  (0, _runtime.loadDependencies)();
@@ -19,10 +23,11 @@ const setLocale = locale => {
19
23
  _config.default.setLocale(locale);
20
24
  };
21
25
  exports.setLocale = setLocale;
22
- const getReportCounts = () => {
23
- _reportsTable.default.generateTable();
26
+ const genReportTable = () => {
27
+ _reports.default.generateAsciiTable();
28
+ _reports.default.generateHtml();
24
29
  };
25
- exports.getReportCounts = getReportCounts;
30
+ exports.genReportTable = genReportTable;
26
31
  const getLocale = () => {
27
32
  return _config.default.getLocale();
28
33
  };
package/dist/lib/i18n.js CHANGED
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
  var _baseDriver = _interopRequireDefault(require("../driver/baseDriver.js"));
8
8
  var _constants = require("../utils/constants.js");
9
9
  var _config = _interopRequireDefault(require("./config.js"));
10
- var _reports = _interopRequireDefault(require("../utils/reports.js"));
10
+ var _reports = _interopRequireDefault(require("./reports.js"));
11
11
  var _graphic = _interopRequireDefault(require("../utils/graphic.js"));
12
12
  var _logs = _interopRequireDefault(require("../utils/logs.js"));
13
13
  var _fs = _interopRequireDefault(require("fs"));
@@ -68,93 +68,135 @@ class I18nVerify {
68
68
  }
69
69
  async #getElement(verificationArea, locator, img_name, desc) {
70
70
  const ele = await this.#driver.getElement(locator);
71
- if (ele && (await this.#driver.isElementDisplayed(ele))) {
71
+ if (ele && (await this.#driver.isElementPresent(ele))) {
72
72
  let str;
73
73
  try {
74
74
  str = await this.#driver.getElementString(ele);
75
75
  try {
76
- await this.#generateReports(verificationArea, ele, img_name, str, desc);
76
+ await this.#generateReports({
77
+ verificationArea,
78
+ ele,
79
+ img_name,
80
+ str,
81
+ desc
82
+ });
77
83
  } catch (reportError) {
78
- console.error('Error generating report of element:', reportError);
84
+ _logs.default.error('Error generating report of element:', reportError);
79
85
  }
80
86
  } catch (textError) {
81
- console.error('Error getting text of element:', textError);
87
+ _logs.default.error('Error getting text of element:', textError);
82
88
  }
83
89
  } else {
84
- console.error('No element found:', locator);
90
+ _logs.default.error('No element found:', locator);
85
91
  }
86
92
  }
87
93
  async #getElements(verificationArea, xpaths, img_name, desc) {
88
94
  const eles = await this.#driver.getElements(xpaths);
89
95
  if (eles.length > 0) {
90
96
  for (const el of eles) {
91
- if (await this.#driver.isElementDisplayed(el)) {
97
+ if (await this.#driver.isElementPresent(el)) {
92
98
  let uiStrings;
93
99
  try {
94
100
  uiStrings = await this.#driver.getElementStrings(el);
95
101
  try {
96
102
  for (const str of uiStrings) {
97
- await this.#generateReports(verificationArea, el, img_name, str, desc);
103
+ await this.#generateReports({
104
+ verificationArea,
105
+ el,
106
+ img_name,
107
+ str,
108
+ desc
109
+ });
98
110
  }
99
111
  } catch (reportError) {
100
- console.error('Error generating report of element:', reportError);
112
+ _logs.default.error('Error generating report of element:', reportError);
101
113
  }
102
114
  } catch (textError) {
103
- console.error('Error getting text of elements:', textError);
115
+ _logs.default.error('Error getting text of elements:', textError);
104
116
  }
105
117
  }
106
118
  }
107
- } else {
108
- console.error('No elements found:', xpaths);
119
+ }
120
+ if (await this.#driver.checkIfIframeIsPresent()) {
121
+ const iframes = await this.#driver.getElements('//iframe');
122
+ _logs.default.debug(`Total ${iframes.length} iframes are located on the ${desc}`);
123
+ await this.#verifyIframeElements({
124
+ iframes,
125
+ img_name,
126
+ desc
127
+ });
109
128
  }
110
129
  }
111
- async #generateReports(verificationArea, el, image_name, str, desc) {
130
+ async #generateReports({
131
+ verificationArea,
132
+ el,
133
+ img_name,
134
+ str,
135
+ desc,
136
+ iframePresent = false
137
+ }) {
112
138
  //TODO: in some cases, the str is having 0
113
139
  //needs more inspection
114
140
  if (typeof str !== 'string' || !str || Number(str) === 0) {
115
141
  return;
116
142
  }
117
- _reports.default.incrementCount(_constants.I18N_STATUS.REVIEWED);
118
143
  const i18nStatus = _index.default.getIssueType(str),
119
- src_img = (0, _file.joinPaths)(_reports.default.reviewedReports(str, image_name), image_name);
144
+ src_img = (0, _file.joinPaths)(_reports.default.reviewedReports(str, img_name), img_name);
145
+ _reports.default.incrementCount(_constants.I18N_STATUS.REVIEWED, str, src_img, desc);
120
146
  if (i18nStatus && src_img && typeof _reports.default[i18nStatus] === 'function') {
121
147
  const color = this.#defineColor(i18nStatus, str),
122
- dest_img = (0, _file.joinPaths)(_reports.default[i18nStatus](str, image_name), image_name);
123
- const eles = [];
124
- eles.push(el);
125
- browser.perform(async function () {
126
- for (const el of eles) {
127
- if (true) {
128
- // Highlight the element using custom JavaScript
129
- browser.execute(function (el, color) {
130
- el.style.border = `3px solid ${color}`;
131
- setTimeout(function () {
132
- el.style.border = 'none'; // Remove border
133
- }, 50);
134
- }, [el, color]);
135
- }
136
- }
148
+ dest_img = (0, _file.joinPaths)(_reports.default[i18nStatus](str, img_name), img_name);
149
+ _reports.default.incrementCount(i18nStatus, str, dest_img, desc);
150
+ this.#driver.onScreenStringHighlight(el, color);
151
+ await this.#highlightReports({
152
+ verificationArea,
153
+ el,
154
+ color,
155
+ src_img,
156
+ dest_img,
157
+ str,
158
+ iframePresent,
159
+ desc
137
160
  });
138
- await this.#highlightReports(verificationArea, el, color, src_img, dest_img, str);
139
161
  }
140
162
  }
141
- async #highlightReports(verificationArea, el, color, src_img, rep_img, str) {
163
+ async #highlightReports({
164
+ verificationArea,
165
+ el,
166
+ color,
167
+ src_img,
168
+ dest_img,
169
+ str,
170
+ iframePresent,
171
+ desc
172
+ }) {
142
173
  try {
143
- if (_fs.default.existsSync(src_img) && !_fs.default.existsSync(rep_img)) {
144
- _fs.default.copyFileSync(src_img, rep_img);
145
- } else if (!_fs.default.existsSync(rep_img) && !_fs.default.existsSync(src_img)) {
174
+ if (_fs.default.existsSync(src_img) && !_fs.default.existsSync(dest_img)) {
175
+ _fs.default.copyFileSync(src_img, dest_img);
176
+ } else if (!_fs.default.existsSync(dest_img) && !_fs.default.existsSync(src_img)) {
146
177
  await this.#captureCurrentScreen(src_img);
147
- _fs.default.copyFileSync(src_img, rep_img);
178
+ _fs.default.copyFileSync(src_img, dest_img);
148
179
  }
149
180
  } catch (error) {
150
181
  _logs.default.error(`zee-error#2 - ${src_img} is not exists and unable to capture screenshot`);
151
182
  }
152
- const area = await this.#driver.getElement(verificationArea);
183
+ let areaRec;
184
+ let eleRec = await this.#getRect(el);
153
185
  const areaColor = _constants.COLOR.GRB_BLUE;
154
- const areaRec = await this.#getRect(area);
155
- const eleRec = await this.#getRect(el);
156
- await _graphic.default.drawRectangle(areaRec, areaColor, rep_img);
157
- await _graphic.default.drawRectangle(eleRec, color, rep_img);
186
+ if (iframePresent) {
187
+ areaRec = verificationArea;
188
+ const keysToUpdate = ['x', 'y'];
189
+ for (const key of keysToUpdate) {
190
+ if (key in eleRec && key in areaRec) {
191
+ eleRec[key] = areaRec[key] + eleRec[key];
192
+ }
193
+ }
194
+ } else {
195
+ const area = await this.#driver.getElement(verificationArea);
196
+ areaRec = await this.#getRect(area);
197
+ }
198
+ await _graphic.default.drawRectangle(areaRec, areaColor, dest_img);
199
+ await _graphic.default.drawRectangle(eleRec, color, dest_img);
158
200
  }
159
201
  async #captureCurrentScreen(imagePath) {
160
202
  await this.#driver.captureScreenshot(imagePath);
@@ -169,9 +211,49 @@ class I18nVerify {
169
211
  };
170
212
  }
171
213
  #defineColor(i18nStatus, str) {
172
- _reports.default.incrementCount(i18nStatus);
173
- _logs.default.debug(`[${str}] ${_constants.STATUS_COLOR[i18nStatus][1]} ${_constants.STATUS_INFO[i18nStatus]}${'\x1b[0m'}`);
214
+ _logs.default.debug(`${str}${_constants.STATUS_COLOR[i18nStatus][1]} ${_constants.STATUS_INFO[i18nStatus]}${'\x1b[0m'}`);
174
215
  return _constants.STATUS_COLOR[i18nStatus][0];
175
216
  }
217
+ async #verifyIframeElements({
218
+ iframes,
219
+ img_name,
220
+ desc
221
+ }) {
222
+ for (const iframe of iframes) {
223
+ const frameID = await this.#driver.getElementID(iframe);
224
+ if (frameID && frameID !== '') {
225
+ const verificationArea = await this.#getRect(iframe);
226
+ this.#driver.switchIframe(frameID);
227
+ this.#driver.pause(2);
228
+ const iframeBody = await this.#driver.getElement('//body');
229
+ await this.#driver.isElementPresent(iframeBody);
230
+ if (!(await this.#driver.checkIfIframeBodyIsEmpty())) {
231
+ const iframeElements = await this.#driver.getElements('//*[normalize-space(text())]');
232
+ if (iframeElements.length > 0) {
233
+ for (const el of iframeElements) {
234
+ if (await this.#driver.isElementPresent(el)) {
235
+ let uiStrings = await this.#driver.getElementStrings(el);
236
+ try {
237
+ for (const str of uiStrings) {
238
+ await this.#generateReports({
239
+ verificationArea,
240
+ el,
241
+ img_name,
242
+ str,
243
+ desc,
244
+ iframePresent: true
245
+ });
246
+ }
247
+ } catch (reportError) {
248
+ _logs.default.error('Error generating report of iframe elements:', reportError);
249
+ }
250
+ }
251
+ }
252
+ }
253
+ }
254
+ }
255
+ await this.#driver.switchToParentframe();
256
+ }
257
+ }
176
258
  }
177
259
  exports.default = I18nVerify;
@@ -5,82 +5,93 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _path = _interopRequireDefault(require("path"));
8
- var _config = _interopRequireDefault(require("../lib/config.js"));
9
- var _file = require("./file.js");
8
+ var _config = _interopRequireDefault(require("./config.js"));
9
+ var _file = require("../utils/file.js");
10
10
  var _constants = require("../utils/constants.js");
11
+ var _index = _interopRequireDefault(require("../utils/reportFactory/index.js"));
12
+ var _cacheData = _interopRequireDefault(require("../utils/objects/cacheData.js"));
11
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
14
  class Reports {
13
15
  static #baseReportPath;
16
+ static #reportTimeStamp;
14
17
  static setup() {
18
+ Reports.#reportTimeStamp = Reports.#dateTime();
15
19
  const rootFolder = _path.default.resolve();
16
- Reports.#baseReportPath = (0, _file.joinPaths)(rootFolder, _config.default.getL10nReportsPath(), Reports.#dateTime());
20
+ Reports.#baseReportPath = (0, _file.joinPaths)(rootFolder, _config.default.getL10nReportsPath(), Reports.#reportTimeStamp);
21
+ }
22
+ static getReportTimeStamp() {
23
+ return Reports.#reportTimeStamp;
24
+ }
25
+ static getReportPath() {
26
+ return Reports.#baseReportPath;
17
27
  }
18
28
  static reviewedReports(str = null, imgName = null) {
19
- return Reports.#generateFullReportPath('reviewed', str, imgName);
29
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.REVIEWED, str, imgName);
20
30
  }
21
31
  static [_constants.I18N_STATUS.STRING_LOCALIZED](str, imgName) {
22
- return Reports.#generateFullReportPath('string_localized', str, imgName);
32
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.STRING_LOCALIZED, str, imgName);
23
33
  }
24
34
  static [_constants.I18N_STATUS.STRING_NOT_LOCALIZED](str, imgName) {
25
- return Reports.#generateFullReportPath('string_not_localized', str, imgName);
35
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.STRING_NOT_LOCALIZED, str, imgName);
26
36
  }
27
37
  static [_constants.I18N_STATUS.STRING_PARTIALLY_LOCALIZED](str, imgName) {
28
- return Reports.#generateFullReportPath('string_partially_localized', str, imgName);
38
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.STRING_PARTIALLY_LOCALIZED, str, imgName);
29
39
  }
30
40
  static [_constants.I18N_STATUS.DNT](str, imgName) {
31
- return Reports.#generateFullReportPath('dnt', str, imgName);
41
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.DNT, str, imgName);
32
42
  }
33
43
  static [_constants.I18N_STATUS.IGNORE](str, imgName) {
34
- return Reports.#generateFullReportPath('ignored', str, imgName);
44
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.IGNORE, str, imgName);
35
45
  }
36
46
  static [_constants.I18N_STATUS.AUTO_IGNORE](str, imgName) {
37
- return Reports.#generateFullReportPath('auto_ignored', str, imgName);
47
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.AUTO_IGNORE, str, imgName);
38
48
  }
39
49
  static [_constants.I18N_STATUS.UNTRANSLATED](str, imgName) {
40
- return Reports.#generateFullReportPath('un_translated', str, imgName);
50
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.UNTRANSLATED, str, imgName);
41
51
  }
42
52
  static [_constants.I18N_STATUS.ENCODING_ISSUE](str, imgName) {
43
- return Reports.#generateFullReportPath('encoding_issue', str, imgName);
53
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.ENCODING_ISSUE, str, imgName);
44
54
  }
45
55
  static [_constants.I18N_STATUS.DATE_TIME_LOCALIZED](str, imgName) {
46
- return Reports.#generateFullReportPath('date_time_localized', str, imgName);
56
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.DATE_TIME_LOCALIZED, str, imgName);
47
57
  }
48
58
  static [_constants.I18N_STATUS.DATE_TIME_NOT_LOCALIZED](str, imgName) {
49
- return Reports.#generateFullReportPath('date_time_not_localized', str, imgName);
59
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.DATE_TIME_NOT_LOCALIZED, str, imgName);
50
60
  }
51
61
  static [_constants.I18N_STATUS.DATE_LOCALIZED](str, imgName) {
52
- return Reports.#generateFullReportPath('date_localized', str, imgName);
62
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.DATE_LOCALIZED, str, imgName);
53
63
  }
54
64
  static [_constants.I18N_STATUS.DATE_NOT_LOCALIZED](str, imgName) {
55
- return Reports.#generateFullReportPath('date_not_localized', str, imgName);
65
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.DATE_NOT_LOCALIZED, str, imgName);
56
66
  }
57
67
  static [_constants.I18N_STATUS.TIME_LOCALIZED](str, imgName) {
58
- return Reports.#generateFullReportPath('time_localized', str, imgName);
68
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.TIME_LOCALIZED, str, imgName);
59
69
  }
60
70
  static [_constants.I18N_STATUS.TIME_NOT_LOCALIZED](str, imgName) {
61
- return Reports.#generateFullReportPath('time_not_localized', str, imgName);
71
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.TIME_NOT_LOCALIZED, str, imgName);
62
72
  }
63
73
  static [_constants.I18N_STATUS.CURRENCY_LOCALIZED](str, imgName) {
64
- return Reports.#generateFullReportPath('currency_localized', str, imgName);
74
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.CURRENCY_LOCALIZED, str, imgName);
65
75
  }
66
76
  static [_constants.I18N_STATUS.CURRENCY_NOT_LOCALIZED](str, imgName) {
67
- return Reports.#generateFullReportPath('currency_not_localized', str, imgName);
77
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.CURRENCY_NOT_LOCALIZED, str, imgName);
68
78
  }
69
79
  static [_constants.I18N_STATUS.PERCENTAGE_LOCALIZED](str, imgName) {
70
- return Reports.#generateFullReportPath('percentage_localized', str, imgName);
80
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.PERCENTAGE_LOCALIZED, str, imgName);
71
81
  }
72
82
  static [_constants.I18N_STATUS.PERCENTAGE_NOT_LOCALIZED](str, imgName) {
73
- return Reports.#generateFullReportPath('percentage_not_localized', str, imgName);
83
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.PERCENTAGE_NOT_LOCALIZED, str, imgName);
74
84
  }
75
85
  static [_constants.I18N_STATUS.NUMBER_LOCALIZED](str, imgName) {
76
- return Reports.#generateFullReportPath('number_localized', str, imgName);
86
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.NUMBER_LOCALIZED, str, imgName);
77
87
  }
78
88
  static [_constants.I18N_STATUS.NUMBER_NOT_LOCALIZED](str, imgName) {
79
- return Reports.#generateFullReportPath('number_not_localized', str, imgName);
89
+ return Reports.#generateFullReportPath(_constants.I18N_STATUS.NUMBER_NOT_LOCALIZED, str, imgName);
80
90
  }
81
- static incrementCount(propertyName) {
82
- if (_constants.REPORT_COUNTS.hasOwnProperty(propertyName)) {
83
- _constants.REPORT_COUNTS[propertyName]++;
91
+ static incrementCount(type, str, imgPath, desc) {
92
+ if (_constants.REPORT_COUNTS.hasOwnProperty(type)) {
93
+ _constants.REPORT_COUNTS[type]++;
94
+ _cacheData.default.addString(str, type, desc, imgPath.replace(Reports.#baseReportPath, ''));
84
95
  }
85
96
  }
86
97
  static #dateTime() {
@@ -94,7 +105,7 @@ class Reports {
94
105
  return timeStamp;
95
106
  }
96
107
  static #generateFullReportPath = (type, str, imgName) => {
97
- const _screenshotPath = (0, _file.joinPaths)(Reports.#baseReportPath, _config.default.getLocale(), 'screenshots', type);
108
+ const _screenshotPath = (0, _file.joinPaths)(Reports.#baseReportPath, _config.default.getLocale(), 'screenshots', String(type).toLowerCase());
98
109
  (0, _file.ensureDirectoryExists)(_screenshotPath, _constants.DEBUG_MODE);
99
110
  const _stringsPath = (0, _file.joinPaths)(Reports.#baseReportPath, _config.default.getLocale(), 'strings');
100
111
  (0, _file.ensureDirectoryExists)(_stringsPath, _constants.DEBUG_MODE);
@@ -116,5 +127,14 @@ class Reports {
116
127
  }
117
128
  return _screenshotPath;
118
129
  };
130
+ static #generateReport(type) {
131
+ _index.default.export(type, Reports.#baseReportPath);
132
+ }
133
+ static generateHtml() {
134
+ Reports.#generateReport(_constants.SUPPORTED_REPORT_TYPES.HTML);
135
+ }
136
+ static generateAsciiTable() {
137
+ Reports.#generateReport(_constants.SUPPORTED_REPORT_TYPES.ASCII_TABLE);
138
+ }
119
139
  }
120
140
  exports.default = Reports;
@@ -112,7 +112,7 @@ class StringValidator extends _base.default {
112
112
  */
113
113
  isFullQaLanguageText(string) {
114
114
  const config = this.getConfig();
115
- return string.slice(0, 2) === config?.mockChars?.prefix && string.slice(-2) === config?.mockChars.suffix;
115
+ return (string.slice(0, 2) === config?.mockChars?.prefix || string.slice(0, 2) === config?.mockChars?.prefix.toUpperCase()) && string.slice(-2) === config?.mockChars.suffix;
116
116
  }
117
117
 
118
118
  /**
@@ -123,7 +123,7 @@ class StringValidator extends _base.default {
123
123
  */
124
124
  isPartialQaLanguageText(string) {
125
125
  const config = this.getConfig();
126
- return string.slice(0, 2) === config?.mockChars.prefix || string.slice(-2) === config?.mockChars.suffix;
126
+ return string.slice(0, 2) === config?.mockChars.prefix || string.slice(0, 2) === config?.mockChars.prefix.toUpperCase() || string.slice(-2) === config?.mockChars.suffix;
127
127
  }
128
128
 
129
129
  /**