@applitools/core 4.37.0-debug-20250430-1 → 4.37.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,34 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.37.1](https://github.com/Applitools-Dev/sdk/compare/js/core@4.37.0...js/core@4.37.1) (2025-04-29)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * handle slashes in branch name extraction from GITHUB_REF ([#2937](https://github.com/Applitools-Dev/sdk/issues/2937)) ([aa8bfa3](https://github.com/Applitools-Dev/sdk/commit/aa8bfa3118f43c52485362f729556acceea40ac6))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * @applitools/driver bumped to 1.21.2
14
+ #### Bug Fixes
15
+
16
+ * not properly detected platform if written with underscore | FLD-2892 ([#2934](https://github.com/Applitools-Dev/sdk/issues/2934)) ([5ca4eb9](https://github.com/Applitools-Dev/sdk/commit/5ca4eb9d952cb089b7b3678d0d6f242ac7f9dad5))
17
+ * @applitools/dom-snapshot bumped to 4.11.19
18
+
19
+ * @applitools/spec-driver-webdriver bumped to 1.2.3
20
+
21
+ * @applitools/spec-driver-selenium bumped to 1.5.99
22
+
23
+ * @applitools/spec-driver-puppeteer bumped to 1.4.28
24
+
25
+ * @applitools/screenshoter bumped to 3.11.2
26
+
27
+ * @applitools/nml-client bumped to 1.9.2
28
+
29
+ * @applitools/ec-client bumped to 1.10.10
30
+
31
+
3
32
  ## [4.37.0](https://github.com/Applitools-Dev/sdk/compare/js/core@4.36.0...js/core@4.37.0) (2025-04-17)
4
33
 
5
34
 
@@ -38,7 +38,6 @@ const utils = __importStar(require("@applitools/utils"));
38
38
  const merge_configs_1 = require("./merge-configs");
39
39
  const format_results_1 = require("../utils/format-results");
40
40
  const throat_1 = __importDefault(require("throat"));
41
- const throttledReadFile = (0, throat_1.default)(Number(process.env.APPLITOOLS_FILE_READING_CONCURRENCY) || 200, fs_1.default.promises.readFile);
42
41
  function getConsoleLogLimit() {
43
42
  var _a;
44
43
  return (_a = utils.general.getEnvValue('OFFLINE_LOG_LIMIT', 'number')) !== null && _a !== void 0 ? _a : 20;
@@ -128,97 +127,45 @@ async function runOfflineSnapshots(options) {
128
127
  const environment = await ufgClient.getActualEnvironment({
129
128
  settings: { environment: openSettings.environment.requested },
130
129
  });
131
- const closeSettings = await getCloseSettings(testPath);
132
- let resultsGetter;
133
- if (closeSettings) {
134
- const targets = await getCheckTargets(testPath, logger);
135
- const uploadResourcePromise = uploadResources(targets, logger).then(() => logger.log('uploaded resources for test', testPath));
136
- if (targets.length === 1) {
137
- logger.log('only one check found for test', testPath);
138
- await uploadResourcePromise;
139
- const target = targets[0];
140
- resultsGetter = await runOpenCheckAndClose({
141
- ...target,
142
- settings: {
143
- ...(0, merge_configs_1.mergeConfigs)((0, merge_configs_1.mergeConfigs)(closeSettings, openSettings), target.settings),
144
- ...account.eyesServer,
145
- environment: {
146
- ...openSettings.environment,
147
- ...target.settings.environment,
148
- },
149
- },
150
- }, logger, environment);
151
- logger.log('finished running checks for test', testPath);
152
- }
153
- else {
154
- const eyes = await openEyes(openSettings, environment, logger);
155
- logger.log('opened eyes for test', testPath);
156
- await uploadResourcePromise;
157
- const lastTarget = targets.pop();
158
- await Promise.all(targets.map((target, index) => runCheck(eyes, target, index, logger)));
159
- if (lastTarget) {
160
- lastTarget.settings = (0, merge_configs_1.mergeConfigs)(lastTarget.settings, closeSettings);
161
- await runCheckAndClose(eyes, lastTarget, targets.length - 1, logger);
162
- logger.log('finished running checks for test', testPath);
163
- }
164
- else {
165
- logger.log('no checks found for test', testPath);
166
- // on empty test, `checkAndClose` will not be called so we need to call `close` instead
167
- await eyes.close({ settings: closeSettings });
168
- }
169
- resultsGetter = eyes;
170
- }
171
- }
172
- else {
173
- logger.log('no close settings found for test - aborting test', testPath);
174
- resultsGetter = await makeAbortedTest(openSettings, environment, logger);
175
- }
176
- logger.log('done running test', testPath);
177
- return { batchId: openSettings.batch.id, results: (await resultsGetter.getResults({ logger }))[0] };
178
- }
179
- async function getCloseSettings(testPath) {
180
- const closeSettingsPath = path_1.default.resolve(testPath, 'close.json');
181
- if (fs_1.default.existsSync(closeSettingsPath)) {
182
- const fileCloseSettings = await throttledReadFile(closeSettingsPath, 'utf-8').then(JSON.parse);
183
- const closeSettings = (0, merge_configs_1.mergeConfigs)(fileCloseSettings, options.config.close);
184
- return closeSettings;
185
- }
186
- return undefined;
187
- }
188
- async function getCheckTargets(testPath, logger) {
189
- const checkFolders = (await fs_1.default.promises.readdir(testPath)).filter(folderpath => folderpath.startsWith('check-'));
190
- logger.log('check folders', checkFolders);
191
- const targets = await Promise.all(checkFolders.map(async (checkFolder) => {
192
- const snapshot = await fs_1.default.promises
193
- .readFile(path_1.default.resolve(testPath, checkFolder, 'snapshot.json'), 'utf-8')
194
- .then(JSON.parse);
195
- snapshot.settings.environment.environmentId = utils.general.guid();
196
- return snapshot;
197
- }));
198
- return targets;
199
- }
200
- async function makeAbortedTest(openSettings, environment, logger) {
201
- const eyes = await openEyes(openSettings, environment, logger);
202
- await eyes.abort({
203
- settings: {
204
- reason: 'internal',
205
- },
206
- });
207
- return eyes;
208
- }
209
- async function openEyes(settings, environment, logger) {
210
130
  const eyes = await core.base.openEyes({
211
131
  settings: {
212
- ...settings,
132
+ ...openSettings,
213
133
  environment: {
214
- ...settings.environment,
134
+ ...openSettings.environment,
215
135
  ...environment,
216
136
  },
217
137
  ...account.eyesServer,
218
138
  },
219
139
  logger,
220
140
  });
221
- return eyes;
141
+ const closeSettingsPath = path_1.default.resolve(testPath, 'close.json');
142
+ if (fs_1.default.existsSync(closeSettingsPath)) {
143
+ const checkFolders = (await fs_1.default.promises.readdir(testPath)).filter(folderpath => folderpath.startsWith('check-'));
144
+ logger.log('running checks for test', testPath, ':', checkFolders);
145
+ const targets = await Promise.all(checkFolders.map(async (checkFolder) => {
146
+ const snapshot = await fs_1.default.promises
147
+ .readFile(path_1.default.resolve(testPath, checkFolder, 'snapshot.json'), 'utf-8')
148
+ .then(JSON.parse);
149
+ snapshot.settings.environment.environmentId = utils.general.guid();
150
+ return snapshot;
151
+ }));
152
+ await uploadResources(targets, logger);
153
+ // logger.log('resource hashes for test', testFolder, ':', resourceHashes)
154
+ logger.log('uploaded resources for test', testPath);
155
+ await Promise.all(targets.map((target, index) => runCheck(eyes, target, index, logger)));
156
+ const fileCloseSettings = await fs_1.default.promises.readFile(closeSettingsPath, 'utf-8').then(JSON.parse);
157
+ const closeSettings = (0, merge_configs_1.mergeConfigs)(fileCloseSettings, options.config.close);
158
+ await eyes.close({ settings: closeSettings });
159
+ }
160
+ else {
161
+ await eyes.abort({
162
+ settings: {
163
+ reason: 'internal',
164
+ },
165
+ });
166
+ }
167
+ logger.log('done running test', testPath);
168
+ return { batchId: openSettings.batch.id, results: (await eyes.getResults({ logger }))[0] };
222
169
  }
223
170
  async function uploadResources(targets, logger) {
224
171
  const uploadLogger = logger.extend({ tags: ['upload-resources'] });
@@ -229,7 +176,7 @@ async function runOfflineSnapshots(options) {
229
176
  const contentfuleResource = {
230
177
  id: '',
231
178
  url: '',
232
- value: await throttledReadFile(path_1.default.join(offlineLocationPath, 'resources', resource.hash)),
179
+ value: await fs_1.default.promises.readFile(path_1.default.join(offlineLocationPath, 'resources', resource.hash)),
233
180
  contentType: resource.contentType,
234
181
  hash: resource,
235
182
  };
@@ -239,7 +186,7 @@ async function runOfflineSnapshots(options) {
239
186
  resource: {
240
187
  id: '',
241
188
  url: '',
242
- value: await throttledReadFile(path_1.default.join(offlineLocationPath, 'resources', target.snapshot.hash)),
189
+ value: await fs_1.default.promises.readFile(path_1.default.join(offlineLocationPath, 'resources', target.snapshot.hash)),
243
190
  contentType: target.snapshot.contentType,
244
191
  hash: target.snapshot,
245
192
  },
@@ -255,53 +202,6 @@ async function runOfflineSnapshots(options) {
255
202
  async function runCheck(eyes, target, index, logger) {
256
203
  var _a;
257
204
  const checkLogger = logger.extend({ tags: [`check-${index}`] });
258
- const { mergedCheckSettings, baseTarget } = await render(target, checkLogger);
259
- (_a = mergedCheckSettings.stepIndex) !== null && _a !== void 0 ? _a : (mergedCheckSettings.stepIndex = index);
260
- await eyes.check({
261
- target: { ...baseTarget, isTransformed: true },
262
- settings: mergedCheckSettings,
263
- logger: checkLogger,
264
- });
265
- logger.log('check finished', mergedCheckSettings);
266
- return eyes;
267
- }
268
- async function runCheckAndClose(eyes, target, index, logger) {
269
- var _a;
270
- const checkLogger = logger.extend({ tags: [`check-${index}`] });
271
- const { mergedCheckSettings, baseTarget } = await render(target, checkLogger);
272
- (_a = mergedCheckSettings.stepIndex) !== null && _a !== void 0 ? _a : (mergedCheckSettings.stepIndex = index);
273
- await eyes.checkAndClose({
274
- target: { ...baseTarget, isTransformed: true },
275
- settings: mergedCheckSettings,
276
- logger: checkLogger,
277
- });
278
- logger.log('checkAndClose finished', mergedCheckSettings);
279
- return eyes;
280
- }
281
- async function runOpenCheckAndClose(target, logger, actualEnvironment) {
282
- const checkLogger = logger.extend({ tags: ['open-check-and-close'] });
283
- const { mergedCheckSettings, baseTarget } = await render(target, checkLogger);
284
- const settings = (0, merge_configs_1.mergeConfigs)(target.settings, mergedCheckSettings);
285
- return core.base.openCheckAndCloseEyes({
286
- target: { ...baseTarget, isTransformed: true },
287
- settings: {
288
- ...settings,
289
- environment: {
290
- ...settings.environment,
291
- ...actualEnvironment,
292
- },
293
- },
294
- logger: checkLogger,
295
- heartbeat: {
296
- processId: '',
297
- startPeriodicHeartbeatMessaging(settings) {
298
- logger.log('heartbeat is not used (offline)', settings);
299
- },
300
- },
301
- });
302
- }
303
- async function render(target, logger) {
304
- var _a;
305
205
  const { elementReferences: selectors, getBaseCheckSettings } = (0, to_base_check_settings_1.toBaseCheckSettings)({
306
206
  settings: target.settings,
307
207
  });
@@ -317,7 +217,7 @@ async function runOfflineSnapshots(options) {
317
217
  uploadUrl: account.uploadUrl,
318
218
  stitchingServiceUrl: account.stitchingServiceUrl,
319
219
  },
320
- logger,
220
+ logger: checkLogger,
321
221
  });
322
222
  const baseSettings = getBaseCheckSettings({
323
223
  calculatedRegions: selectors.calculate.map((_, index) => {
@@ -328,11 +228,15 @@ async function runOfflineSnapshots(options) {
328
228
  }),
329
229
  });
330
230
  baseSettings.renderId = renderId;
331
- // baseSettings.stepIndex = index
231
+ baseSettings.stepIndex = index;
332
232
  baseTarget.source = target.target.source; // TODO verify
333
233
  // baseTarget.name = snapshot.title // TODO figure out
334
234
  const mergedCheckSettings = (0, merge_configs_1.mergeConfigs)(baseSettings, options.config.check);
335
- return { mergedCheckSettings, baseTarget };
235
+ await eyes.check({
236
+ target: { ...baseTarget, isTransformed: true },
237
+ settings: mergedCheckSettings,
238
+ logger: checkLogger,
239
+ });
336
240
  }
337
241
  }
338
242
  exports.runOfflineSnapshots = runOfflineSnapshots;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/core",
3
- "version": "4.37.0-debug-20250430-1",
3
+ "version": "4.37.1",
4
4
  "homepage": "https://applitools.com",
5
5
  "bugs": {
6
6
  "url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
@@ -75,18 +75,18 @@
75
75
  }
76
76
  },
77
77
  "dependencies": {
78
- "@applitools/core-base": "1.24.0-debug-20250429-1",
78
+ "@applitools/core-base": "1.24.0",
79
79
  "@applitools/dom-capture": "11.5.5",
80
- "@applitools/dom-snapshot": "4.11.18",
81
- "@applitools/driver": "1.21.1",
82
- "@applitools/ec-client": "1.10.9",
80
+ "@applitools/dom-snapshot": "4.11.19",
81
+ "@applitools/driver": "1.21.2",
82
+ "@applitools/ec-client": "1.10.10",
83
83
  "@applitools/logger": "2.1.2",
84
- "@applitools/nml-client": "1.9.1",
84
+ "@applitools/nml-client": "1.9.2",
85
85
  "@applitools/req": "1.7.10",
86
- "@applitools/screenshoter": "3.11.1",
86
+ "@applitools/screenshoter": "3.11.2",
87
87
  "@applitools/snippets": "2.6.5",
88
88
  "@applitools/socket": "1.2.3",
89
- "@applitools/spec-driver-webdriver": "1.2.2",
89
+ "@applitools/spec-driver-webdriver": "1.2.3",
90
90
  "@applitools/ufg-client": "1.16.9",
91
91
  "@applitools/utils": "1.8.0",
92
92
  "@types/ws": "8.5.5",
@@ -102,8 +102,8 @@
102
102
  "devDependencies": {
103
103
  "@applitools/bongo": "^5.10.0",
104
104
  "@applitools/sea": "^1.0.0",
105
- "@applitools/spec-driver-puppeteer": "^1.4.27",
106
- "@applitools/spec-driver-selenium": "^1.5.98",
105
+ "@applitools/spec-driver-puppeteer": "^1.4.28",
106
+ "@applitools/spec-driver-selenium": "^1.5.99",
107
107
  "@applitools/test-server": "^1.2.2",
108
108
  "@applitools/test-utils": "^1.5.17",
109
109
  "@applitools/tunnel-client": "^1.6.5",
@@ -1 +1 @@
1
- export declare function mergeConfigs<TBase extends Record<string, any>, TBase2 extends Record<string, any>>(base: TBase, other: TBase2): TBase & TBase2;
1
+ export declare function mergeConfigs<TBase extends Record<string, any>>(base: TBase, other: Record<string, any>): TBase;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TestError = void 0;
4
- const core_base_1 = require("@applitools/core-base");
5
- class TestError extends core_base_1.CoreError {
6
- constructor(result) {
7
- if (result.status === 'Failed') {
8
- super(`Test '${result.name}' of '${result.appName}' is failed! See details at ${result.url}`, {
9
- reason: 'test failed',
10
- result,
11
- });
12
- }
13
- else if (result.status === 'Unresolved') {
14
- if (result.isNew) {
15
- super(`Test '${result.name}' of '${result.appName}' is new! Please approve the new baseline at ${result.url}`, {
16
- reason: 'test new',
17
- result,
18
- });
19
- }
20
- else {
21
- super(`Test '${result.name}' of '${result.appName}' detected differences! See details at: ${result.url}`, {
22
- reason: 'test different',
23
- result,
24
- });
25
- }
26
- }
27
- else {
28
- super('');
29
- }
30
- }
31
- }
32
- exports.TestError = TestError;
@@ -1,5 +0,0 @@
1
- import type { TestResult } from '@applitools/core-base';
2
- import { CoreError } from '@applitools/core-base';
3
- export declare class TestError extends CoreError {
4
- constructor(result: TestResult);
5
- }