@applitools/core 4.20.0 → 4.20.2

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,57 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.20.2](https://github.com/Applitools-Dev/sdk/compare/js/core@4.20.1...js/core@4.20.2) (2024-10-03)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * cache key for offline execution ([#2552](https://github.com/Applitools-Dev/sdk/issues/2552)) ([d0d1138](https://github.com/Applitools-Dev/sdk/commit/d0d11386be0f82c9e59e753bd0dc97aa3b05d93e))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * @applitools/driver bumped to 1.19.2
14
+ #### Bug Fixes
15
+
16
+ * cache key for offline execution ([#2552](https://github.com/Applitools-Dev/sdk/issues/2552)) ([d0d1138](https://github.com/Applitools-Dev/sdk/commit/d0d11386be0f82c9e59e753bd0dc97aa3b05d93e))
17
+ * @applitools/spec-driver-selenium bumped to 1.5.85
18
+
19
+ * @applitools/spec-driver-puppeteer bumped to 1.4.14
20
+
21
+ * @applitools/ufg-client bumped to 1.13.1
22
+ #### Bug Fixes
23
+
24
+ * cache key for offline execution ([#2552](https://github.com/Applitools-Dev/sdk/issues/2552)) ([d0d1138](https://github.com/Applitools-Dev/sdk/commit/d0d11386be0f82c9e59e753bd0dc97aa3b05d93e))
25
+ * @applitools/spec-driver-webdriver bumped to 1.1.14
26
+
27
+ * @applitools/screenshoter bumped to 3.8.38
28
+
29
+ * @applitools/nml-client bumped to 1.8.12
30
+
31
+ * @applitools/core-base bumped to 1.17.2
32
+ #### Bug Fixes
33
+
34
+ * cache key for offline execution ([#2552](https://github.com/Applitools-Dev/sdk/issues/2552)) ([d0d1138](https://github.com/Applitools-Dev/sdk/commit/d0d11386be0f82c9e59e753bd0dc97aa3b05d93e))
35
+ * @applitools/ec-client bumped to 1.9.8
36
+
37
+
38
+ ## [4.20.1](https://github.com/Applitools-Dev/sdk/compare/js/core@4.20.0...js/core@4.20.1) (2024-10-01)
39
+
40
+
41
+ ### Bug Fixes
42
+
43
+ * don't tar with offline ([#2550](https://github.com/Applitools-Dev/sdk/issues/2550)) ([d8b1a83](https://github.com/Applitools-Dev/sdk/commit/d8b1a833d13b01f5306501772e1c831692512360))
44
+
45
+
46
+ ### Dependencies
47
+
48
+ * @applitools/core-base bumped to 1.17.1
49
+ #### Bug Fixes
50
+
51
+ * don't tar with offline ([#2550](https://github.com/Applitools-Dev/sdk/issues/2550)) ([d8b1a83](https://github.com/Applitools-Dev/sdk/commit/d8b1a833d13b01f5306501772e1c831692512360))
52
+ * @applitools/ec-client bumped to 1.9.7
53
+
54
+
3
55
  ## [4.20.0](https://github.com/Applitools-Dev/sdk/compare/js/core@4.19.0...js/core@4.20.0) (2024-09-30)
4
56
 
5
57
 
package/dist/cli/cli.js CHANGED
@@ -161,6 +161,11 @@ yargs_1.default
161
161
  description: 'path to offline snapshots folder',
162
162
  type: 'string',
163
163
  },
164
+ failOnDiff: {
165
+ description: 'should exit process with non-zero exit code, thereby failing the CI job',
166
+ type: 'boolean',
167
+ default: false,
168
+ },
164
169
  })
165
170
  .fail((_msg, err, _yargs) => {
166
171
  if (err) {
package/dist/core.js CHANGED
@@ -49,10 +49,10 @@ function makeCore({ spec, clients, base: defaultBase, concurrency = utils.genera
49
49
  const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core' } });
50
50
  (0, memory_usage_logging_1.startMemoryUsageLogging)({ logger });
51
51
  const environment = (0, extract_test_environment_1.extractTestEnvironment)(defaultEnvironment);
52
- logger.log(`Core is initialized ${defaultBase ? 'with' : 'without'} custom base core and environment `, environment);
52
+ const offlineLocationPath = (0, ensure_offline_folder_1.ensureOfflineFolder)();
53
+ logger.log(`[pid=${process.pid} Core is initialized ${defaultBase ? 'with' : 'without'} custom base core ${offlineLocationPath ? `and offline location ${offlineLocationPath} ` : ''}and environment `, environment);
53
54
  if (environment.sdk)
54
55
  (0, validate_sdk_version_1.validateSdkVersion)(environment.sdk, { logger });
55
- const offlineLocationPath = (0, ensure_offline_folder_1.ensureOfflineFolder)();
56
56
  const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, concurrency, cwd, logger, offlineLocationPath });
57
57
  const cores = {
58
58
  ufg: (0, core_2.makeCore)({ spec, clients, base, asyncCache, logger, offlineLocationPath }),
@@ -29,7 +29,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.runOfflineSnapshots = void 0;
30
30
  const fs_1 = __importDefault(require("fs"));
31
31
  const path_1 = __importDefault(require("path"));
32
- const tar = __importStar(require("tar"));
33
32
  const core_1 = require("./core");
34
33
  const get_ufg_client_1 = require("./ufg/get-ufg-client");
35
34
  const logger_1 = require("@applitools/logger");
@@ -46,36 +45,29 @@ async function runOfflineSnapshots(options) {
46
45
  const ufgClient = await (0, get_ufg_client_1.makeGetUFGClient)({ logger })({
47
46
  settings: { ...account.eyesServer, ...account.ufgServer },
48
47
  });
49
- const executionFiles = (await fs_1.default.promises.readdir(options.offlineLocationPath)).filter(filename => filename.endsWith('.tar.gz'));
50
- if (executionFiles.length === 1) {
51
- logger.console.log(`Running execution ${executionFiles[0]} from folder ${path_1.default.resolve(options.offlineLocationPath)}`);
48
+ const executionFolders = (await fs_1.default.promises.readdir(options.offlineLocationPath)).filter(filename => /execution\-\d+/.test(filename));
49
+ if (executionFolders.length === 1) {
50
+ logger.console.log(`Running execution ${executionFolders[0]} from folder ${path_1.default.resolve(options.offlineLocationPath)}`);
52
51
  }
53
- else if (executionFiles.length === 0) {
52
+ else if (executionFolders.length === 0) {
54
53
  logger.console.log('No execution artifacts were found at', options.offlineLocationPath);
55
54
  }
56
55
  else {
57
- logger.console.log(`Running the following executions from folder ${options.offlineLocationPath} :\n ${executionFiles.join('\n ')}`);
56
+ logger.console.log(`Running the following executions from folder ${options.offlineLocationPath} :\n ${executionFolders.join('\n ')}`);
58
57
  }
59
- if (executionFiles.length === 0) {
58
+ if (executionFolders.length === 0) {
60
59
  throw new Error(`Unable to find offline executions in ${options.offlineLocationPath}`);
61
60
  }
62
- const allTestResults = (await Promise.all(executionFiles.map(runExecution))).flat();
63
- const { exitCode, outputStr } = processResults({ testResults: allTestResults, totalTime: Date.now() - startTime });
64
- if (exitCode) {
61
+ const allTestResults = (await Promise.all(executionFolders.map(runExecution))).flat();
62
+ const { isSuccess, outputStr } = processResults({ testResults: allTestResults, totalTime: Date.now() - startTime });
63
+ if (!isSuccess && options.failOnDiff) {
65
64
  throw new Error(outputStr);
66
65
  }
67
66
  else {
68
67
  logger.console.log(outputStr);
69
68
  }
70
- async function runExecution(executionFile) {
71
- const executionName = executionFile.replace('.tar.gz', '');
69
+ async function runExecution(executionName) {
72
70
  const executionLogger = logger.extend({ tags: [executionName] });
73
- executionLogger.log('unpacking execution', executionFile);
74
- await tar.extract({
75
- file: path_1.default.resolve(options.offlineLocationPath, executionFile),
76
- gzip: true,
77
- C: options.offlineLocationPath,
78
- });
79
71
  const executionPath = path_1.default.resolve(options.offlineLocationPath, executionName);
80
72
  executionLogger.log('handling execution', executionPath);
81
73
  const testFolders = (await fs_1.default.promises.readdir(executionPath)).filter(foldername => foldername.startsWith('test-'));
@@ -95,7 +87,7 @@ async function runOfflineSnapshots(options) {
95
87
  // @ts-expect-error // we use node v12 types, therefore it's not aware of the existence of `fs.promises.rm`
96
88
  await fs_1.default.promises.rm(executionPath, { recursive: true });
97
89
  await core.closeBatch({ settings: batchIds.map(batchId => ({ batchId, ...account.eyesServer })) });
98
- executionLogger.log('one execution', executionFile);
90
+ executionLogger.log('done execution', executionName);
99
91
  return allTestResults;
100
92
  }
101
93
  async function runTest(executionPath, testPath, openSettings, logger) {
@@ -280,19 +272,19 @@ function processResults({ testResults, totalTime, saveNewTests = true, failOnDif
280
272
  // if (Number(testConcurrency) === 5) {
281
273
  // outputStr += `\n${concurrencyMsg}\n`
282
274
  // }
283
- let exitCode;
275
+ let isSuccess;
284
276
  if (errors.length) {
285
- exitCode = 1;
277
+ isSuccess = false;
286
278
  }
287
279
  else if (failOnDiff) {
288
- exitCode = !warnForUnsavedNewTests && passedOrNew.length && !unresolvedOrFailed.length ? 0 : 1;
280
+ isSuccess = !warnForUnsavedNewTests && passedOrNew.length && !unresolvedOrFailed.length;
289
281
  }
290
282
  else {
291
- exitCode = 0;
283
+ isSuccess = true;
292
284
  }
293
285
  return {
294
286
  outputStr,
295
- exitCode,
287
+ isSuccess,
296
288
  };
297
289
  }
298
290
  function testResultsOutput(results, warnForUnsavedNewTests) {
@@ -29,7 +29,7 @@ const utils = __importStar(require("@applitools/utils"));
29
29
  function makeGetUFGClient({ client, fetchConcurrency, offlineLocationPath, logger: mainLogger, asyncCache, }) {
30
30
  // we are caching by the server config, therefor if the user creates another Runner / manager with the same server config but different
31
31
  // fetchConcurrency, it will not take any affect.
32
- const getUFGClientWithCache = utils.general.cachify(getUFGClient, ([options]) => client ? 'default' : [{ ...options.settings, fetchConcurrency: undefined }]);
32
+ const getUFGClientWithCache = utils.general.cachify(getUFGClient, ([options]) => client ? 'default' : [{ ...options.settings, fetchConcurrency: undefined, offlineLocationPath }]);
33
33
  if (client)
34
34
  getUFGClientWithCache.setCachedValue('default', Promise.resolve(client));
35
35
  return getUFGClientWithCache;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/core",
3
- "version": "4.20.0",
3
+ "version": "4.20.2",
4
4
  "homepage": "https://applitools.com",
5
5
  "bugs": {
6
6
  "url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
@@ -74,26 +74,25 @@
74
74
  }
75
75
  },
76
76
  "dependencies": {
77
- "@applitools/core-base": "1.17.0",
77
+ "@applitools/core-base": "1.17.2",
78
78
  "@applitools/dom-capture": "11.5.0",
79
79
  "@applitools/dom-snapshot": "4.11.3",
80
- "@applitools/driver": "1.19.1",
81
- "@applitools/ec-client": "1.9.6",
80
+ "@applitools/driver": "1.19.2",
81
+ "@applitools/ec-client": "1.9.8",
82
82
  "@applitools/logger": "2.0.18",
83
- "@applitools/nml-client": "1.8.11",
83
+ "@applitools/nml-client": "1.8.12",
84
84
  "@applitools/req": "1.7.2",
85
- "@applitools/screenshoter": "3.8.37",
85
+ "@applitools/screenshoter": "3.8.38",
86
86
  "@applitools/snippets": "2.5.0",
87
87
  "@applitools/socket": "1.1.18",
88
- "@applitools/spec-driver-webdriver": "1.1.13",
89
- "@applitools/ufg-client": "1.13.0",
88
+ "@applitools/spec-driver-webdriver": "1.1.14",
89
+ "@applitools/ufg-client": "1.13.1",
90
90
  "@applitools/utils": "1.7.4",
91
91
  "@types/ws": "8.5.5",
92
92
  "abort-controller": "3.0.0",
93
93
  "chalk": "4.1.2",
94
94
  "node-fetch": "2.6.7",
95
95
  "semver": "7.6.2",
96
- "tar": "7.4.3",
97
96
  "webdriver": "7.31.1",
98
97
  "ws": "8.17.1",
99
98
  "yargs": "17.7.2"
@@ -101,8 +100,8 @@
101
100
  "devDependencies": {
102
101
  "@applitools/bongo": "^5.10.0",
103
102
  "@applitools/sea": "^1.0.0",
104
- "@applitools/spec-driver-puppeteer": "^1.4.13",
105
- "@applitools/spec-driver-selenium": "^1.5.84",
103
+ "@applitools/spec-driver-puppeteer": "^1.4.14",
104
+ "@applitools/spec-driver-selenium": "^1.5.85",
106
105
  "@applitools/test-server": "^1.2.2",
107
106
  "@applitools/test-utils": "^1.5.17",
108
107
  "@applitools/tunnel-client": "^1.5.8",
@@ -1,5 +1,6 @@
1
1
  import { type EyesServerSettings } from './types';
2
2
  export type OfflineSnapshotsSettings = EyesServerSettings & {
3
3
  offlineLocationPath: string;
4
+ failOnDiff: boolean;
4
5
  };
5
6
  export declare function runOfflineSnapshots(options: OfflineSnapshotsSettings): Promise<void>;