@applitools/core 4.4.0 → 4.5.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/CHANGELOG.md +32 -0
- package/dist/cli/cli.js +8 -1
- package/dist/troubleshoot/logs.js +36 -1
- package/dist/ufg/utils/take-dom-snapshots.js +2 -2
- package/package.json +8 -8
- package/types/troubleshoot/logs.d.ts +16 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.5.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/core@4.4.0...js/core@4.5.0) (2023-12-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add set of env variables to skip/ignore some optional automations ([#2097](https://github.com/applitools/eyes.sdk.javascript1/issues/2097)) ([bd3b08c](https://github.com/applitools/eyes.sdk.javascript1/commit/bd3b08c3d2997eb98d545b308a1f15501192178e))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* fixed issue when page wasn't reloaded for one of the breakpoints if the initial viewport size matches it ([9038723](https://github.com/applitools/eyes.sdk.javascript1/commit/9038723ee68515f7d4fe20ed31ec501df9a381dc))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Dependencies
|
|
17
|
+
|
|
18
|
+
* @applitools/spec-driver-webdriver bumped to 1.0.53
|
|
19
|
+
|
|
20
|
+
* @applitools/spec-driver-selenium bumped to 1.5.67
|
|
21
|
+
|
|
22
|
+
* @applitools/spec-driver-puppeteer bumped to 1.3.3
|
|
23
|
+
|
|
24
|
+
* @applitools/driver bumped to 1.16.0
|
|
25
|
+
#### Features
|
|
26
|
+
|
|
27
|
+
* add set of env variables to skip/ignore some optional automations ([#2097](https://github.com/applitools/eyes.sdk.javascript1/issues/2097)) ([bd3b08c](https://github.com/applitools/eyes.sdk.javascript1/commit/bd3b08c3d2997eb98d545b308a1f15501192178e))
|
|
28
|
+
* @applitools/screenshoter bumped to 3.8.19
|
|
29
|
+
|
|
30
|
+
* @applitools/nml-client bumped to 1.6.1
|
|
31
|
+
|
|
32
|
+
* @applitools/ec-client bumped to 1.7.19
|
|
33
|
+
|
|
34
|
+
|
|
3
35
|
## [4.4.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/core@4.3.0...js/core@4.4.0) (2023-12-12)
|
|
4
36
|
|
|
5
37
|
|
package/dist/cli/cli.js
CHANGED
|
@@ -123,12 +123,19 @@ yargs_1.default
|
|
|
123
123
|
description: 'group logs by tag names',
|
|
124
124
|
type: 'boolean',
|
|
125
125
|
},
|
|
126
|
+
analyze: {
|
|
127
|
+
description: 'group logs by tag names',
|
|
128
|
+
type: 'boolean',
|
|
129
|
+
},
|
|
126
130
|
}),
|
|
127
131
|
handler: async (args) => {
|
|
128
132
|
var _a;
|
|
129
133
|
const input = (_a = args.input) !== null && _a !== void 0 ? _a : (await utils.streams.toBuffer(process.stdin)).toString('utf8');
|
|
130
134
|
const logs = (0, logs_1.parseLogs)(input);
|
|
131
|
-
if (args.
|
|
135
|
+
if (args.analyze) {
|
|
136
|
+
console.log(JSON.stringify((0, logs_1.analyzeLogs)((0, logs_1.structureLogs)(logs)), null, 2));
|
|
137
|
+
}
|
|
138
|
+
else if (args.structure) {
|
|
132
139
|
console.log(JSON.stringify((0, logs_1.structureLogs)(logs), null, 2));
|
|
133
140
|
}
|
|
134
141
|
else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.structureLogs = exports.parseLogs = void 0;
|
|
3
|
+
exports.analyzeLogs = exports.structureLogs = exports.stringifyLog = exports.parseLogs = void 0;
|
|
4
4
|
function parseLogs(logs) {
|
|
5
5
|
const regexp = /^(?<label>[^\s]+) (?:\((?<tags>[^\)]+)\) )?\| (?<timestamp>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)? (?:\[(?<level>[A-Z]+)\s*\])? (?<message>.+)$/;
|
|
6
6
|
const lines = logs.split('\n');
|
|
@@ -20,8 +20,15 @@ function parseLogs(logs) {
|
|
|
20
20
|
}, []);
|
|
21
21
|
}
|
|
22
22
|
exports.parseLogs = parseLogs;
|
|
23
|
+
function stringifyLog(log) {
|
|
24
|
+
var _a;
|
|
25
|
+
// eslint-disable-next-line
|
|
26
|
+
return `${log.label} (${(_a = log.tags) === null || _a === void 0 ? void 0 : _a.map(tags => tags.join('/')).join(' & ')}) ${log.timestamp} [${log.level}] ${log.message}`;
|
|
27
|
+
}
|
|
28
|
+
exports.stringifyLog = stringifyLog;
|
|
23
29
|
function structureLogs(logs) {
|
|
24
30
|
const groups = {};
|
|
31
|
+
groups.logs;
|
|
25
32
|
logs.forEach(log => {
|
|
26
33
|
var _a;
|
|
27
34
|
const tags = (_a = log.tags) !== null && _a !== void 0 ? _a : [[]];
|
|
@@ -39,3 +46,31 @@ function structureLogs(logs) {
|
|
|
39
46
|
return groups;
|
|
40
47
|
}
|
|
41
48
|
exports.structureLogs = structureLogs;
|
|
49
|
+
function analyzeLogs({ logs, ...groups }) {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
const analysis = {};
|
|
52
|
+
analysis.logs = logs === null || logs === void 0 ? void 0 : logs.map(stringifyLog);
|
|
53
|
+
const groupAnalyses = Object.fromEntries(Object.entries(groups).map(([name, group]) => [name, analyzeLogs(group)]));
|
|
54
|
+
analysis.startedAt = Math.min(Date.parse((_a = logs === null || logs === void 0 ? void 0 : logs[0]) === null || _a === void 0 ? void 0 : _a.timestamp) || Infinity, ...Object.values(groupAnalyses).map(group => group.startedAt));
|
|
55
|
+
analysis.finishedAt = Math.max(Date.parse((_b = logs === null || logs === void 0 ? void 0 : logs[logs.length - 1]) === null || _b === void 0 ? void 0 : _b.timestamp) || 0, ...Object.values(groupAnalyses).map(group => group.finishedAt));
|
|
56
|
+
analysis.time = analysis.finishedAt - analysis.startedAt;
|
|
57
|
+
analysis.conclusion = '';
|
|
58
|
+
analysis.conclusion += `Time taken: ${formatTime(analysis.time)};`;
|
|
59
|
+
if (Object.keys(groupAnalyses).length > 0) {
|
|
60
|
+
analysis.conclusion += `Longest group: ${Object.keys(groupAnalyses).reduce((prev, cur) => groupAnalyses[cur].time > groupAnalyses[prev].time ? cur : prev)}`;
|
|
61
|
+
}
|
|
62
|
+
return { ...analysis, ...groupAnalyses };
|
|
63
|
+
}
|
|
64
|
+
exports.analyzeLogs = analyzeLogs;
|
|
65
|
+
function formatTime(ms) {
|
|
66
|
+
const h = Math.floor(ms / 3600000);
|
|
67
|
+
if (h)
|
|
68
|
+
ms -= h * 3600000;
|
|
69
|
+
const m = Math.floor(ms / 60000);
|
|
70
|
+
if (m)
|
|
71
|
+
ms -= m * 60000;
|
|
72
|
+
const s = Math.floor(ms / 1000);
|
|
73
|
+
if (s)
|
|
74
|
+
ms -= s * 1000;
|
|
75
|
+
return [h && `${h}h`, m && `${m}m`, s && `${s}s`, ms && `${ms}ms`].filter(Boolean).join(' ');
|
|
76
|
+
}
|
|
@@ -124,9 +124,9 @@ async function takeDomSnapshots({ driver, settings, hooks, provides, logger, })
|
|
|
124
124
|
logger.log(message);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
if (settings.layoutBreakpoints.reload)
|
|
128
|
-
await driver.reloadPage();
|
|
129
127
|
}
|
|
128
|
+
if (settings.layoutBreakpoints.reload)
|
|
129
|
+
await driver.reloadPage();
|
|
130
130
|
if (settings.lazyLoad && (index === 0 || settings.layoutBreakpoints.reload)) {
|
|
131
131
|
await (0, wait_for_lazy_load_1.waitForLazyLoad)({ context: currentContext, settings: settings.lazyLoad, logger });
|
|
132
132
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"homepage": "https://applitools.com",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
|
|
@@ -77,15 +77,15 @@
|
|
|
77
77
|
"@applitools/core-base": "1.7.4",
|
|
78
78
|
"@applitools/dom-capture": "11.2.4",
|
|
79
79
|
"@applitools/dom-snapshot": "4.7.14",
|
|
80
|
-
"@applitools/driver": "1.
|
|
81
|
-
"@applitools/ec-client": "1.7.
|
|
80
|
+
"@applitools/driver": "1.16.0",
|
|
81
|
+
"@applitools/ec-client": "1.7.19",
|
|
82
82
|
"@applitools/logger": "2.0.14",
|
|
83
|
-
"@applitools/nml-client": "1.6.
|
|
83
|
+
"@applitools/nml-client": "1.6.1",
|
|
84
84
|
"@applitools/req": "1.6.4",
|
|
85
|
-
"@applitools/screenshoter": "3.8.
|
|
85
|
+
"@applitools/screenshoter": "3.8.19",
|
|
86
86
|
"@applitools/snippets": "2.4.24",
|
|
87
87
|
"@applitools/socket": "1.1.14",
|
|
88
|
-
"@applitools/spec-driver-webdriver": "1.0.
|
|
88
|
+
"@applitools/spec-driver-webdriver": "1.0.53",
|
|
89
89
|
"@applitools/ufg-client": "1.9.9",
|
|
90
90
|
"@applitools/utils": "1.7.0",
|
|
91
91
|
"@types/ws": "8.5.5",
|
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@applitools/bongo": "^5.7.6",
|
|
102
102
|
"@applitools/sea": "^1.0.0",
|
|
103
|
-
"@applitools/spec-driver-puppeteer": "^1.3.
|
|
104
|
-
"@applitools/spec-driver-selenium": "^1.5.
|
|
103
|
+
"@applitools/spec-driver-puppeteer": "^1.3.3",
|
|
104
|
+
"@applitools/spec-driver-selenium": "^1.5.67",
|
|
105
105
|
"@applitools/test-server": "^1.2.2",
|
|
106
106
|
"@applitools/test-utils": "^1.5.17",
|
|
107
107
|
"@applitools/tunnel-client": "^1.4.0",
|
|
@@ -5,6 +5,21 @@ interface Log {
|
|
|
5
5
|
level?: string;
|
|
6
6
|
message: string;
|
|
7
7
|
}
|
|
8
|
+
interface GroupedLog<TGroupedLog extends GroupedLog<TGroupedLog>> {
|
|
9
|
+
[key: string]: TGroupedLog;
|
|
10
|
+
}
|
|
11
|
+
type StructuredLog = GroupedLog<StructuredLog> & {
|
|
12
|
+
logs?: Log[];
|
|
13
|
+
};
|
|
14
|
+
type AnalyzedLog = GroupedLog<AnalyzedLog> & {
|
|
15
|
+
logs?: string[];
|
|
16
|
+
startedAt: number;
|
|
17
|
+
finishedAt: number;
|
|
18
|
+
time: number;
|
|
19
|
+
conclusion: string;
|
|
20
|
+
};
|
|
8
21
|
export declare function parseLogs(logs: string): Log[];
|
|
9
|
-
export declare function
|
|
22
|
+
export declare function stringifyLog(log: Log): string;
|
|
23
|
+
export declare function structureLogs(logs: Log[]): StructuredLog;
|
|
24
|
+
export declare function analyzeLogs({ logs, ...groups }: StructuredLog): AnalyzedLog;
|
|
10
25
|
export {};
|