@applitools/core 4.16.1 → 4.16.3

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,56 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.16.3](https://github.com/Applitools-Dev/sdk/compare/js/core@4.16.2...js/core@4.16.3) (2024-06-11)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * cache nml client per driver session ([#2368](https://github.com/Applitools-Dev/sdk/issues/2368)) ([5840389](https://github.com/Applitools-Dev/sdk/commit/5840389f74111c0e0e68026389c755c59a027b74))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * @applitools/spec-driver-webdriver bumped to 1.1.9
14
+
15
+ * @applitools/spec-driver-selenium bumped to 1.5.80
16
+
17
+ * @applitools/spec-driver-puppeteer bumped to 1.4.9
18
+
19
+ * @applitools/driver bumped to 1.17.4
20
+ #### Bug Fixes
21
+
22
+ * cache nml client per driver session ([#2368](https://github.com/Applitools-Dev/sdk/issues/2368)) ([5840389](https://github.com/Applitools-Dev/sdk/commit/5840389f74111c0e0e68026389c755c59a027b74))
23
+ * @applitools/screenshoter bumped to 3.8.33
24
+
25
+ * @applitools/nml-client bumped to 1.8.7
26
+
27
+ * @applitools/ec-client bumped to 1.8.9
28
+ #### Bug Fixes
29
+
30
+ * shadow dom self healing ([#2375](https://github.com/Applitools-Dev/sdk/issues/2375)) ([4d3a88c](https://github.com/Applitools-Dev/sdk/commit/4d3a88cbc3e05c3dd317afbb5de8d677368c346d))
31
+
32
+
33
+
34
+
35
+ ## [4.16.2](https://github.com/Applitools-Dev/sdk/compare/js/core@4.16.1...js/core@4.16.2) (2024-06-01)
36
+
37
+
38
+ ### Bug Fixes
39
+
40
+ * trigger ([1da3548](https://github.com/Applitools-Dev/sdk/commit/1da35489ccb0340706c9d226154da0b80f298dfa))
41
+ * trigger core release ([33551bc](https://github.com/Applitools-Dev/sdk/commit/33551bc5ff20eb18716060388afab349c6860c42))
42
+ * trigger js/core, dotnet and java release ([5f520f7](https://github.com/Applitools-Dev/sdk/commit/5f520f7f8f48b33a7ef065aa9cbda8fc2fc0971f))
43
+
44
+
45
+ ### Dependencies
46
+
47
+ * @applitools/ec-client bumped to 1.8.8
48
+
49
+ * @applitools/core-base bumped to 1.15.2
50
+ #### Bug Fixes
51
+
52
+ * send proper request body to checkAndClose endpoint ([c6524bf](https://github.com/Applitools-Dev/sdk/commit/c6524bfd0f621f6943ff8a08de1148ce92d6c650))
53
+
3
54
  ## [4.16.1](https://github.com/Applitools-Dev/sdk/compare/js/core@4.16.0...js/core@4.16.1) (2024-05-28)
4
55
 
5
56
 
@@ -1,42 +1,27 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
3
  exports.makeGetNMLClient = void 0;
27
4
  const nml_client_1 = require("@applitools/nml-client");
28
- const utils = __importStar(require("@applitools/utils"));
5
+ const clients = new Map();
29
6
  function makeGetNMLClient({ client, logger: mainLogger }) {
30
- const getNMLClientWithCache = utils.general.cachify(getNMLClient, ([options]) => client ? 'default' : [options.driver.guid, options.settings]);
31
- if (client)
32
- getNMLClientWithCache.setCachedValue('default', Promise.resolve(client));
33
- return getNMLClientWithCache;
34
- async function getNMLClient({ driver, settings, logger = mainLogger, }) {
7
+ return async function getNMLClient({ driver, settings, logger, }) {
8
+ if (client)
9
+ return client;
35
10
  logger = logger.extend(mainLogger);
36
- const brokerUrl = await driver.extractBrokerUrl();
37
- if (!brokerUrl)
38
- throw new Error('Unable to extract broker url from the device');
39
- return (0, nml_client_1.makeNMLClient)({ settings: { brokerUrl, ...settings }, logger });
40
- }
11
+ const { sessionId } = await driver.getDriverInfo();
12
+ const cacheKey = sessionId ? JSON.stringify({ sessionId, settings }) : JSON.stringify({ guid: driver.guid, settings });
13
+ const clientFromCache = clients.get(cacheKey);
14
+ if (clientFromCache) {
15
+ return clientFromCache;
16
+ }
17
+ else {
18
+ const brokerUrl = await driver.extractBrokerUrl();
19
+ if (!brokerUrl)
20
+ throw new Error('Unable to extract broker url from the device');
21
+ const nmlClient = (0, nml_client_1.makeNMLClient)({ settings: { brokerUrl, ...settings }, logger });
22
+ clients.set(cacheKey, nmlClient);
23
+ return nmlClient;
24
+ }
25
+ };
41
26
  }
42
27
  exports.makeGetNMLClient = makeGetNMLClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/core",
3
- "version": "4.16.1",
3
+ "version": "4.16.3",
4
4
  "homepage": "https://applitools.com",
5
5
  "bugs": {
6
6
  "url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
@@ -74,18 +74,18 @@
74
74
  }
75
75
  },
76
76
  "dependencies": {
77
- "@applitools/core-base": "1.15.1",
77
+ "@applitools/core-base": "1.15.2",
78
78
  "@applitools/dom-capture": "11.2.8",
79
79
  "@applitools/dom-snapshot": "4.11.2",
80
- "@applitools/driver": "1.17.3",
81
- "@applitools/ec-client": "1.8.7",
80
+ "@applitools/driver": "1.17.4",
81
+ "@applitools/ec-client": "1.8.9",
82
82
  "@applitools/logger": "2.0.17",
83
- "@applitools/nml-client": "1.8.6",
83
+ "@applitools/nml-client": "1.8.7",
84
84
  "@applitools/req": "1.7.1",
85
- "@applitools/screenshoter": "3.8.32",
85
+ "@applitools/screenshoter": "3.8.33",
86
86
  "@applitools/snippets": "2.4.26",
87
87
  "@applitools/socket": "1.1.17",
88
- "@applitools/spec-driver-webdriver": "1.1.8",
88
+ "@applitools/spec-driver-webdriver": "1.1.9",
89
89
  "@applitools/ufg-client": "1.12.1",
90
90
  "@applitools/utils": "1.7.3",
91
91
  "@types/ws": "8.5.5",
@@ -100,8 +100,8 @@
100
100
  "devDependencies": {
101
101
  "@applitools/bongo": "^5.10.0",
102
102
  "@applitools/sea": "^1.0.0",
103
- "@applitools/spec-driver-puppeteer": "^1.4.8",
104
- "@applitools/spec-driver-selenium": "^1.5.79",
103
+ "@applitools/spec-driver-puppeteer": "^1.4.9",
104
+ "@applitools/spec-driver-selenium": "^1.5.80",
105
105
  "@applitools/test-server": "^1.2.2",
106
106
  "@applitools/test-utils": "^1.5.17",
107
107
  "@applitools/tunnel-client": "^1.5.4",
@@ -5,13 +5,9 @@ type Options = {
5
5
  client?: NMLClient;
6
6
  logger: Logger;
7
7
  };
8
- export declare function makeGetNMLClient({ client, logger: mainLogger }: Options): (({ driver, settings, logger, }: {
8
+ export declare function makeGetNMLClient({ client, logger: mainLogger }: Options): ({ driver, settings, logger, }: {
9
9
  driver: Driver<SpecType>;
10
10
  settings: Omit<NMLClientSettings, 'brokerUrl'>;
11
- logger?: Logger | undefined;
12
- }) => Promise<NMLClient>) & {
13
- getCachedValues(): Promise<NMLClient>[];
14
- setCachedValue(key: any, value: Promise<NMLClient>): void;
15
- clearCache(): void;
16
- };
11
+ logger: Logger;
12
+ }) => Promise<NMLClient>;
17
13
  export {};
@@ -60,7 +60,7 @@ export interface Core<TSpec extends SpecType> extends Omit<BaseCore.Core, 'openE
60
60
  getNMLClient(options: {
61
61
  settings: Omit<NMLClientSettings, 'brokerUrl'>;
62
62
  driver: Driver<TSpec>;
63
- logger?: Logger;
63
+ logger: Logger;
64
64
  }): Promise<NMLClient>;
65
65
  openEyes(options: {
66
66
  target?: DriverTarget<TSpec>;