@applitools/nml-client 1.8.12 → 1.8.14

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,38 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.8.14](https://github.com/Applitools-Dev/sdk/compare/js/nml-client@1.8.13...js/nml-client@1.8.14) (2024-10-28)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * @applitools/snippets bumped to 2.5.2
9
+ #### Bug Fixes
10
+
11
+ * better handling of stale elements ([cab10ff](https://github.com/Applitools-Dev/sdk/commit/cab10ff1ae1e6f9560a7d278c710b3fa03f58c83))
12
+ * @applitools/driver bumped to 1.19.4
13
+ #### Bug Fixes
14
+
15
+ * better handling of stale elements ([cab10ff](https://github.com/Applitools-Dev/sdk/commit/cab10ff1ae1e6f9560a7d278c710b3fa03f58c83))
16
+
17
+
18
+
19
+ * @applitools/spec-driver-webdriver bumped to 1.1.16
20
+
21
+
22
+ ## [1.8.13](https://github.com/Applitools-Dev/sdk/compare/js/nml-client@1.8.12...js/nml-client@1.8.13) (2024-10-21)
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * @applitools/snippets bumped to 2.5.1
28
+ #### Bug Fixes
29
+
30
+ * isStaleElement error ([#2567](https://github.com/Applitools-Dev/sdk/issues/2567)) ([2675086](https://github.com/Applitools-Dev/sdk/commit/2675086aa28589082249e2958942ee29a5f2ef12))
31
+ * @applitools/driver bumped to 1.19.3
32
+
33
+ * @applitools/spec-driver-webdriver bumped to 1.1.15
34
+
35
+
3
36
  ## [1.8.12](https://github.com/Applitools-Dev/sdk/compare/js/nml-client@1.8.11...js/nml-client@1.8.12) (2024-10-03)
4
37
 
5
38
 
@@ -40,7 +40,7 @@ function makeReqBroker({ settings, logger }) {
40
40
  timeout: 200,
41
41
  codes: ['ECONNRESET', 'ECONNABORTED', 'ETIMEDOUT', 'ENOTFOUND', 'EAI_AGAIN'],
42
42
  },
43
- hooks: [handleLogs({ logger }), handleLongRequests({ req: req_1.default }), handleUnexpectedResponse()],
43
+ hooks: [handleLogs({ logger }), handleLongRequests({ req: req_1.default, logger }), handleUnexpectedResponse()],
44
44
  });
45
45
  }
46
46
  exports.makeReqBroker = makeReqBroker;
@@ -63,7 +63,7 @@ function handleLogs({ logger: defaultLogger } = {}) {
63
63
  },
64
64
  };
65
65
  }
66
- function handleLongRequests({ req }) {
66
+ function handleLongRequests({ req, logger: defaultLogger }) {
67
67
  return {
68
68
  async afterResponse({ request, response, options }) {
69
69
  if (response.status === 200) {
@@ -75,6 +75,25 @@ function handleLongRequests({ req }) {
75
75
  timeout: 200,
76
76
  statuses: [404],
77
77
  },
78
+ hooks: [
79
+ {
80
+ beforeRequest({ request, options: beforeOptions }) {
81
+ var _a;
82
+ const logger = (_a = options === null || options === void 0 ? void 0 : options.logger) !== null && _a !== void 0 ? _a : defaultLogger;
83
+ logger === null || logger === void 0 ? void 0 : logger.log(`Broker polling request "${options === null || options === void 0 ? void 0 : options.name}" will be sent to the address "[${request.method}]${request.url}" with body`, beforeOptions === null || beforeOptions === void 0 ? void 0 : beforeOptions.body);
84
+ },
85
+ async afterResponse({ request, response }) {
86
+ var _a;
87
+ const logger = (_a = options === null || options === void 0 ? void 0 : options.logger) !== null && _a !== void 0 ? _a : defaultLogger;
88
+ logger === null || logger === void 0 ? void 0 : logger.log(`Broker polling request "${options === null || options === void 0 ? void 0 : options.name}" that was sent to the address "[${request.method}]${request.url}" respond with ${response.statusText}(${response.status})`, response.status !== 200 ? `and body ${JSON.stringify(await response.clone().text())}` : '');
89
+ },
90
+ afterError({ request, error }) {
91
+ var _a;
92
+ const logger = (_a = options === null || options === void 0 ? void 0 : options.logger) !== null && _a !== void 0 ? _a : defaultLogger;
93
+ logger === null || logger === void 0 ? void 0 : logger.error(`Broker polling request "${options === null || options === void 0 ? void 0 : options.name}" that was sent to the address "[${request.method}]${request.url}" failed with error`, error);
94
+ },
95
+ },
96
+ ],
78
97
  });
79
98
  }
80
99
  },
@@ -131,6 +131,7 @@ function makeNMLRequests({ settings, logger: mainLogger, }) {
131
131
  }
132
132
  }
133
133
  async function takeSnapshots({ settings, logger = mainLogger, }) {
134
+ logger.log('Request "takeSnapshots" called with settings', settings);
134
135
  try {
135
136
  const response = await req(brokerUrl, {
136
137
  name: 'TAKE_SNAPSHOT',
@@ -159,6 +160,7 @@ function makeNMLRequests({ settings, logger: mainLogger, }) {
159
160
  ;
160
161
  snapshot.vhsType = 'android-x';
161
162
  }
163
+ logger.log('Request "takeSnapshots" finished successfully with body', snapshot);
162
164
  return Array(settings.environments.length).fill(snapshot);
163
165
  }
164
166
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/nml-client",
3
- "version": "1.8.12",
3
+ "version": "1.8.14",
4
4
  "description": "Client to integrate the SDKs to the Native Mobile Library (NML)",
5
5
  "homepage": "https://applitools.com",
6
6
  "bugs": {
@@ -41,7 +41,7 @@
41
41
  "@applitools/utils": "1.7.4"
42
42
  },
43
43
  "devDependencies": {
44
- "@applitools/spec-driver-webdriver": "^1.1.14",
44
+ "@applitools/spec-driver-webdriver": "^1.1.16",
45
45
  "@applitools/test-server": "^1.2.2",
46
46
  "@applitools/test-utils": "^1.5.17",
47
47
  "@types/node": "^12.20.55",