@zeesoft/i18n-verify 2.0.2 → 2.1.0
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/dist/driver/adapters/cypress.js +2 -1
- package/dist/driver/adapters/nightwatch.js +43 -2
- package/dist/driver/baseDriver.js +24 -0
- package/dist/index.js +10 -5
- package/dist/lib/i18n.js +125 -43
- package/dist/{utils → lib}/reports.js +42 -27
- package/dist/lib/validator/string.js +2 -2
- package/dist/template/report.html +1678 -0
- package/dist/utils/cache.js +15 -15
- package/dist/utils/constants.js +8 -5
- package/dist/utils/file.js +8 -4
- package/dist/utils/logs.js +30 -11
- package/dist/utils/objects/cacheData.js +14 -33
- package/dist/utils/objects/metaData.js +7 -26
- package/dist/utils/objects/reportData.js +0 -18
- package/dist/utils/objects/statData.js +43 -28
- package/dist/utils/objects/stringData.js +4 -7
- package/dist/utils/reportFactory/base.js +15 -7
- package/dist/utils/reportFactory/html/index.js +13 -9
- package/dist/utils/reportFactory/html/template/body.js +110 -0
- package/dist/utils/reportFactory/html/template/css.js +446 -409
- package/dist/utils/reportFactory/html/template/html.js +15 -112
- package/dist/utils/reportFactory/html/template/javascript/data.js +59 -1
- package/dist/utils/reportFactory/html/template/javascript/global.js +19 -0
- package/dist/utils/reportFactory/html/template/javascript/grid.js +54 -80
- package/dist/utils/reportFactory/html/template/javascript/index.js +7 -7
- package/dist/utils/reportFactory/html/template/javascript/insight.js +226 -201
- package/dist/utils/reportFactory/html/template/javascript/menuBar.js +40 -35
- package/dist/utils/reportFactory/html/template/javascript/overview.js +725 -533
- package/dist/utils/reportFactory/index.js +4 -6
- package/dist/utils/reportFactory/table.js +95 -0
- package/dist/utils/resource.js +10 -6
- package/dist/utils/runtime.js +23 -3
- package/dist/utils/scripts/postinstall.js +3 -2
- package/package.json +8 -3
- package/types/index.d.ts +46 -0
- 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
|
-
|
|
145
|
+
_logs.default.error('Error getting text of element:', textError);
|
|
145
146
|
}
|
|
146
147
|
return elementStrings;
|
|
147
148
|
}
|
|
@@ -5,6 +5,7 @@ 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"));
|
|
8
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
10
|
class NightWatchDriver extends _baseDriver.default {
|
|
10
11
|
constructor(driver) {
|
|
@@ -40,14 +41,20 @@ class NightWatchDriver extends _baseDriver.default {
|
|
|
40
41
|
async getValue(element) {
|
|
41
42
|
return await element.getAttribute('value');
|
|
42
43
|
}
|
|
44
|
+
async getElementID(element) {
|
|
45
|
+
return await element.getAttribute('id');
|
|
46
|
+
}
|
|
43
47
|
async getElementDimension(element) {
|
|
44
48
|
const eleSize = await element.getRect();
|
|
45
49
|
if (![null, '', undefined].includes(eleSize)) {
|
|
46
50
|
return [eleSize.x, eleSize.y, eleSize.height, eleSize.width];
|
|
47
51
|
}
|
|
48
52
|
}
|
|
49
|
-
isElementDisplayed(element) {
|
|
50
|
-
return this.$driver.isVisible(element);
|
|
53
|
+
async isElementDisplayed(element) {
|
|
54
|
+
return await this.$driver.isVisible(element);
|
|
55
|
+
}
|
|
56
|
+
async isElementPresent(element) {
|
|
57
|
+
return await this.$driver.isPresent(element);
|
|
51
58
|
}
|
|
52
59
|
async getElementStrings(element) {
|
|
53
60
|
const elementStrings = [];
|
|
@@ -91,5 +98,39 @@ class NightWatchDriver extends _baseDriver.default {
|
|
|
91
98
|
async getElementsCount(elements) {
|
|
92
99
|
return elements.length;
|
|
93
100
|
}
|
|
101
|
+
async switchIframe(frameValue) {
|
|
102
|
+
await this.$driver.frame(frameValue, () => {
|
|
103
|
+
_logs.default.debug(`Switching to ${frameValue} frame`);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
async switchToParentframe() {
|
|
107
|
+
await this.$driver.frame(null);
|
|
108
|
+
}
|
|
109
|
+
pause(time) {
|
|
110
|
+
this.$driver.pause(time * 1000);
|
|
111
|
+
}
|
|
112
|
+
async onScreenStringHighlight(el, color) {
|
|
113
|
+
await this.$driver.execute((el, color) => {
|
|
114
|
+
el.style.border = `3px solid ${color}`;
|
|
115
|
+
setTimeout(() => {
|
|
116
|
+
el.style.border = 'none';
|
|
117
|
+
}, 50);
|
|
118
|
+
}, [el, color]);
|
|
119
|
+
}
|
|
120
|
+
async checkIfIframeIsPresent() {
|
|
121
|
+
return new Promise(res => {
|
|
122
|
+
this.$driver.isPresent({
|
|
123
|
+
selector: '//iframe',
|
|
124
|
+
locateStrategy: 'xpath',
|
|
125
|
+
suppressNotFoundErrors: true
|
|
126
|
+
}, result => {
|
|
127
|
+
res(result.value);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
async checkIfIframeBodyIsEmpty() {
|
|
132
|
+
const bodyContent = await this.$driver.executeScript('return document.body.innerHTML');
|
|
133
|
+
return (await bodyContent.trim()) === '' ? true : false;
|
|
134
|
+
}
|
|
94
135
|
}
|
|
95
136
|
exports.default = NightWatchDriver;
|
|
@@ -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.
|
|
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
|
|
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
|
|
23
|
-
|
|
26
|
+
const genReportTable = () => {
|
|
27
|
+
_reports.default.generateAsciiTable();
|
|
28
|
+
_reports.default.generateHtml();
|
|
24
29
|
};
|
|
25
|
-
exports.
|
|
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("
|
|
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.
|
|
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(
|
|
76
|
+
await this.#generateReports({
|
|
77
|
+
verificationArea,
|
|
78
|
+
ele,
|
|
79
|
+
img_name,
|
|
80
|
+
str,
|
|
81
|
+
desc
|
|
82
|
+
});
|
|
77
83
|
} catch (reportError) {
|
|
78
|
-
|
|
84
|
+
_logs.default.error('Error generating report of element:', reportError);
|
|
79
85
|
}
|
|
80
86
|
} catch (textError) {
|
|
81
|
-
|
|
87
|
+
_logs.default.error('Error getting text of element:', textError);
|
|
82
88
|
}
|
|
83
89
|
} else {
|
|
84
|
-
|
|
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.
|
|
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(
|
|
103
|
+
await this.#generateReports({
|
|
104
|
+
verificationArea,
|
|
105
|
+
el,
|
|
106
|
+
img_name,
|
|
107
|
+
str,
|
|
108
|
+
desc
|
|
109
|
+
});
|
|
98
110
|
}
|
|
99
111
|
} catch (reportError) {
|
|
100
|
-
|
|
112
|
+
_logs.default.error('Error generating report of element:', reportError);
|
|
101
113
|
}
|
|
102
114
|
} catch (textError) {
|
|
103
|
-
|
|
115
|
+
_logs.default.error('Error getting text of elements:', textError);
|
|
104
116
|
}
|
|
105
117
|
}
|
|
106
118
|
}
|
|
107
|
-
}
|
|
108
|
-
|
|
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(
|
|
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,
|
|
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,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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(
|
|
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(
|
|
144
|
-
_fs.default.copyFileSync(src_img,
|
|
145
|
-
} else if (!_fs.default.existsSync(
|
|
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,
|
|
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
|
-
|
|
183
|
+
let areaRec;
|
|
184
|
+
let eleRec = await this.#getRect(el);
|
|
153
185
|
const areaColor = _constants.COLOR.GRB_BLUE;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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
|
-
|
|
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,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _path = _interopRequireDefault(require("path"));
|
|
8
|
-
var _config = _interopRequireDefault(require("
|
|
9
|
-
var _file = require("
|
|
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;
|
|
@@ -15,72 +17,76 @@ class Reports {
|
|
|
15
17
|
const rootFolder = _path.default.resolve();
|
|
16
18
|
Reports.#baseReportPath = (0, _file.joinPaths)(rootFolder, _config.default.getL10nReportsPath(), Reports.#dateTime());
|
|
17
19
|
}
|
|
20
|
+
static getReportPath() {
|
|
21
|
+
return Reports.#baseReportPath;
|
|
22
|
+
}
|
|
18
23
|
static reviewedReports(str = null, imgName = null) {
|
|
19
|
-
return Reports.#generateFullReportPath(
|
|
24
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.REVIEWED, str, imgName);
|
|
20
25
|
}
|
|
21
26
|
static [_constants.I18N_STATUS.STRING_LOCALIZED](str, imgName) {
|
|
22
|
-
return Reports.#generateFullReportPath(
|
|
27
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.STRING_LOCALIZED, str, imgName);
|
|
23
28
|
}
|
|
24
29
|
static [_constants.I18N_STATUS.STRING_NOT_LOCALIZED](str, imgName) {
|
|
25
|
-
return Reports.#generateFullReportPath(
|
|
30
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.STRING_NOT_LOCALIZED, str, imgName);
|
|
26
31
|
}
|
|
27
32
|
static [_constants.I18N_STATUS.STRING_PARTIALLY_LOCALIZED](str, imgName) {
|
|
28
|
-
return Reports.#generateFullReportPath(
|
|
33
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.STRING_PARTIALLY_LOCALIZED, str, imgName);
|
|
29
34
|
}
|
|
30
35
|
static [_constants.I18N_STATUS.DNT](str, imgName) {
|
|
31
|
-
return Reports.#generateFullReportPath(
|
|
36
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.DNT, str, imgName);
|
|
32
37
|
}
|
|
33
38
|
static [_constants.I18N_STATUS.IGNORE](str, imgName) {
|
|
34
|
-
return Reports.#generateFullReportPath(
|
|
39
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.IGNORE, str, imgName);
|
|
35
40
|
}
|
|
36
41
|
static [_constants.I18N_STATUS.AUTO_IGNORE](str, imgName) {
|
|
37
|
-
return Reports.#generateFullReportPath(
|
|
42
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.AUTO_IGNORE, str, imgName);
|
|
38
43
|
}
|
|
39
44
|
static [_constants.I18N_STATUS.UNTRANSLATED](str, imgName) {
|
|
40
|
-
return Reports.#generateFullReportPath(
|
|
45
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.UNTRANSLATED, str, imgName);
|
|
41
46
|
}
|
|
42
47
|
static [_constants.I18N_STATUS.ENCODING_ISSUE](str, imgName) {
|
|
43
|
-
return Reports.#generateFullReportPath(
|
|
48
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.ENCODING_ISSUE, str, imgName);
|
|
44
49
|
}
|
|
45
50
|
static [_constants.I18N_STATUS.DATE_TIME_LOCALIZED](str, imgName) {
|
|
46
|
-
return Reports.#generateFullReportPath(
|
|
51
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.DATE_TIME_LOCALIZED, str, imgName);
|
|
47
52
|
}
|
|
48
53
|
static [_constants.I18N_STATUS.DATE_TIME_NOT_LOCALIZED](str, imgName) {
|
|
49
|
-
return Reports.#generateFullReportPath(
|
|
54
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.DATE_TIME_NOT_LOCALIZED, str, imgName);
|
|
50
55
|
}
|
|
51
56
|
static [_constants.I18N_STATUS.DATE_LOCALIZED](str, imgName) {
|
|
52
|
-
return Reports.#generateFullReportPath(
|
|
57
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.DATE_LOCALIZED, str, imgName);
|
|
53
58
|
}
|
|
54
59
|
static [_constants.I18N_STATUS.DATE_NOT_LOCALIZED](str, imgName) {
|
|
55
|
-
return Reports.#generateFullReportPath(
|
|
60
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.DATE_NOT_LOCALIZED, str, imgName);
|
|
56
61
|
}
|
|
57
62
|
static [_constants.I18N_STATUS.TIME_LOCALIZED](str, imgName) {
|
|
58
|
-
return Reports.#generateFullReportPath(
|
|
63
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.TIME_LOCALIZED, str, imgName);
|
|
59
64
|
}
|
|
60
65
|
static [_constants.I18N_STATUS.TIME_NOT_LOCALIZED](str, imgName) {
|
|
61
|
-
return Reports.#generateFullReportPath(
|
|
66
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.TIME_NOT_LOCALIZED, str, imgName);
|
|
62
67
|
}
|
|
63
68
|
static [_constants.I18N_STATUS.CURRENCY_LOCALIZED](str, imgName) {
|
|
64
|
-
return Reports.#generateFullReportPath(
|
|
69
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.CURRENCY_LOCALIZED, str, imgName);
|
|
65
70
|
}
|
|
66
71
|
static [_constants.I18N_STATUS.CURRENCY_NOT_LOCALIZED](str, imgName) {
|
|
67
|
-
return Reports.#generateFullReportPath(
|
|
72
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.CURRENCY_NOT_LOCALIZED, str, imgName);
|
|
68
73
|
}
|
|
69
74
|
static [_constants.I18N_STATUS.PERCENTAGE_LOCALIZED](str, imgName) {
|
|
70
|
-
return Reports.#generateFullReportPath(
|
|
75
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.PERCENTAGE_LOCALIZED, str, imgName);
|
|
71
76
|
}
|
|
72
77
|
static [_constants.I18N_STATUS.PERCENTAGE_NOT_LOCALIZED](str, imgName) {
|
|
73
|
-
return Reports.#generateFullReportPath(
|
|
78
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.PERCENTAGE_NOT_LOCALIZED, str, imgName);
|
|
74
79
|
}
|
|
75
80
|
static [_constants.I18N_STATUS.NUMBER_LOCALIZED](str, imgName) {
|
|
76
|
-
return Reports.#generateFullReportPath(
|
|
81
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.NUMBER_LOCALIZED, str, imgName);
|
|
77
82
|
}
|
|
78
83
|
static [_constants.I18N_STATUS.NUMBER_NOT_LOCALIZED](str, imgName) {
|
|
79
|
-
return Reports.#generateFullReportPath(
|
|
84
|
+
return Reports.#generateFullReportPath(_constants.I18N_STATUS.NUMBER_NOT_LOCALIZED, str, imgName);
|
|
80
85
|
}
|
|
81
|
-
static incrementCount(
|
|
82
|
-
if (_constants.REPORT_COUNTS.hasOwnProperty(
|
|
83
|
-
_constants.REPORT_COUNTS[
|
|
86
|
+
static incrementCount(type, str, imgPath, desc) {
|
|
87
|
+
if (_constants.REPORT_COUNTS.hasOwnProperty(type)) {
|
|
88
|
+
_constants.REPORT_COUNTS[type]++;
|
|
89
|
+
_cacheData.default.addString(str, type, desc, imgPath.replace(Reports.#baseReportPath, ''));
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
static #dateTime() {
|
|
@@ -94,7 +100,7 @@ class Reports {
|
|
|
94
100
|
return timeStamp;
|
|
95
101
|
}
|
|
96
102
|
static #generateFullReportPath = (type, str, imgName) => {
|
|
97
|
-
const _screenshotPath = (0, _file.joinPaths)(Reports.#baseReportPath, _config.default.getLocale(), 'screenshots', type);
|
|
103
|
+
const _screenshotPath = (0, _file.joinPaths)(Reports.#baseReportPath, _config.default.getLocale(), 'screenshots', String(type).toLowerCase());
|
|
98
104
|
(0, _file.ensureDirectoryExists)(_screenshotPath, _constants.DEBUG_MODE);
|
|
99
105
|
const _stringsPath = (0, _file.joinPaths)(Reports.#baseReportPath, _config.default.getLocale(), 'strings');
|
|
100
106
|
(0, _file.ensureDirectoryExists)(_stringsPath, _constants.DEBUG_MODE);
|
|
@@ -116,5 +122,14 @@ class Reports {
|
|
|
116
122
|
}
|
|
117
123
|
return _screenshotPath;
|
|
118
124
|
};
|
|
125
|
+
static #generateReport(type) {
|
|
126
|
+
_index.default.export(type, Reports.#baseReportPath);
|
|
127
|
+
}
|
|
128
|
+
static generateHtml() {
|
|
129
|
+
Reports.#generateReport(_constants.SUPPORTED_REPORT_TYPES.HTML);
|
|
130
|
+
}
|
|
131
|
+
static generateAsciiTable() {
|
|
132
|
+
Reports.#generateReport(_constants.SUPPORTED_REPORT_TYPES.ASCII_TABLE);
|
|
133
|
+
}
|
|
119
134
|
}
|
|
120
135
|
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
|
/**
|