@applitools/core 4.1.0 → 4.3.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 CHANGED
@@ -1,5 +1,122 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.3.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/core@4.2.0...js/core@4.3.0) (2023-12-05)
4
+
5
+
6
+ ### Features
7
+
8
+ * add Eyes.getResults method ([#2046](https://github.com/applitools/eyes.sdk.javascript1/issues/2046)) ([#2069](https://github.com/applitools/eyes.sdk.javascript1/issues/2069)) ([4d263e1](https://github.com/applitools/eyes.sdk.javascript1/commit/4d263e19cb5e5708790a1a7ef90ff8f3eee50d91))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * @applitools/utils bumped to 1.7.0
14
+ #### Features
15
+
16
+ * add Eyes.getResults method ([#2046](https://github.com/applitools/eyes.sdk.javascript1/issues/2046)) ([#2069](https://github.com/applitools/eyes.sdk.javascript1/issues/2069)) ([4d263e1](https://github.com/applitools/eyes.sdk.javascript1/commit/4d263e19cb5e5708790a1a7ef90ff8f3eee50d91))
17
+ * @applitools/logger bumped to 2.0.14
18
+
19
+ * @applitools/socket bumped to 1.1.14
20
+
21
+ * @applitools/req bumped to 1.6.4
22
+
23
+ * @applitools/image bumped to 1.1.9
24
+
25
+ * @applitools/spec-driver-webdriver bumped to 1.0.51
26
+
27
+ * @applitools/spec-driver-selenium bumped to 1.5.65
28
+
29
+ * @applitools/spec-driver-puppeteer bumped to 1.3.1
30
+
31
+ * @applitools/driver bumped to 1.15.2
32
+
33
+ * @applitools/screenshoter bumped to 3.8.17
34
+
35
+ * @applitools/nml-client bumped to 1.5.17
36
+
37
+ * @applitools/tunnel-client bumped to 1.3.2
38
+
39
+ * @applitools/ufg-client bumped to 1.9.9
40
+
41
+ * @applitools/ec-client bumped to 1.7.17
42
+
43
+ * @applitools/core-base bumped to 1.7.4
44
+ #### Bug Fixes
45
+
46
+ * do not block concurrency when server response is 503 ([#2049](https://github.com/applitools/eyes.sdk.javascript1/issues/2049)) ([f285009](https://github.com/applitools/eyes.sdk.javascript1/commit/f2850098f7522776c0d0a98bb1d958303628b149))
47
+
48
+
49
+
50
+
51
+ ## [4.2.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/core@4.1.0...js/core@4.2.0) (2023-11-21)
52
+
53
+
54
+ ### Features
55
+
56
+ * added notification about outdated sdk version ([#2012](https://github.com/applitools/eyes.sdk.javascript1/issues/2012)) ([0f0a646](https://github.com/applitools/eyes.sdk.javascript1/commit/0f0a6462a56e7c97f9a22173c3b63af91e220adb))
57
+ * log driver environment info to splank ([#2023](https://github.com/applitools/eyes.sdk.javascript1/issues/2023)) ([11d0546](https://github.com/applitools/eyes.sdk.javascript1/commit/11d0546e76962b4c231e140b0229b8402da27f69))
58
+
59
+
60
+ ### Bug Fixes
61
+
62
+ * return result when error in the ufg ([#2020](https://github.com/applitools/eyes.sdk.javascript1/issues/2020)) ([28cdcc5](https://github.com/applitools/eyes.sdk.javascript1/commit/28cdcc5a859641d0edde032165c5068fcc580c8d))
63
+
64
+
65
+ ### Dependencies
66
+
67
+ * @applitools/utils bumped to 1.6.3
68
+ #### Bug Fixes
69
+
70
+ * don't throw error for missing configuration file ([#2034](https://github.com/applitools/eyes.sdk.javascript1/issues/2034)) ([d084e7b](https://github.com/applitools/eyes.sdk.javascript1/commit/d084e7bf6e1727e3969622b4e597881f18241eb3))
71
+ * @applitools/socket bumped to 1.1.13
72
+
73
+ * @applitools/dom-snapshot bumped to 4.7.14
74
+ #### Bug Fixes
75
+
76
+ * preserve css declarations order in dom-snapshot ([#2037](https://github.com/applitools/eyes.sdk.javascript1/issues/2037)) ([1381851](https://github.com/applitools/eyes.sdk.javascript1/commit/1381851d46f28ea7e7724025c4eab33c81c4e144))
77
+ * @applitools/spec-driver-webdriver bumped to 1.0.50
78
+ #### Bug Fixes
79
+
80
+ * send devtool commands in chromium ([#2039](https://github.com/applitools/eyes.sdk.javascript1/issues/2039)) ([ff42043](https://github.com/applitools/eyes.sdk.javascript1/commit/ff42043c3d9f110eb7b22ab1a8448d77859923b4))
81
+
82
+
83
+
84
+ * @applitools/spec-driver-puppeteer bumped to 1.3.0
85
+ #### Features
86
+
87
+ * added notification about outdated sdk version ([#2012](https://github.com/applitools/eyes.sdk.javascript1/issues/2012)) ([0f0a646](https://github.com/applitools/eyes.sdk.javascript1/commit/0f0a6462a56e7c97f9a22173c3b63af91e220adb))
88
+
89
+
90
+
91
+ * @applitools/logger bumped to 2.0.13
92
+
93
+ * @applitools/req bumped to 1.6.3
94
+
95
+ * @applitools/image bumped to 1.1.8
96
+
97
+ * @applitools/spec-driver-selenium bumped to 1.5.64
98
+
99
+ * @applitools/driver bumped to 1.15.1
100
+
101
+ * @applitools/screenshoter bumped to 3.8.16
102
+
103
+ * @applitools/nml-client bumped to 1.5.16
104
+
105
+ * @applitools/tunnel-client bumped to 1.3.1
106
+
107
+ * @applitools/ufg-client bumped to 1.9.8
108
+
109
+ * @applitools/ec-client bumped to 1.7.16
110
+
111
+ * @applitools/core-base bumped to 1.7.3
112
+ #### Bug Fixes
113
+
114
+ * remove connection timeout in case of a long running tasks ([#2006](https://github.com/applitools/eyes.sdk.javascript1/issues/2006)) ([49a596a](https://github.com/applitools/eyes.sdk.javascript1/commit/49a596ac1b022a66b5c07ecfee458cc061891ce0))
115
+ * return result when error in the ufg ([#2020](https://github.com/applitools/eyes.sdk.javascript1/issues/2020)) ([28cdcc5](https://github.com/applitools/eyes.sdk.javascript1/commit/28cdcc5a859641d0edde032165c5068fcc580c8d))
116
+
117
+
118
+
119
+
3
120
  ## [4.1.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/core@4.0.2...js/core@4.1.0) (2023-11-07)
4
121
 
5
122
 
@@ -1,25 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeGetResults = void 0;
4
- const abort_error_1 = require("../errors/abort-error");
5
4
  function makeGetResults({ eyes, logger: mainLogger }) {
6
5
  return async function getResults({ settings, logger = mainLogger, } = {}) {
7
6
  logger = logger.extend(mainLogger);
8
7
  logger.log('Command "getResults" is called with settings', settings);
9
8
  return Promise.all(Array.from(eyes.storage.values(), async (item) => {
10
- var _a;
11
9
  try {
12
10
  const [eyes] = await Promise.all([item.eyes, ...item.jobs]);
13
11
  const [result] = await eyes.getResults({ settings, logger });
14
12
  return { ...result, environment: eyes.test.environment };
15
13
  }
16
14
  catch (error) {
17
- if (error instanceof abort_error_1.AbortError && ((_a = error.info) === null || _a === void 0 ? void 0 : _a.eyes)) {
18
- logger.warn('Command "getResults" received an abort error during performing', settings);
19
- const [result] = await error.info.eyes.getResults({ settings, logger });
20
- return { ...result, environment: error.info.environment };
21
- }
22
- logger.fatal('Command "getResults" received an error during performing', settings);
15
+ logger.fatal('Command "getResults" received an error', error, 'during performing with settings', settings);
23
16
  throw error;
24
17
  }
25
18
  }));
@@ -161,9 +161,8 @@ function makeCheckAndClose({ eyes, target: defaultTarget, environments: defaultE
161
161
  }
162
162
  catch (error) {
163
163
  environmentLogger.error(`Check on environment with id "${(_c = baseEyes.test.environment) === null || _c === void 0 ? void 0 : _c.environmentId}" failed due to an error`, error);
164
- await baseEyes.abort({ logger: environmentLogger });
165
- error.info = { eyes: baseEyes };
166
- throw error;
164
+ if (baseEyes.running && !(signal === null || signal === void 0 ? void 0 : signal.aborted))
165
+ await baseEyes.abort({ logger: environmentLogger, settings: { reason: error } });
167
166
  }
168
167
  }
169
168
  catch (error) {
@@ -162,9 +162,7 @@ function makeCheck({ eyes, target: defaultTarget, environments: defaultEnvironme
162
162
  catch (error) {
163
163
  environmentLogger.error(`Check on environment with id "${(_c = baseEyes.test.environment) === null || _c === void 0 ? void 0 : _c.environmentId}" failed due to an error`, error);
164
164
  if (baseEyes.running && !(signal === null || signal === void 0 ? void 0 : signal.aborted))
165
- await baseEyes.abort({ logger: environmentLogger });
166
- error.info = { eyes: baseEyes };
167
- throw error;
165
+ await baseEyes.abort({ logger: environmentLogger, settings: { reason: error } });
168
166
  }
169
167
  }
170
168
  catch (error) {
@@ -74,7 +74,7 @@ function makeOpenEyes({ core, spec, logger: mainLogger }) {
74
74
  getBaseEyes: (0, get_base_eyes_1.makeGetBaseEyes)({ settings, eyes, logger }),
75
75
  check: (0, check_1.makeCheck)({ eyes, target: driver, environments, spec, signal: controller.signal, logger }),
76
76
  checkAndClose: (0, check_and_close_1.makeCheckAndClose)({ eyes, target: driver, environments, spec, signal: controller.signal, logger }),
77
- close: (0, close_1.makeClose)({ eyes, target: driver, environments, logger }),
77
+ close: (0, close_1.makeClose)({ eyes, target: driver, environments, spec, logger }),
78
78
  abort: (0, abort_1.makeAbort)({ eyes, target: driver, environments, spec, controller, logger }),
79
79
  getResults: (0, get_results_1.makeGetResults)({ eyes, logger }),
80
80
  };
package/dist/core.js CHANGED
@@ -39,11 +39,14 @@ const make_manager_1 = require("./make-manager");
39
39
  const close_batch_1 = require("./close-batch");
40
40
  const delete_test_1 = require("./delete-test");
41
41
  const extract_test_environment_1 = require("./utils/extract-test-environment");
42
+ const validate_sdk_version_1 = require("./utils/validate-sdk-version");
42
43
  const utils = __importStar(require("@applitools/utils"));
43
44
  function makeCore({ spec, clients, concurrency, base: defaultBase, environment: defaultEnvironment, agentId = 'core', cwd = process.cwd(), logger: defaultLogger, asyncCache, } = {}) {
44
45
  const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core' } });
45
46
  const environment = (0, extract_test_environment_1.extractTestEnvironment)(defaultEnvironment);
46
47
  logger.log(`Core is initialized ${defaultBase ? 'with' : 'without'} custom base core and environment`, environment);
48
+ if (environment.sdk)
49
+ (0, validate_sdk_version_1.validateSdkVersion)(environment.sdk, { logger });
47
50
  const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, cwd, logger });
48
51
  return utils.general.extend(base, core => {
49
52
  return {
@@ -33,8 +33,9 @@ function makeGetEyesResults({ eyes, logger: mainLogger, }) {
33
33
  const results = await typedEyes.getResults({ settings, logger });
34
34
  if (settings === null || settings === void 0 ? void 0 : settings.throwErr) {
35
35
  results.forEach(result => {
36
+ var _a;
36
37
  if (result.status !== 'Passed')
37
- throw new test_error_1.TestError(result);
38
+ throw (_a = result === null || result === void 0 ? void 0 : result.reason) !== null && _a !== void 0 ? _a : new test_error_1.TestError(result);
38
39
  });
39
40
  }
40
41
  return results;
@@ -36,12 +36,15 @@ function makeGetManagerResults({ core, storage, logger: mainLogger, }) {
36
36
  try {
37
37
  const results = await eyes.getResults({ settings: { ...settings, throwErr: false }, logger });
38
38
  return promise.then(containers => {
39
- return containers.concat(results.map(result => ({
40
- result,
41
- error: result.status !== 'Passed' ? new test_error_1.TestError(result) : undefined,
42
- userTestId: result.userTestId,
43
- environment: result.environment,
44
- })));
39
+ return containers.concat(results.map(result => {
40
+ var _a;
41
+ return ({
42
+ result,
43
+ error: result.status !== 'Passed' ? (_a = result.reason) !== null && _a !== void 0 ? _a : new test_error_1.TestError(result) : undefined,
44
+ userTestId: result.userTestId,
45
+ environment: result.environment,
46
+ });
47
+ }));
45
48
  });
46
49
  }
47
50
  catch (error) {
package/dist/lang.js CHANGED
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.applitoolsLibConflictingCapabilitiesWarning = exports.requestedEnvironmentOutOfDriverBoundsWarning = exports.breakpointOutOfDriverBoundsWarning = exports.requestedEnvironmentSmallerThenBreakpointWarning = exports.edgeUfgEnvironmentDeprecatedWarning = exports.matchLevelContentDeprecatedWarning = void 0;
3
+ exports.applitoolsLibConflictingCapabilitiesWarning = exports.requestedEnvironmentOutOfDriverBoundsWarning = exports.breakpointOutOfDriverBoundsWarning = exports.requestedEnvironmentSmallerThenBreakpointWarning = exports.outdatedSdkVersionWarning = exports.edgeUfgEnvironmentDeprecatedWarning = exports.matchLevelContentDeprecatedWarning = void 0;
4
4
  exports.matchLevelContentDeprecatedWarning = `The "Content" match level value has been deprecated, use "IgnoreColors" instead.`;
5
5
  exports.edgeUfgEnvironmentDeprecatedWarning = `The 'edge' option that is being used in your browsers' configuration will soon be deprecated. Please change it to either 'edgelegacy' for the legacy version or to 'edgechromium' for the new Chromium-based version. Please note, when using the built-in BrowserType enum, then the values are BrowserType.EDGE_LEGACY and BrowserType.EDGE_CHROMIUM, respectively.`;
6
+ const outdatedSdkVersionWarning = (options) => {
7
+ return `You are using "${options.currentVersion}" and there is a newer version "${options.latestVersion}" of the "${options.name}" SDK.`;
8
+ };
9
+ exports.outdatedSdkVersionWarning = outdatedSdkVersionWarning;
6
10
  const requestedEnvironmentSmallerThenBreakpointWarning = (options) => {
7
11
  const browsers = options.browsers.map(({ name, width }) => `(${name}, ${width})`).join(', ');
8
12
  return `The following configuration's viewport-widths are smaller than the smallest configured layout breakpoint (${options.breakpoint} pixels): [${browsers}]. As a fallback, the resources that will be used for these configurations have been captured on a viewport-width of ${options.breakpoint} - 1 pixels. If an additional layout breakpoint is needed for you to achieve better results - please add it to your configuration.`;
package/dist/open-eyes.js CHANGED
@@ -56,16 +56,27 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, concurrency, bat
56
56
  (_r = settings.ignoreBaseline) !== null && _r !== void 0 ? _r : (settings.ignoreBaseline = false);
57
57
  (_s = settings.compareWithParentBranch) !== null && _s !== void 0 ? _s : (settings.compareWithParentBranch = false);
58
58
  const driver = target && (await (0, driver_1.makeDriver)({ spec, driver: target, logger, customConfig: settings }));
59
- const environments = (_t = config === null || config === void 0 ? void 0 : config.check) === null || _t === void 0 ? void 0 : _t.environments;
59
+ const driverEnvironment = await (driver === null || driver === void 0 ? void 0 : driver.getEnvironment());
60
+ const driverUrl = await (driver === null || driver === void 0 ? void 0 : driver.getDriverUrl());
60
61
  core.logEvent({
61
62
  settings: {
62
63
  ...settings,
63
64
  level: 'Notice',
64
65
  event: {
65
66
  type: 'openEyes',
66
- environment,
67
+ userTestId: settings.userTestId,
67
68
  concurrency,
68
- driverUrl: await (driver === null || driver === void 0 ? void 0 : driver.getDriverUrl()),
69
+ environment,
70
+ driver: {
71
+ deviceName: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.deviceName,
72
+ browserName: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.browserName,
73
+ browserVersion: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.browserVersion,
74
+ platformName: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.platformName,
75
+ platformVersion: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.platformVersion,
76
+ isApplitoolsLib: (_t = driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.applitoolsLib) === null || _t === void 0 ? void 0 : _t.instrumented,
77
+ isEC: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.isEC,
78
+ },
79
+ driverUrl,
69
80
  },
70
81
  },
71
82
  logger,
@@ -81,14 +92,17 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, concurrency, bat
81
92
  logger,
82
93
  });
83
94
  const eyes = await getTypedEyes({ logger });
84
- return utils.general.extend(eyes, eyes => ({
85
- getTypedEyes,
86
- check: (0, check_1.makeCheck)({ type, eyes, target: driver, spec, logger }),
87
- checkAndClose: (0, check_and_close_1.makeCheckAndClose)({ type, eyes, target: driver, spec, logger }),
88
- close: (0, close_1.makeClose)({ eyes, environments, logger }),
89
- abort: (0, abort_1.makeAbort)({ eyes, environments, logger }),
90
- getResults: (0, get_eyes_results_1.makeGetEyesResults)({ eyes, logger }),
91
- })); // TODO solve the types issue
95
+ return utils.general.extend(eyes, eyes => {
96
+ var _a, _b;
97
+ return ({
98
+ getTypedEyes,
99
+ check: (0, check_1.makeCheck)({ type, eyes, target: driver, spec, logger }),
100
+ checkAndClose: (0, check_and_close_1.makeCheckAndClose)({ type, eyes, target: driver, spec, logger }),
101
+ close: (0, close_1.makeClose)({ eyes, environments: (_a = config === null || config === void 0 ? void 0 : config.check) === null || _a === void 0 ? void 0 : _a.environments, logger }),
102
+ abort: (0, abort_1.makeAbort)({ eyes, environments: (_b = config === null || config === void 0 ? void 0 : config.check) === null || _b === void 0 ? void 0 : _b.environments, logger }),
103
+ getResults: (0, get_eyes_results_1.makeGetEyesResults)({ eyes, logger }),
104
+ });
105
+ }); // TODO solve the types issue
92
106
  };
93
107
  }
94
108
  exports.makeOpenEyes = makeOpenEyes;
@@ -226,9 +226,8 @@ function makeCheckAndClose({ eyes, target: defaultTarget, environments: defaultE
226
226
  }
227
227
  catch (error) {
228
228
  environmentLogger.error(`Render on environment with id "${(_h = baseEyes.test.environment) === null || _h === void 0 ? void 0 : _h.environmentId}" failed due to an error`, error);
229
- await baseEyes.abort({ logger: environmentLogger });
230
- error.info = { eyes: baseEyes };
231
- throw error;
229
+ if (baseEyes.running && !(signal === null || signal === void 0 ? void 0 : signal.aborted))
230
+ await baseEyes.abort({ logger: environmentLogger, settings: { reason: error } });
232
231
  }
233
232
  }
234
233
  catch (error) {
package/dist/ufg/check.js CHANGED
@@ -227,9 +227,7 @@ function makeCheck({ eyes, target: defaultTarget, environments: defaultEnvironme
227
227
  catch (error) {
228
228
  environmentLogger.error(`Render on environment with id "${(_h = baseEyes.test.environment) === null || _h === void 0 ? void 0 : _h.environmentId}" failed due to an error`, error);
229
229
  if (baseEyes.running && !(signal === null || signal === void 0 ? void 0 : signal.aborted))
230
- await baseEyes.abort({ logger: environmentLogger });
231
- error.info = { eyes: baseEyes };
232
- throw error;
230
+ await baseEyes.abort({ logger: environmentLogger, settings: { reason: error } });
233
231
  }
234
232
  }
235
233
  catch (error) {
@@ -14,7 +14,7 @@ const refer_1 = require("./refer");
14
14
  const history_1 = require("./history");
15
15
  const os_1 = __importDefault(require("os"));
16
16
  const path_1 = __importDefault(require("path"));
17
- async function makeCoreServer({ environment: defaultEnvironment, debug = false, shutdownMode = 'lazy', idleTimeout = 900000, // 15min
17
+ async function makeCoreServer({ environment: defaultEnvironment, agentIdPrefix = `eyes-universal/${require('../../package.json').version}`, debug = false, shutdownMode = 'lazy', idleTimeout = 900000, // 15min
18
18
  printStdout = false, isProcess = false, ...handlerOptions } = {}) {
19
19
  var _a, _b;
20
20
  const logDirname = (_a = process.env.APPLITOOLS_LOG_DIR) !== null && _a !== void 0 ? _a : path_1.default.resolve(os_1.default.tmpdir(), `applitools-logs`);
@@ -88,7 +88,7 @@ printStdout = false, isProcess = false, ...handlerOptions } = {}) {
88
88
  const corePromise = socket.wait('Core.makeCore', ({ spec, agentId, environment, cwd }) => {
89
89
  return (0, core_1.makeCore)({
90
90
  spec: spec === 'webdriver' ? spec_driver_webdriver_1.default : (0, spec_driver_1.makeSpec)({ socket, spec }),
91
- agentId: `eyes-universal/${require('../../package.json').version}/${agentId}`,
91
+ agentId: `${agentIdPrefix}/${agentId}`,
92
92
  cwd,
93
93
  environment: {
94
94
  ...defaultEnvironment,
@@ -143,7 +143,11 @@ printStdout = false, isProcess = false, ...handlerOptions } = {}) {
143
143
  return { url: client.url };
144
144
  });
145
145
  socket.command('Core.makeManager', async (options) => {
146
+ var _a;
146
147
  const core = await corePromise;
148
+ if ((_a = options.settings) === null || _a === void 0 ? void 0 : _a.agentId) {
149
+ options.settings.agentId = `${agentIdPrefix}/${options.settings.agentId}`;
150
+ }
147
151
  return refer.ref(await core.makeManager(options));
148
152
  });
149
153
  socket.command('EyesManager.openEyes', async ({ manager, ...options }) => {
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.extractLatestRubyPackageVersion = exports.extractLatestPythonPackageVersion = exports.extractLatestDotNetPackageVersion = exports.extractLatestJavaPackageVersion = exports.extractLatestJsPackageVersion = exports.validateSdkVersion = void 0;
30
+ const req_1 = require("@applitools/req");
31
+ const lt_1 = __importDefault(require("semver/functions/lt"));
32
+ const chalk_1 = __importDefault(require("chalk"));
33
+ const utils = __importStar(require("@applitools/utils"));
34
+ const lang = __importStar(require("../lang"));
35
+ const extractors = {
36
+ js: utils.general.cachify(extractLatestJsPackageVersion),
37
+ java: utils.general.cachify(extractLatestJavaPackageVersion),
38
+ dotnet: utils.general.cachify(extractLatestDotNetPackageVersion),
39
+ python: utils.general.cachify(extractLatestPythonPackageVersion),
40
+ ruby: utils.general.cachify(extractLatestRubyPackageVersion),
41
+ };
42
+ async function validateSdkVersion(sdk, { logger }) {
43
+ try {
44
+ if (!sdk.latestVersion) {
45
+ logger.log(`Extracting latest version of ${sdk.lang}/${sdk.name}`);
46
+ sdk.latestVersion = await extractors[sdk.lang](sdk.name);
47
+ }
48
+ logger.log(`Latest version of ${sdk.lang}/${sdk.name} is ${sdk.latestVersion}`);
49
+ if ((0, lt_1.default)(sdk.currentVersion, sdk.latestVersion)) {
50
+ const message = lang.outdatedSdkVersionWarning(sdk);
51
+ logger.console.warn(chalk_1.default.yellow(message));
52
+ logger.warn(message);
53
+ }
54
+ }
55
+ catch (error) {
56
+ logger.error(`Failed to extract latest version of ${sdk.lang}/${sdk.name} due to the error: `, error);
57
+ }
58
+ }
59
+ exports.validateSdkVersion = validateSdkVersion;
60
+ async function extractLatestJsPackageVersion(name) {
61
+ const response = await (0, req_1.req)(`https://registry.npmjs.org/${name}/latest`);
62
+ const info = await response.json();
63
+ return info.version;
64
+ }
65
+ exports.extractLatestJsPackageVersion = extractLatestJsPackageVersion;
66
+ async function extractLatestJavaPackageVersion(name) {
67
+ const response = await (0, req_1.req)(`https://search.maven.org/solrsearch/select?q=a:${name}&wt=json`);
68
+ const info = await response.json();
69
+ return info.response.docs[0].latestVersion;
70
+ }
71
+ exports.extractLatestJavaPackageVersion = extractLatestJavaPackageVersion;
72
+ async function extractLatestDotNetPackageVersion(name) {
73
+ const response = await (0, req_1.req)(`https://api.nuget.org/v3-flatcontainer/${name.toLowerCase()}/index.json`);
74
+ const info = await response.json();
75
+ return info.versions[info.versions.length - 1];
76
+ }
77
+ exports.extractLatestDotNetPackageVersion = extractLatestDotNetPackageVersion;
78
+ async function extractLatestPythonPackageVersion(name) {
79
+ const response = await (0, req_1.req)(`https://pypi.org/pypi/${name}/json`);
80
+ const info = await response.json();
81
+ return info.info.version;
82
+ }
83
+ exports.extractLatestPythonPackageVersion = extractLatestPythonPackageVersion;
84
+ async function extractLatestRubyPackageVersion(name) {
85
+ const response = await (0, req_1.req)(`https://rubygems.org/api/v1/gems/${name}.json`);
86
+ const info = await response.json();
87
+ return info.version;
88
+ }
89
+ exports.extractLatestRubyPackageVersion = extractLatestRubyPackageVersion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/core",
3
- "version": "4.1.0",
3
+ "version": "4.3.0",
4
4
  "homepage": "https://applitools.com",
5
5
  "bugs": {
6
6
  "url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
@@ -68,43 +68,45 @@
68
68
  }
69
69
  },
70
70
  "dependencies": {
71
- "@applitools/core-base": "1.7.2",
71
+ "@applitools/core-base": "1.7.4",
72
72
  "@applitools/dom-capture": "11.2.4",
73
- "@applitools/dom-snapshot": "4.7.13",
74
- "@applitools/driver": "1.15.0",
75
- "@applitools/ec-client": "1.7.15",
76
- "@applitools/logger": "2.0.12",
77
- "@applitools/nml-client": "1.5.15",
78
- "@applitools/req": "1.6.2",
79
- "@applitools/screenshoter": "3.8.15",
73
+ "@applitools/dom-snapshot": "4.7.14",
74
+ "@applitools/driver": "1.15.2",
75
+ "@applitools/ec-client": "1.7.17",
76
+ "@applitools/logger": "2.0.14",
77
+ "@applitools/nml-client": "1.5.17",
78
+ "@applitools/req": "1.6.4",
79
+ "@applitools/screenshoter": "3.8.17",
80
80
  "@applitools/snippets": "2.4.24",
81
- "@applitools/socket": "1.1.12",
82
- "@applitools/spec-driver-webdriver": "1.0.49",
83
- "@applitools/ufg-client": "1.9.7",
84
- "@applitools/utils": "1.6.2",
81
+ "@applitools/socket": "1.1.14",
82
+ "@applitools/spec-driver-webdriver": "1.0.51",
83
+ "@applitools/ufg-client": "1.9.9",
84
+ "@applitools/utils": "1.7.0",
85
85
  "@types/ws": "8.5.5",
86
86
  "abort-controller": "3.0.0",
87
87
  "chalk": "4.1.2",
88
88
  "node-fetch": "2.6.7",
89
+ "semver": "7.5.4",
89
90
  "webdriver": "7.31.1",
90
91
  "ws": "8.13.0",
91
92
  "yargs": "17.7.2"
92
93
  },
93
94
  "devDependencies": {
94
- "@applitools/bongo": "^5.7.4",
95
+ "@applitools/bongo": "^5.7.6",
95
96
  "@applitools/sea": "^1.0.0",
96
- "@applitools/spec-driver-puppeteer": "^1.2.5",
97
- "@applitools/spec-driver-selenium": "^1.5.63",
97
+ "@applitools/spec-driver-puppeteer": "^1.3.1",
98
+ "@applitools/spec-driver-selenium": "^1.5.65",
98
99
  "@applitools/test-server": "^1.2.2",
99
100
  "@applitools/test-utils": "^1.5.17",
100
- "@applitools/tunnel-client": "^1.3.0",
101
+ "@applitools/tunnel-client": "^1.3.2",
101
102
  "@types/node": "^12.20.55",
102
103
  "@types/selenium-webdriver": "^4.1.2",
104
+ "@types/semver": "^7.5.4",
103
105
  "@types/yargs": "^17.0.22",
104
106
  "nock": "^13.3.2",
105
107
  "png-async": "^0.9.4",
106
108
  "puppeteer": "^19.11.1",
107
- "selenium-webdriver": "4.4"
109
+ "selenium-webdriver": "^4.15.0"
108
110
  },
109
111
  "engines": {
110
112
  "node": ">=12.13.0"
package/types/lang.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  export declare const matchLevelContentDeprecatedWarning = "The \"Content\" match level value has been deprecated, use \"IgnoreColors\" instead.";
2
2
  export declare const edgeUfgEnvironmentDeprecatedWarning = "The 'edge' option that is being used in your browsers' configuration will soon be deprecated. Please change it to either 'edgelegacy' for the legacy version or to 'edgechromium' for the new Chromium-based version. Please note, when using the built-in BrowserType enum, then the values are BrowserType.EDGE_LEGACY and BrowserType.EDGE_CHROMIUM, respectively.";
3
+ export declare const outdatedSdkVersionWarning: (options: {
4
+ name: string;
5
+ currentVersion: string;
6
+ latestVersion: string;
7
+ }) => string;
3
8
  export declare const requestedEnvironmentSmallerThenBreakpointWarning: (options: {
4
9
  breakpoint: number;
5
10
  browsers: {
package/types/types.d.ts CHANGED
@@ -122,7 +122,7 @@ export type GetManagerResultsSettings<TType extends 'classic' | 'ufg'> = GetEyes
122
122
  };
123
123
  export type TestResult<TType extends 'classic' | 'ufg'> = TType extends 'ufg' ? UFGCore.TestResult : ClassicCore.TestResult;
124
124
  export interface TestResultContainer<TType extends 'classic' | 'ufg'> {
125
- readonly error?: Error;
125
+ readonly error?: unknown;
126
126
  readonly result?: TestResult<TType>;
127
127
  readonly environment: AutomationCore.ExactEnvironment;
128
128
  readonly userTestId?: string;
@@ -1,13 +1,14 @@
1
1
  import { type ServerOptions } from './ws-server';
2
2
  export type Options = ServerOptions & {
3
3
  environment?: Record<string, any>;
4
+ agentIdPrefix?: string;
4
5
  debug?: boolean;
5
6
  shutdownMode?: 'lazy' | 'stdin';
6
7
  idleTimeout?: number;
7
8
  printStdout?: boolean;
8
9
  isProcess?: boolean;
9
10
  };
10
- export declare function makeCoreServer({ environment: defaultEnvironment, debug, shutdownMode, idleTimeout, // 15min
11
+ export declare function makeCoreServer({ environment: defaultEnvironment, agentIdPrefix, debug, shutdownMode, idleTimeout, // 15min
11
12
  printStdout, isProcess, ...handlerOptions }?: Options): Promise<{
12
13
  port: number;
13
14
  close?: () => void;
@@ -0,0 +1,42 @@
1
+ import { type Logger } from '@applitools/logger';
2
+ declare const extractors: {
3
+ js: typeof extractLatestJsPackageVersion & {
4
+ getCachedValues(): Promise<string>[];
5
+ setCachedValue(key: any, value: Promise<string>): void;
6
+ clearCache(): void;
7
+ };
8
+ java: typeof extractLatestJavaPackageVersion & {
9
+ getCachedValues(): Promise<string>[];
10
+ setCachedValue(key: any, value: Promise<string>): void;
11
+ clearCache(): void;
12
+ };
13
+ dotnet: typeof extractLatestDotNetPackageVersion & {
14
+ getCachedValues(): Promise<string>[];
15
+ setCachedValue(key: any, value: Promise<string>): void;
16
+ clearCache(): void;
17
+ };
18
+ python: typeof extractLatestPythonPackageVersion & {
19
+ getCachedValues(): Promise<string>[];
20
+ setCachedValue(key: any, value: Promise<string>): void;
21
+ clearCache(): void;
22
+ };
23
+ ruby: typeof extractLatestRubyPackageVersion & {
24
+ getCachedValues(): Promise<string>[];
25
+ setCachedValue(key: any, value: Promise<string>): void;
26
+ clearCache(): void;
27
+ };
28
+ };
29
+ export declare function validateSdkVersion(sdk: {
30
+ lang: keyof typeof extractors;
31
+ name: string;
32
+ currentVersion: string;
33
+ latestVersion?: string;
34
+ }, { logger }: {
35
+ logger: Logger;
36
+ }): Promise<void>;
37
+ export declare function extractLatestJsPackageVersion(name: string): Promise<string>;
38
+ export declare function extractLatestJavaPackageVersion(name: string): Promise<string>;
39
+ export declare function extractLatestDotNetPackageVersion(name: string): Promise<string>;
40
+ export declare function extractLatestPythonPackageVersion(name: string): Promise<string>;
41
+ export declare function extractLatestRubyPackageVersion(name: string): Promise<string>;
42
+ export {};