@applitools/core 4.16.5 → 4.18.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,202 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.18.0](https://github.com/Applitools-Dev/sdk/compare/js/core@4.17.0...js/core@4.18.0) (2024-07-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * disable broker url cache ([#2428](https://github.com/Applitools-Dev/sdk/issues/2428)) ([cb8d5fe](https://github.com/Applitools-Dev/sdk/commit/cb8d5fefb13d3ab42984d2bd4d4ac3d4e10646b0))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * @applitools/driver bumped to 1.18.0
14
+ #### Features
15
+
16
+ * disable broker url cache ([#2428](https://github.com/Applitools-Dev/sdk/issues/2428)) ([cb8d5fe](https://github.com/Applitools-Dev/sdk/commit/cb8d5fefb13d3ab42984d2bd4d4ac3d4e10646b0))
17
+
18
+
19
+ #### Bug Fixes
20
+
21
+ * executing web script on mobile environment ([#2380](https://github.com/Applitools-Dev/sdk/issues/2380)) ([da2e551](https://github.com/Applitools-Dev/sdk/commit/da2e551e01082d3cc21b9da5b43e6680233c080d))
22
+ * @applitools/spec-driver-puppeteer bumped to 1.4.11
23
+
24
+ * @applitools/ufg-client bumped to 1.12.3
25
+ #### Bug Fixes
26
+
27
+ * update makeUploadResource to include apiKey in the cache key ([#2411](https://github.com/Applitools-Dev/sdk/issues/2411)) ([4114c58](https://github.com/Applitools-Dev/sdk/commit/4114c58ec16fa855374b23810cef1e36d4bb53a7))
28
+
29
+
30
+ #### Performance Improvements
31
+
32
+ * trim file content when logging it ([#2437](https://github.com/Applitools-Dev/sdk/issues/2437)) ([02ec1f7](https://github.com/Applitools-Dev/sdk/commit/02ec1f79a323af2e89a7428b75212707c761d1ca))
33
+ * @applitools/spec-driver-webdriver bumped to 1.1.11
34
+
35
+ * @applitools/spec-driver-selenium bumped to 1.5.82
36
+
37
+ * @applitools/screenshoter bumped to 3.8.35
38
+
39
+ * @applitools/nml-client bumped to 1.8.9
40
+
41
+ * @applitools/ec-client bumped to 1.9.3
42
+
43
+
44
+ ## [4.17.0](https://github.com/Applitools-Dev/sdk/compare/js/core@4.16.5...js/core@4.17.0) (2024-06-26)
45
+
46
+
47
+ ### Features
48
+
49
+ * tell the backend if `remove duplicate tests` is used ([#2373](https://github.com/Applitools-Dev/sdk/issues/2373)) ([fe59b40](https://github.com/Applitools-Dev/sdk/commit/fe59b404ad163c595bb329d9a24ef2191d3bf170))
50
+
51
+
52
+ ### Bug Fixes
53
+
54
+ * change core ([d12a246](https://github.com/Applitools-Dev/sdk/commit/d12a246723cf72def6335e8698e711a43bda9e6a))
55
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
56
+
57
+
58
+ ### Dependencies
59
+
60
+ * @applitools/utils bumped to 1.7.4
61
+ #### Bug Fixes
62
+
63
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
64
+ * @applitools/logger bumped to 2.0.18
65
+ #### Bug Fixes
66
+
67
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
68
+
69
+
70
+
71
+ * @applitools/socket bumped to 1.1.18
72
+ #### Bug Fixes
73
+
74
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
75
+
76
+
77
+
78
+ * @applitools/req bumped to 1.7.2
79
+ #### Bug Fixes
80
+
81
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
82
+
83
+
84
+
85
+ * @applitools/image bumped to 1.1.13
86
+ #### Bug Fixes
87
+
88
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
89
+
90
+
91
+
92
+ * @applitools/snippets bumped to 2.4.27
93
+ #### Bug Fixes
94
+
95
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
96
+ * @applitools/css-tree bumped to 1.1.4
97
+ #### Bug Fixes
98
+
99
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
100
+ * @applitools/dom-shared bumped to 1.0.15
101
+ #### Bug Fixes
102
+
103
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
104
+ * @applitools/dom-capture bumped to 11.3.0
105
+ #### Features
106
+
107
+ * add cliet rects to text nodes ([#2188](https://github.com/Applitools-Dev/sdk/issues/2188)) ([0d4180e](https://github.com/Applitools-Dev/sdk/commit/0d4180e8e362669b36a27955121caae5575918f7))
108
+ * add cursor and pointer-events to dom-capture ([#2369](https://github.com/Applitools-Dev/sdk/issues/2369)) ([efdce02](https://github.com/Applitools-Dev/sdk/commit/efdce028a2a6fb18ad3c6237f2020c1ff00e90de))
109
+
110
+
111
+ #### Bug Fixes
112
+
113
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
114
+
115
+
116
+
117
+ * @applitools/dom-snapshot bumped to 4.11.3
118
+ #### Bug Fixes
119
+
120
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
121
+
122
+
123
+
124
+ * @applitools/spec-driver-webdriver bumped to 1.1.10
125
+ #### Bug Fixes
126
+
127
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
128
+
129
+
130
+
131
+ * @applitools/spec-driver-selenium bumped to 1.5.81
132
+ #### Bug Fixes
133
+
134
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
135
+
136
+
137
+
138
+ * @applitools/spec-driver-puppeteer bumped to 1.4.10
139
+ #### Bug Fixes
140
+
141
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
142
+
143
+
144
+
145
+ * @applitools/driver bumped to 1.17.5
146
+ #### Bug Fixes
147
+
148
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
149
+
150
+
151
+
152
+ * @applitools/screenshoter bumped to 3.8.34
153
+ #### Bug Fixes
154
+
155
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
156
+
157
+
158
+
159
+ * @applitools/nml-client bumped to 1.8.8
160
+ #### Bug Fixes
161
+
162
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
163
+
164
+
165
+
166
+ * @applitools/tunnel-client bumped to 1.5.7
167
+ #### Bug Fixes
168
+
169
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
170
+
171
+
172
+
173
+ * @applitools/ufg-client bumped to 1.12.2
174
+ #### Bug Fixes
175
+
176
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
177
+
178
+
179
+
180
+ * @applitools/ec-client bumped to 1.9.2
181
+ #### Bug Fixes
182
+
183
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
184
+
185
+
186
+
187
+ * @applitools/core-base bumped to 1.16.0
188
+ #### Features
189
+
190
+ * tell the backend if `remove duplicate tests` is used ([#2373](https://github.com/Applitools-Dev/sdk/issues/2373)) ([fe59b40](https://github.com/Applitools-Dev/sdk/commit/fe59b404ad163c595bb329d9a24ef2191d3bf170))
191
+
192
+
193
+ #### Bug Fixes
194
+
195
+ * tunnel client ([670b184](https://github.com/Applitools-Dev/sdk/commit/670b1843ce43347d97e19fa02f8bc630332ff414))
196
+
197
+
198
+
199
+
3
200
  ## [4.16.5](https://github.com/Applitools-Dev/sdk/compare/js/core@4.16.4...js/core@4.16.5) (2024-06-16)
4
201
 
5
202
 
@@ -4,12 +4,16 @@ exports.makeGetNMLClient = void 0;
4
4
  const nml_client_1 = require("@applitools/nml-client");
5
5
  const clients = new Map();
6
6
  function makeGetNMLClient({ client, logger: mainLogger }) {
7
- return async function getNMLClient({ driver, settings, logger, }) {
7
+ return {
8
+ getNMLClient,
9
+ clearNMLClientCache,
10
+ };
11
+ async function getNMLClient({ driver, settings, logger, }) {
8
12
  if (client)
9
13
  return client;
10
14
  logger = logger.extend(mainLogger);
11
15
  const { sessionId } = await driver.getDriverInfo();
12
- const cacheKey = sessionId ? JSON.stringify({ sessionId, settings }) : JSON.stringify({ guid: driver.guid, settings });
16
+ const cacheKey = sessionId !== null && sessionId !== void 0 ? sessionId : driver.guid;
13
17
  const clientFromCache = clients.get(cacheKey);
14
18
  if (clientFromCache) {
15
19
  return clientFromCache;
@@ -22,6 +26,11 @@ function makeGetNMLClient({ client, logger: mainLogger }) {
22
26
  clients.set(cacheKey, nmlClient);
23
27
  return nmlClient;
24
28
  }
25
- };
29
+ }
30
+ async function clearNMLClientCache(driver) {
31
+ const { sessionId } = await driver.getDriverInfo();
32
+ const cacheKey = sessionId !== null && sessionId !== void 0 ? sessionId : driver.guid;
33
+ clients.delete(cacheKey);
34
+ }
26
35
  }
27
36
  exports.makeGetNMLClient = makeGetNMLClient;
@@ -47,7 +47,7 @@ function makeCore({ spec, clients, base: defaultBase, concurrency, agentId = 'co
47
47
  locate: (0, locate_1.makeLocate)({ spec, core, logger }),
48
48
  locateText: (0, locate_text_1.makeLocateText)({ spec, core, logger }),
49
49
  extractText: (0, extract_text_1.makeExtractText)({ spec, core, logger }),
50
- getNMLClient: (0, get_nml_client_1.makeGetNMLClient)({ client: clients === null || clients === void 0 ? void 0 : clients.nml, logger }),
50
+ ...(0, get_nml_client_1.makeGetNMLClient)({ client: clients === null || clients === void 0 ? void 0 : clients.nml, logger }),
51
51
  openEyes: (0, open_eyes_1.makeOpenEyes)({ spec, core, logger }),
52
52
  };
53
53
  });
package/dist/cli/cli.js CHANGED
@@ -31,6 +31,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
31
31
  const core_server_1 = require("../universal/core-server");
32
32
  const core_server_process_1 = require("../universal/core-server-process");
33
33
  const logs_1 = require("../troubleshoot/logs");
34
+ const check_network_1 = require("../troubleshoot/check-network");
34
35
  const yargs_1 = __importDefault(require("yargs"));
35
36
  const utils = __importStar(require("@applitools/utils"));
36
37
  yargs_1.default
@@ -142,5 +143,11 @@ yargs_1.default
142
143
  console.log(JSON.stringify(logs, null, 2));
143
144
  }
144
145
  },
146
+ })
147
+ .command({
148
+ command: 'check-network',
149
+ handler: async () => {
150
+ await (0, check_network_1.checkNetwork)();
151
+ },
145
152
  })
146
153
  .wrap(yargs_1.default.terminalWidth()).argv;
package/dist/core.js CHANGED
@@ -48,7 +48,7 @@ function makeCore({ spec, clients, base: defaultBase, concurrency = utils.genera
48
48
  const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core' } });
49
49
  (0, memory_usage_logging_1.startMemoryUsageLogging)({ logger });
50
50
  const environment = (0, extract_test_environment_1.extractTestEnvironment)(defaultEnvironment);
51
- logger.log(`Core is initialized ${defaultBase ? 'with' : 'without'} custom base core and environment`, environment);
51
+ logger.log(`Core is initialized ${defaultBase ? 'with' : 'without'} custom base core and environment `, environment);
52
52
  if (environment.sdk)
53
53
  (0, validate_sdk_version_1.validateSdkVersion)(environment.sdk, { logger });
54
54
  const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, concurrency, cwd, logger });
@@ -61,7 +61,7 @@ function makeCore({ spec, clients, base: defaultBase, concurrency = utils.genera
61
61
  base: base,
62
62
  getViewportSize: spec && (0, get_viewport_size_1.makeGetViewportSize)({ spec, logger }),
63
63
  setViewportSize: spec && (0, set_viewport_size_1.makeSetViewportSize)({ spec, logger }),
64
- getNMLClient: (0, get_nml_client_1.makeGetNMLClient)({ client: clients === null || clients === void 0 ? void 0 : clients.nml, logger }),
64
+ ...(0, get_nml_client_1.makeGetNMLClient)({ client: clients === null || clients === void 0 ? void 0 : clients.nml, logger }),
65
65
  getECClient: (0, get_ec_client_1.makeGetECClient)({ logger }),
66
66
  getAccountInfo: (0, get_account_info_1.makeGetAccountInfo)({ core, logger }),
67
67
  // Note: `defaultBase` is passesd for `base`, and `cores` is not passed here on purpose, so that a manager will create its own base, which would apply the correct concurrency value that was passed to the manager.
@@ -60,14 +60,20 @@ function makeGetManagerResults({ core, storage, logger: mainLogger, }) {
60
60
  else {
61
61
  await Promise.all(duplicateContainers.map(async (container) => {
62
62
  if (container.result) {
63
- await core.deleteTest({
64
- settings: {
65
- ...container.result.eyesServer,
66
- testId: container.result.id,
67
- batchId: container.result.batchId,
68
- secretToken: container.result.secretToken,
69
- },
70
- });
63
+ // the server will also delete the test if it's a duplicate, so in newer server versions it's a redundancy and that's ok if it fails
64
+ try {
65
+ await core.deleteTest({
66
+ settings: {
67
+ ...container.result.eyesServer,
68
+ testId: container.result.id,
69
+ batchId: container.result.batchId,
70
+ secretToken: container.result.secretToken,
71
+ },
72
+ });
73
+ }
74
+ catch (err) {
75
+ logger.log('Did not delete duplicate test', { testId: container.result.id, error: err });
76
+ }
71
77
  }
72
78
  }));
73
79
  logger.log('Done cleaning up duplicate tests!');
@@ -53,7 +53,18 @@ function makeMakeManager({ spec, clients, core, base: defaultBase, agentId: defa
53
53
  return base.concurrency;
54
54
  },
55
55
  base,
56
- openEyes: utils.general.wrap((0, open_eyes_1.makeOpenEyes)({ type, clients, batch: settings.batch, spec, core, cores, environment, asyncCache, logger }), async (openEyes, options) => {
56
+ openEyes: utils.general.wrap((0, open_eyes_1.makeOpenEyes)({
57
+ type,
58
+ clients,
59
+ batch: settings.batch,
60
+ removeDuplicateTests: settings.removeDuplicateTests,
61
+ spec,
62
+ core,
63
+ cores,
64
+ environment,
65
+ asyncCache,
66
+ logger,
67
+ }), async (openEyes, options) => {
57
68
  const eyes = await openEyes(options);
58
69
  storage.push(eyes);
59
70
  return eyes;
package/dist/open-eyes.js CHANGED
@@ -35,20 +35,20 @@ const abort_1 = require("./abort");
35
35
  const get_eyes_results_1 = require("./get-eyes-results");
36
36
  const populate_eyes_server_settings_1 = require("./utils/populate-eyes-server-settings");
37
37
  const utils = __importStar(require("@applitools/utils"));
38
- function makeOpenEyes({ type: defaultType = 'classic', clients, batch, core, cores, spec, environment, logger: mainLogger, asyncCache, }) {
38
+ function makeOpenEyes({ type: defaultType = 'classic', clients, batch, removeDuplicateTests, core, cores, spec, environment, logger: mainLogger, asyncCache, }) {
39
39
  return async function openEyes({ type = defaultType, settings, config, target, logger = mainLogger, }) {
40
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
41
- var _u, _v, _w, _x, _y;
40
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
41
+ var _v, _w, _x, _y, _z;
42
42
  logger = logger.extend(mainLogger, { tags: [`eyes-${type}-${utils.general.shortid()}`] });
43
43
  settings = { ...config === null || config === void 0 ? void 0 : config.open, ...settings };
44
44
  (0, populate_eyes_server_settings_1.populateEyesServerSettings)(settings);
45
45
  (_a = settings.userTestId) !== null && _a !== void 0 ? _a : (settings.userTestId = `${settings.testName}--${utils.general.guid()}`);
46
46
  settings.batch = { ...batch, ...settings.batch };
47
- (_b = (_u = settings.batch).id) !== null && _b !== void 0 ? _b : (_u.id = (_c = utils.general.getEnvValue('BATCH_ID')) !== null && _c !== void 0 ? _c : `generated-${utils.general.guid()}`);
48
- (_d = (_v = settings.batch).buildId) !== null && _d !== void 0 ? _d : (_v.buildId = utils.general.getEnvValue('BATCH_BUILD_ID'));
49
- (_e = (_w = settings.batch).name) !== null && _e !== void 0 ? _e : (_w.name = utils.general.getEnvValue('BATCH_NAME'));
50
- (_f = (_x = settings.batch).sequenceName) !== null && _f !== void 0 ? _f : (_x.sequenceName = utils.general.getEnvValue('BATCH_SEQUENCE'));
51
- (_g = (_y = settings.batch).notifyOnCompletion) !== null && _g !== void 0 ? _g : (_y.notifyOnCompletion = utils.general.getEnvValue('BATCH_NOTIFY', 'boolean'));
47
+ (_b = (_v = settings.batch).id) !== null && _b !== void 0 ? _b : (_v.id = (_c = utils.general.getEnvValue('BATCH_ID')) !== null && _c !== void 0 ? _c : `generated-${utils.general.guid()}`);
48
+ (_d = (_w = settings.batch).buildId) !== null && _d !== void 0 ? _d : (_w.buildId = utils.general.getEnvValue('BATCH_BUILD_ID'));
49
+ (_e = (_x = settings.batch).name) !== null && _e !== void 0 ? _e : (_x.name = utils.general.getEnvValue('BATCH_NAME'));
50
+ (_f = (_y = settings.batch).sequenceName) !== null && _f !== void 0 ? _f : (_y.sequenceName = utils.general.getEnvValue('BATCH_SEQUENCE'));
51
+ (_g = (_z = settings.batch).notifyOnCompletion) !== null && _g !== void 0 ? _g : (_z.notifyOnCompletion = utils.general.getEnvValue('BATCH_NOTIFY', 'boolean'));
52
52
  (_h = settings.keepBatchOpen) !== null && _h !== void 0 ? _h : (settings.keepBatchOpen = utils.general.getEnvValue('DONT_CLOSE_BATCHES', 'boolean'));
53
53
  (_j = settings.branchName) !== null && _j !== void 0 ? _j : (settings.branchName = utils.general.getEnvValue('BRANCH'));
54
54
  (_k = settings.parentBranchName) !== null && _k !== void 0 ? _k : (settings.parentBranchName = utils.general.getEnvValue('PARENT_BRANCH'));
@@ -58,6 +58,7 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, batch, core, cor
58
58
  (_p = settings.ufgServerUrl) !== null && _p !== void 0 ? _p : (settings.ufgServerUrl = utils.general.getEnvValue('UFG_SERVER_URL'));
59
59
  (_q = settings.ignoreBaseline) !== null && _q !== void 0 ? _q : (settings.ignoreBaseline = false);
60
60
  (_r = settings.compareWithParentBranch) !== null && _r !== void 0 ? _r : (settings.compareWithParentBranch = false);
61
+ (_s = settings.removeDuplicateTests) !== null && _s !== void 0 ? _s : (settings.removeDuplicateTests = removeDuplicateTests);
61
62
  const driver = target && (await (0, driver_1.makeDriver)({ spec, driver: target, logger, customConfig: settings }));
62
63
  const driverEnvironment = await (driver === null || driver === void 0 ? void 0 : driver.getEnvironment());
63
64
  const driverUrl = await (driver === null || driver === void 0 ? void 0 : driver.getDriverUrl());
@@ -68,7 +69,7 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, batch, core, cor
68
69
  event: {
69
70
  type: 'openEyes',
70
71
  userTestId: settings.userTestId,
71
- concurrency: (_s = cores === null || cores === void 0 ? void 0 : cores[type].concurrency) !== null && _s !== void 0 ? _s : core.concurrency,
72
+ concurrency: (_t = cores === null || cores === void 0 ? void 0 : cores[type].concurrency) !== null && _t !== void 0 ? _t : core.concurrency,
72
73
  environment,
73
74
  driver: {
74
75
  deviceName: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.deviceName,
@@ -76,7 +77,7 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, batch, core, cor
76
77
  browserVersion: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.browserVersion,
77
78
  platformName: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.platformName,
78
79
  platformVersion: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.platformVersion,
79
- isApplitoolsLib: (_t = driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.applitoolsLib) === null || _t === void 0 ? void 0 : _t.instrumented,
80
+ isApplitoolsLib: (_u = driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.applitoolsLib) === null || _u === void 0 ? void 0 : _u.instrumented,
80
81
  isEC: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.isEC,
81
82
  },
82
83
  driverUrl,
@@ -84,6 +85,9 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, batch, core, cor
84
85
  },
85
86
  logger,
86
87
  });
88
+ if (settings.disableBrokerUrlCache && driver) {
89
+ await core.clearNMLClientCache(driver);
90
+ }
87
91
  const getTypedEyes = (0, get_typed_eyes_1.makeGetTypedEyes)({
88
92
  type,
89
93
  settings: settings,
@@ -65,9 +65,11 @@ async function checkNetwork({ stream = process.stdout, eyes = eyes_1.default, uf
65
65
  const proxyMsg = '\nYour proxy seems to be blocking requests to Applitools. Please make sure the following command succeeds:';
66
66
  if (curlRenderErr) {
67
67
  printErr(proxyMsg, '\n', eyes.cmd, '\n');
68
+ throw new Error('Your proxy seems to be blocking requests to Applitools.');
68
69
  }
69
70
  else if (curlVgErr) {
70
71
  printErr(proxyMsg, '\n', await ufg.getCmd());
72
+ throw new Error('Your proxy seems to be blocking requests to Applitools.');
71
73
  }
72
74
  async function doTest(func, name) {
73
75
  const delimiterLength = 30 - name.length;
@@ -111,4 +113,6 @@ async function checkNetwork({ stream = process.stdout, eyes = eyes_1.default, uf
111
113
  }
112
114
  }
113
115
  exports.checkNetwork = checkNetwork;
114
- checkNetwork();
116
+ if (require.main === module) {
117
+ checkNetwork();
118
+ }
@@ -40,7 +40,7 @@ const validateRawAccountInfo = (res) => {
40
40
  }
41
41
  };
42
42
  const validateAccountInfo = (res) => {
43
- if (!res || !res.ufg || !res.ufg.accessToken || !res.uploadUrl) {
43
+ if (!res || !res.ufgServer || !res.ufgServer.accessToken || !res.uploadUrl) {
44
44
  throw new Error(`bad render info result ${JSON.stringify(res)}`);
45
45
  }
46
46
  };
@@ -59,7 +59,7 @@ exports.default = {
59
59
  },
60
60
  async testServer() {
61
61
  const server = (0, core_base_1.makeCoreRequestsWithCache)();
62
- const result = await server.getAccountInfo({ settings: utils_1.config });
62
+ const result = await server.getAccountInfo({ settings: { eyesServerUrl: utils_1.config.serverUrl, ...utils_1.config } });
63
63
  validateAccountInfo(result);
64
64
  },
65
65
  testHttps: async () => {
@@ -35,13 +35,15 @@ const utils_1 = require("./utils");
35
35
  const eyes_1 = require("./eyes");
36
36
  const utils = __importStar(require("@applitools/utils"));
37
37
  const node_fetch_1 = __importDefault(require("node-fetch"));
38
- const value = new TextEncoder().encode(JSON.stringify({ resources: {}, domNodes: [] }));
39
- const hash = (0, crypto_1.createHash)('sha256').update(value).digest('hex');
38
+ const rawValue = JSON.stringify({ resources: {}, domNodes: [] });
39
+ const encodedValue = new TextEncoder().encode(rawValue);
40
+ const hash = (0, crypto_1.createHash)('sha256').update(encodedValue).digest('hex');
40
41
  const contentType = 'x-applitools-html/cdt';
41
42
  const resource = {
42
43
  id: 'id',
43
44
  url: 'https://localhost:2107',
44
- value,
45
+ value: encodedValue,
46
+ rawValue: rawValue,
45
47
  hash: { hashFormat: 'sha256', hash, contentType },
46
48
  contentType,
47
49
  };
@@ -55,7 +57,7 @@ const accessTokenPromise = new Promise(async (resolve) => {
55
57
  throw new Error('could not receive auth token since cURL command to get it failed.');
56
58
  resolve(accessToken);
57
59
  });
58
- const getCmd = async () => `curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: ${await accessTokenPromise}" -d '${resource.value}' ${UFG_PUT_RESOURCE_URL} ${(0, utils_1.getProxyCurlArg)()}`;
60
+ const getCmd = async () => `curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: ${await accessTokenPromise}" -d '${resource.rawValue}' ${UFG_PUT_RESOURCE_URL} ${(0, utils_1.getProxyCurlArg)()}`;
59
61
  exports.getCmd = getCmd;
60
62
  const validateVgResult = (res, sha) => {
61
63
  if (!res || res.hash !== sha) {
package/dist/ufg/core.js CHANGED
@@ -51,7 +51,7 @@ function makeCore({ spec, clients, base: defaultBase, asyncCache, concurrency, f
51
51
  locateText: (0, locate_text_1.makeLocateText)({ spec, core, logger }),
52
52
  extractText: (0, extract_text_1.makeExtractText)({ spec, core, logger }),
53
53
  getUFGClient: (0, get_ufg_client_1.makeGetUFGClient)({ client: clients === null || clients === void 0 ? void 0 : clients.ufg, fetchConcurrency, asyncCache, logger }),
54
- getNMLClient: (0, get_nml_client_1.makeGetNMLClient)({ client: clients === null || clients === void 0 ? void 0 : clients.nml, logger }),
54
+ ...(0, get_nml_client_1.makeGetNMLClient)({ client: clients === null || clients === void 0 ? void 0 : clients.nml, logger }),
55
55
  openEyes: (0, open_eyes_1.makeOpenEyes)({ spec, core, logger }),
56
56
  };
57
57
  });
@@ -50,6 +50,9 @@ function makeCore(options) {
50
50
  // TODO
51
51
  return null;
52
52
  },
53
+ async clearNMLClientCache(_driver) {
54
+ return null;
55
+ },
53
56
  async getECClient(options) {
54
57
  const socket = await socketPromise;
55
58
  return socket.request('Core.makeECClient', options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/core",
3
- "version": "4.16.5",
3
+ "version": "4.18.0",
4
4
  "homepage": "https://applitools.com",
5
5
  "bugs": {
6
6
  "url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
@@ -42,12 +42,12 @@
42
42
  ],
43
43
  "scripts": {
44
44
  "lint": "run --top-level eslint '**/*.ts'",
45
- "build": "yarn build:dist",
45
+ "build": "yarn build:dist && yarn build:bin",
46
+ "build:short": "yarn build:dist",
46
47
  "build:dist": "run --top-level tsc --project ./tsconfig.build.json",
47
48
  "build:bin": "sea",
48
49
  "build:bin:zip": "zip -j ./bin/core.zip $(find ./bin -type f -not -name '*.zip' -not -name '*.tar.gz' | xargs)",
49
50
  "build:bin:tgz": "tar -czf ./bin/core.tar.gz $(find ./bin -type f -not -name '*.zip' -not -name '*.tar.gz' | xargs)",
50
- "build:full": "yarn build:dist && yarn build:bin",
51
51
  "test": "run --top-level mocha './test/**/*.spec.ts' --exclude './test/bin/**' --parallel --jobs ${MOCHA_JOBS:-15} --exit",
52
52
  "test:local": "MOCHA_OMIT_TAGS=sauce run test",
53
53
  "test:sauce": "MOCHA_ONLY_TAGS=sauce run test",
@@ -74,40 +74,40 @@
74
74
  }
75
75
  },
76
76
  "dependencies": {
77
- "@applitools/core-base": "1.15.2",
78
- "@applitools/dom-capture": "11.2.8",
79
- "@applitools/dom-snapshot": "4.11.2",
80
- "@applitools/driver": "1.17.4",
81
- "@applitools/ec-client": "1.9.1",
82
- "@applitools/logger": "2.0.17",
83
- "@applitools/nml-client": "1.8.7",
84
- "@applitools/req": "1.7.1",
85
- "@applitools/screenshoter": "3.8.33",
86
- "@applitools/snippets": "2.4.26",
87
- "@applitools/socket": "1.1.17",
88
- "@applitools/spec-driver-webdriver": "1.1.9",
89
- "@applitools/ufg-client": "1.12.1",
90
- "@applitools/utils": "1.7.3",
77
+ "@applitools/core-base": "1.16.0",
78
+ "@applitools/dom-capture": "11.3.0",
79
+ "@applitools/dom-snapshot": "4.11.3",
80
+ "@applitools/driver": "1.18.0",
81
+ "@applitools/ec-client": "1.9.3",
82
+ "@applitools/logger": "2.0.18",
83
+ "@applitools/nml-client": "1.8.9",
84
+ "@applitools/req": "1.7.2",
85
+ "@applitools/screenshoter": "3.8.35",
86
+ "@applitools/snippets": "2.4.27",
87
+ "@applitools/socket": "1.1.18",
88
+ "@applitools/spec-driver-webdriver": "1.1.11",
89
+ "@applitools/ufg-client": "1.12.3",
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
- "semver": "7.5.4",
95
+ "semver": "7.6.2",
96
96
  "webdriver": "7.31.1",
97
- "ws": "8.13.0",
97
+ "ws": "8.17.1",
98
98
  "yargs": "17.7.2"
99
99
  },
100
100
  "devDependencies": {
101
101
  "@applitools/bongo": "^5.10.0",
102
102
  "@applitools/sea": "^1.0.0",
103
- "@applitools/spec-driver-puppeteer": "^1.4.9",
104
- "@applitools/spec-driver-selenium": "^1.5.80",
103
+ "@applitools/spec-driver-puppeteer": "^1.4.11",
104
+ "@applitools/spec-driver-selenium": "^1.5.82",
105
105
  "@applitools/test-server": "^1.2.2",
106
106
  "@applitools/test-utils": "^1.5.17",
107
- "@applitools/tunnel-client": "^1.5.6",
107
+ "@applitools/tunnel-client": "^1.5.7",
108
108
  "@types/node": "^12.20.55",
109
109
  "@types/selenium-webdriver": "^4.1.2",
110
- "@types/semver": "^7.5.4",
110
+ "@types/semver": "^7.5.8",
111
111
  "@types/yargs": "^17.0.22",
112
112
  "nock": "^13.3.2",
113
113
  "png-async": "^0.9.4",
@@ -5,9 +5,12 @@ type Options = {
5
5
  client?: NMLClient;
6
6
  logger: Logger;
7
7
  };
8
- export declare function makeGetNMLClient({ client, logger: mainLogger }: Options): ({ driver, settings, logger, }: {
9
- driver: Driver<SpecType>;
10
- settings: Omit<NMLClientSettings, 'brokerUrl'>;
11
- logger: Logger;
12
- }) => Promise<NMLClient>;
8
+ export declare function makeGetNMLClient({ client, logger: mainLogger }: Options): {
9
+ getNMLClient: ({ driver, settings, logger, }: {
10
+ driver: Driver<SpecType>;
11
+ settings: Omit<NMLClientSettings, 'brokerUrl'>;
12
+ logger: Logger;
13
+ }) => Promise<NMLClient>;
14
+ clearNMLClientCache: (driver: Driver<SpecType>) => Promise<void>;
15
+ };
13
16
  export {};
@@ -62,6 +62,7 @@ export interface Core<TSpec extends SpecType> extends Omit<BaseCore.Core, 'openE
62
62
  driver: Driver<TSpec>;
63
63
  logger: Logger;
64
64
  }): Promise<NMLClient>;
65
+ clearNMLClientCache(driver: Driver<TSpec>): Promise<void>;
65
66
  openEyes(options: {
66
67
  target?: DriverTarget<TSpec>;
67
68
  settings: BaseCore.OpenSettings;
@@ -163,3 +164,6 @@ export type AbortSettings = BaseCore.AbortSettings & {
163
164
  export type TestResult = BaseCore.TestResult & {
164
165
  readonly environment: ExactEnvironment;
165
166
  };
167
+ export type OpenSettings = BaseCore.OpenSettings & {
168
+ disableBrokerUrlCache?: boolean;
169
+ };
@@ -10,6 +10,7 @@ type Options<TSpec extends SpecType, TType extends 'classic' | 'ufg'> = {
10
10
  nml?: NMLClient;
11
11
  };
12
12
  batch?: Batch;
13
+ removeDuplicateTests?: boolean;
13
14
  core: Core<TSpec, TType>;
14
15
  cores?: {
15
16
  [TKey in 'classic' | 'ufg']: TypedCore<TSpec, TKey>;
@@ -19,7 +20,7 @@ type Options<TSpec extends SpecType, TType extends 'classic' | 'ufg'> = {
19
20
  logger: Logger;
20
21
  asyncCache?: AsyncCache;
21
22
  };
22
- export declare function makeOpenEyes<TSpec extends SpecType, TDefaultType extends 'classic' | 'ufg' = 'classic'>({ type: defaultType, clients, batch, core, cores, spec, environment, logger: mainLogger, asyncCache, }: Options<TSpec, TDefaultType>): <TType extends "classic" | "ufg" = TDefaultType>({ type, settings, config, target, logger, }: {
23
+ export declare function makeOpenEyes<TSpec extends SpecType, TDefaultType extends 'classic' | 'ufg' = 'classic'>({ type: defaultType, clients, batch, removeDuplicateTests, core, cores, spec, environment, logger: mainLogger, asyncCache, }: Options<TSpec, TDefaultType>): <TType extends "classic" | "ufg" = TDefaultType>({ type, settings, config, target, logger, }: {
23
24
  type?: TType | undefined;
24
25
  settings?: Partial<OpenSettings<TDefaultType> & OpenSettings<TType>> | undefined;
25
26
  config?: (Config<TSpec, TDefaultType> & Config<TSpec, TType>) | undefined;
package/types/types.d.ts CHANGED
@@ -105,6 +105,7 @@ export interface ManagerSettings {
105
105
  legacyConcurrency?: number;
106
106
  batch?: AutomationCore.Batch;
107
107
  agentId?: string;
108
+ removeDuplicateTests?: boolean;
108
109
  }
109
110
  export type Config<TSpec extends SpecType, TType extends 'classic' | 'ufg'> = {
110
111
  open: Partial<Omit<OpenSettings<TType>, 'userCommandId'>>;