@applitools/core 4.4.0 → 4.5.1

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 CHANGED
@@ -1,5 +1,80 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.5.1](https://github.com/applitools/eyes.sdk.javascript1/compare/js/core@4.5.0...js/core@4.5.1) (2023-12-19)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * avoid caching concurrency ([#2103](https://github.com/applitools/eyes.sdk.javascript1/issues/2103)) ([34db2e9](https://github.com/applitools/eyes.sdk.javascript1/commit/34db2e9c554b0851b18b514b1a8a82b83ff310cd))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * @applitools/spec-driver-webdriver bumped to 1.0.54
14
+ #### Bug Fixes
15
+
16
+ * fixed extraction of the driver server url ([ddc6449](https://github.com/applitools/eyes.sdk.javascript1/commit/ddc6449fc72166ab26c99e9ba7bb83c05fd591d6))
17
+
18
+
19
+
20
+ * @applitools/spec-driver-selenium bumped to 1.5.68
21
+
22
+ * @applitools/spec-driver-puppeteer bumped to 1.3.4
23
+
24
+ * @applitools/driver bumped to 1.16.1
25
+ #### Bug Fixes
26
+
27
+ * fixed bug with screenshot not being properly scaled on ios devices with appium 2 ([#2092](https://github.com/applitools/eyes.sdk.javascript1/issues/2092)) ([26678bf](https://github.com/applitools/eyes.sdk.javascript1/commit/26678bfe254def506ea82e6a645519d6567fb3fd))
28
+ * fixed extraction of the driver server url ([ddc6449](https://github.com/applitools/eyes.sdk.javascript1/commit/ddc6449fc72166ab26c99e9ba7bb83c05fd591d6))
29
+ * fixed infinite loop that may appear during attribute extraction ([#2102](https://github.com/applitools/eyes.sdk.javascript1/issues/2102)) ([6bef680](https://github.com/applitools/eyes.sdk.javascript1/commit/6bef680fbd2d5c26a46cf2a4f00bd083d1d02109))
30
+ * @applitools/screenshoter bumped to 3.8.20
31
+ #### Bug Fixes
32
+
33
+ * fixed bug with screenshot not being properly scaled on ios devices with appium 2 ([#2092](https://github.com/applitools/eyes.sdk.javascript1/issues/2092)) ([26678bf](https://github.com/applitools/eyes.sdk.javascript1/commit/26678bfe254def506ea82e6a645519d6567fb3fd))
34
+
35
+
36
+
37
+ * @applitools/nml-client bumped to 1.6.2
38
+
39
+ * @applitools/ec-client bumped to 1.7.20
40
+
41
+ * @applitools/core-base bumped to 1.7.5
42
+ #### Bug Fixes
43
+
44
+ * avoid caching concurrency ([#2103](https://github.com/applitools/eyes.sdk.javascript1/issues/2103)) ([34db2e9](https://github.com/applitools/eyes.sdk.javascript1/commit/34db2e9c554b0851b18b514b1a8a82b83ff310cd))
45
+
46
+ ## [4.5.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/core@4.4.0...js/core@4.5.0) (2023-12-18)
47
+
48
+
49
+ ### Features
50
+
51
+ * 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))
52
+
53
+
54
+ ### Bug Fixes
55
+
56
+ * 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))
57
+
58
+
59
+ ### Dependencies
60
+
61
+ * @applitools/spec-driver-webdriver bumped to 1.0.53
62
+
63
+ * @applitools/spec-driver-selenium bumped to 1.5.67
64
+
65
+ * @applitools/spec-driver-puppeteer bumped to 1.3.3
66
+
67
+ * @applitools/driver bumped to 1.16.0
68
+ #### Features
69
+
70
+ * 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))
71
+ * @applitools/screenshoter bumped to 3.8.19
72
+
73
+ * @applitools/nml-client bumped to 1.6.1
74
+
75
+ * @applitools/ec-client bumped to 1.7.19
76
+
77
+
3
78
  ## [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
79
 
5
80
 
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.structure) {
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 {
package/dist/core.js CHANGED
@@ -49,7 +49,7 @@ function makeCore({ spec, clients, concurrency, base: defaultBase, environment:
49
49
  logger.log(`Core is initialized ${defaultBase ? 'with' : 'without'} custom base core and environment`, environment);
50
50
  if (environment.sdk)
51
51
  (0, validate_sdk_version_1.validateSdkVersion)(environment.sdk, { logger });
52
- const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, cwd, logger });
52
+ const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, concurrency, cwd, logger });
53
53
  return utils.general.extend(base, core => {
54
54
  return {
55
55
  base: base,
@@ -65,6 +65,7 @@ function makeCore({ spec, clients, concurrency, base: defaultBase, environment:
65
65
  core,
66
66
  base: defaultBase,
67
67
  agentId,
68
+ cwd,
68
69
  environment,
69
70
  asyncCache,
70
71
  logger,
@@ -30,7 +30,7 @@ const core_2 = require("./ufg/core");
30
30
  const open_eyes_1 = require("./open-eyes");
31
31
  const get_manager_results_1 = require("./get-manager-results");
32
32
  const utils = __importStar(require("@applitools/utils"));
33
- function makeMakeManager({ spec, clients, concurrency: defaultConcurrency = utils.general.getEnvValue('CONCURRENCY', 'number'), core, base, agentId: defaultAgentId, environment, cwd = process.cwd(), logger: mainLogger, asyncCache, }) {
33
+ function makeMakeManager({ spec, clients, concurrency: defaultConcurrency = utils.general.getEnvValue('CONCURRENCY', 'number'), core, base: defaultBase, agentId: defaultAgentId, environment, cwd = process.cwd(), logger: mainLogger, asyncCache, }) {
34
34
  return async function makeManager({ type = 'classic', settings, logger = mainLogger, } = {}) {
35
35
  var _a, _b, _c, _d, _e;
36
36
  var _f;
@@ -41,7 +41,7 @@ function makeMakeManager({ spec, clients, concurrency: defaultConcurrency = util
41
41
  (_c = (_f = settings.batch).id) !== null && _c !== void 0 ? _c : (_f.id = (_d = utils.general.getEnvValue('BATCH_ID')) !== null && _d !== void 0 ? _d : `generated-${utils.general.guid()}`);
42
42
  (_e = settings.agentId) !== null && _e !== void 0 ? _e : (settings.agentId = type === 'ufg' ? defaultAgentId === null || defaultAgentId === void 0 ? void 0 : defaultAgentId.replace(/(\/\d)/, '.visualgrid$1') : defaultAgentId);
43
43
  logger.log('Command "makeManager" is called with settings', settings);
44
- base !== null && base !== void 0 ? base : (base = (0, core_base_1.makeCore)({ agentId: settings.agentId, concurrency: settings.concurrency, cwd, logger }));
44
+ const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId: settings.agentId, concurrency: settings.concurrency, cwd, logger });
45
45
  const cores = {
46
46
  ufg: (0, core_2.makeCore)({ spec, base, fetchConcurrency: settings.fetchConcurrency, asyncCache, logger }),
47
47
  classic: (0, core_1.makeCore)({ spec, base, logger }),
@@ -58,7 +58,7 @@ exports.default = {
58
58
  validateRawAccountInfo(data);
59
59
  },
60
60
  async testServer() {
61
- const server = (0, core_base_1.makeCoreRequests)({ agentId: 'check-network' });
61
+ const server = (0, core_base_1.makeCoreRequestsWithCache)();
62
62
  const result = await server.getAccountInfo({ settings: utils_1.config });
63
63
  validateAccountInfo(result);
64
64
  },
@@ -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.4.0",
3
+ "version": "4.5.1",
4
4
  "homepage": "https://applitools.com",
5
5
  "bugs": {
6
6
  "url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
@@ -74,18 +74,18 @@
74
74
  }
75
75
  },
76
76
  "dependencies": {
77
- "@applitools/core-base": "1.7.4",
77
+ "@applitools/core-base": "1.7.5",
78
78
  "@applitools/dom-capture": "11.2.4",
79
79
  "@applitools/dom-snapshot": "4.7.14",
80
- "@applitools/driver": "1.15.3",
81
- "@applitools/ec-client": "1.7.18",
80
+ "@applitools/driver": "1.16.1",
81
+ "@applitools/ec-client": "1.7.20",
82
82
  "@applitools/logger": "2.0.14",
83
- "@applitools/nml-client": "1.6.0",
83
+ "@applitools/nml-client": "1.6.2",
84
84
  "@applitools/req": "1.6.4",
85
- "@applitools/screenshoter": "3.8.18",
85
+ "@applitools/screenshoter": "3.8.20",
86
86
  "@applitools/snippets": "2.4.24",
87
87
  "@applitools/socket": "1.1.14",
88
- "@applitools/spec-driver-webdriver": "1.0.52",
88
+ "@applitools/spec-driver-webdriver": "1.0.54",
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.2",
104
- "@applitools/spec-driver-selenium": "^1.5.66",
103
+ "@applitools/spec-driver-puppeteer": "^1.3.4",
104
+ "@applitools/spec-driver-selenium": "^1.5.68",
105
105
  "@applitools/test-server": "^1.2.2",
106
106
  "@applitools/test-utils": "^1.5.17",
107
107
  "@applitools/tunnel-client": "^1.4.0",
@@ -19,7 +19,7 @@ type Options<TSpec extends SpecType> = {
19
19
  logger: Logger;
20
20
  asyncCache?: AsyncCache;
21
21
  };
22
- export declare function makeMakeManager<TSpec extends SpecType>({ spec, clients, concurrency: defaultConcurrency, core, base, agentId: defaultAgentId, environment, cwd, logger: mainLogger, asyncCache, }: Options<TSpec>): <TType extends "classic" | "ufg" = "classic">({ type, settings, logger, }?: {
22
+ export declare function makeMakeManager<TSpec extends SpecType>({ spec, clients, concurrency: defaultConcurrency, core, base: defaultBase, agentId: defaultAgentId, environment, cwd, logger: mainLogger, asyncCache, }: Options<TSpec>): <TType extends "classic" | "ufg" = "classic">({ type, settings, logger, }?: {
23
23
  type?: TType | undefined;
24
24
  settings?: ManagerSettings | undefined;
25
25
  logger?: Logger | undefined;
@@ -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 structureLogs(logs: Log[]): any;
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 {};