suitest-js-api 3.11.0 → 3.11.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/index.d.ts CHANGED
@@ -240,6 +240,7 @@ declare namespace suitest {
240
240
  id: string;
241
241
  firmware: string;
242
242
  modelId: string;
243
+ recordingUrl: string;
243
244
  }
244
245
 
245
246
  interface ConfigOverride {
@@ -16,6 +16,18 @@ const {getInfoErrorMessage} = require('../utils/socketErrorMessages');
16
16
  const {translateNotStartedReason} = require('../utils/translateResults');
17
17
  const logLevels = require('../../lib/constants/logLevels');
18
18
 
19
+ /**
20
+ * @description print log message that comes from BE side with proper log level
21
+ * @param {import('../../suitest').logger} logger - logger object from SUITEST_API
22
+ * @param {{type: 'log', subtype: 'info' | 'warn' | 'error', data: string[]}} content - BE message
23
+ */
24
+ const printBackendLogMessage = (logger, content) => {
25
+ const loggerMethodName = content.subtype in logger ? content.subtype : 'log';
26
+ const message = content.data.join('\n') + '\n';
27
+
28
+ logger[loggerMethodName](message);
29
+ };
30
+
19
31
  const webSocketsFactory = (self) => {
20
32
  const {config, logger} = self;
21
33
 
@@ -112,6 +124,10 @@ const webSocketsFactory = (self) => {
112
124
  return logger.log(content.data.join('\n'));
113
125
  }
114
126
 
127
+ if (content.type === 'log') {
128
+ printBackendLogMessage(logger, content);
129
+ }
130
+
115
131
  // display application logs
116
132
  if (isConsole) {
117
133
  return logger.appOutput(content.subtype, content.data, content.timestamp);
@@ -7,8 +7,14 @@
7
7
  const wsContentTypes = require('../api/wsContentTypes');
8
8
  const {validate, validators} = require('../validation');
9
9
  const chainPromise = require('../utils/chainPromise');
10
- const {invalidInputMessage, connectedToDevice, connectingToDevice, launcherWrongDeviceId} = require('../texts');
10
+ const {
11
+ invalidInputMessage,
12
+ connectedToDevice,
13
+ connectingToDevice,
14
+ launcherWrongDeviceId,
15
+ } = require('../texts');
11
16
  const {getDevicesDetails} = require('../utils/getDeviceInfo');
17
+ const {recordingUrlInfo} = require('../texts');
12
18
  const SuitestError = require('../utils/SuitestError');
13
19
 
14
20
  /**
@@ -60,6 +66,10 @@ async function pairDevice(
60
66
 
61
67
  logger.log(connectedToDevice(deviceName, deviceId));
62
68
 
69
+ if (recordingOption === 'autostart' && res.recordingUrl) {
70
+ logger.log(recordingUrlInfo(res.recordingUrl));
71
+ }
72
+
63
73
  return res;
64
74
  }
65
75
 
@@ -26,8 +26,12 @@ async function startRecording({webSockets, authContext, logger}, recordingSettin
26
26
  const response = await webSockets.send(authedContent);
27
27
 
28
28
  if (response.result === 'success') {
29
- logger.log(startRecordingMessage());
29
+ logger.log(startRecordingMessage(response.recordingUrl));
30
+
31
+ return response.recordingUrl;
30
32
  }
33
+
34
+ return undefined;
31
35
  }
32
36
 
33
37
  module.exports = chainPromise(startRecording);
package/lib/texts.js CHANGED
@@ -214,6 +214,7 @@ ${leaves}`,
214
214
  cliTimestamp: () => `Logger timestamp format. Use "${timestamp.none}" to disable. [default: "${timestamp.default}"]. This string is processed with momentJS.`,
215
215
  cliConfig: () => 'Config file to override default config.',
216
216
  cliRecordingOption: () => 'Enables recording of test session',
217
- startRecordingMessage: () => 'Recording started',
217
+ startRecordingMessage: (recordingUrl) => `Recording started. Recording URL: ${recordingUrl}`,
218
+ recordingUrlInfo: (recordingUrl) => `Recording URL: ${recordingUrl}`,
218
219
  stopRecordingMessage: () => 'Recording stopped',
219
220
  };
@@ -56,6 +56,7 @@ const bootstrapSession = async(suitest, {deviceId, configId, presetName}) => {
56
56
  : {};
57
57
 
58
58
  await setAppConfig(suitest, configId, configOverride);
59
+
59
60
  await pairDevice(
60
61
  suitest,
61
62
  deviceId,
@@ -43,7 +43,7 @@ const ELEMENT_PROP_TYPES = {
43
43
  [ELEMENT_PROP.LEFT]: 'number',
44
44
  [ELEMENT_PROP.MARGIN]: 'string',
45
45
  [ELEMENT_PROP.NAME]: 'string',
46
- [ELEMENT_PROP.OPACITY]: 'integer',
46
+ [ELEMENT_PROP.OPACITY]: 'number',
47
47
  [ELEMENT_PROP.PACKAGE_NAME]: 'string',
48
48
  [ELEMENT_PROP.PADDING]: 'string',
49
49
  [ELEMENT_PROP.PIVOT_X]: 'number',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suitest-js-api",
3
- "version": "3.11.0",
3
+ "version": "3.11.2",
4
4
  "main": "index.js",
5
5
  "repository": "git@github.com:SuitestAutomation/suitest-js-api.git",
6
6
  "author": "Suitest <hello@suite.st>",