@reportportal/client-javascript 5.3.0 → 5.4.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/README.md +20 -31
- package/VERSION +1 -1
- package/lib/helpers.js +1 -11
- package/lib/report-portal-client.js +3 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ReportPortal js client
|
|
2
2
|
|
|
3
|
-
This Client is to communicate with the
|
|
3
|
+
This Client is to communicate with the ReportPortal on Node.js.
|
|
4
4
|
|
|
5
5
|
Library is used only for implementors of custom listeners for ReportPortal.
|
|
6
6
|
|
|
@@ -40,9 +40,8 @@ const rpClient = new RPClient({
|
|
|
40
40
|
project: 'PROJECT_NAME'
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
rpClient.checkConnect().then((
|
|
43
|
+
rpClient.checkConnect().then(() => {
|
|
44
44
|
console.log('You have successfully connected to the server.');
|
|
45
|
-
console.log(`You are using an account: ${response.fullName}`);
|
|
46
45
|
}, (error) => {
|
|
47
46
|
console.log('Error connection to server');
|
|
48
47
|
console.dir(error);
|
|
@@ -129,13 +128,13 @@ console.log(launchObj.tempId);
|
|
|
129
128
|
The method takes one argument:
|
|
130
129
|
* launch data object:
|
|
131
130
|
|
|
132
|
-
| Option | Necessity | Default | Description
|
|
133
|
-
|
|
134
|
-
| startTime | Optional | rpClient.helpers.now() | Start time of the launch (
|
|
135
|
-
| name | Optional | parameter 'launch' specified when creating the client instance | Name of the launch.
|
|
136
|
-
| mode | Optional | 'DEFAULT' | 'DEFAULT' - results will be submitted to Launches page, 'DEBUG' - results will be submitted to Debug page.
|
|
137
|
-
| description | Optional | '' | Description of the launch (supports markdown syntax).
|
|
138
|
-
| attributes | Optional | [] | Array of launch attributes (tags).
|
|
131
|
+
| Option | Necessity | Default | Description |
|
|
132
|
+
|-------------|-----------|----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
|
|
133
|
+
| startTime | Optional | rpClient.helpers.now() | Start time of the launch (unix time). |
|
|
134
|
+
| name | Optional | parameter 'launch' specified when creating the client instance | Name of the launch. |
|
|
135
|
+
| mode | Optional | 'DEFAULT' | 'DEFAULT' - results will be submitted to Launches page, 'DEBUG' - results will be submitted to Debug page. |
|
|
136
|
+
| description | Optional | '' | Description of the launch (supports markdown syntax). |
|
|
137
|
+
| attributes | Optional | [] | Array of launch attributes (tags). |
|
|
139
138
|
| id | Optional | Not set | `ID` of the existing launch in which tests data would be sent, without this param new launch instance will be created. |
|
|
140
139
|
|
|
141
140
|
To get the real launch `ID` (also known as launch `UUID` from database) wait for the returned promise to finish.
|
|
@@ -180,9 +179,9 @@ The method takes two arguments:
|
|
|
180
179
|
* launch `tempId` (returned by the method `startLaunch`)
|
|
181
180
|
* data object:
|
|
182
181
|
|
|
183
|
-
|Option | Necessity | Default | Description
|
|
184
|
-
|---------
|
|
185
|
-
|endTime | Optional | rpClient.helpers.now() | End time of the launch
|
|
182
|
+
|Option | Necessity | Default | Description |
|
|
183
|
+
|--------- |-----------|---------|---------------------------------------------------------------------------------------------------|
|
|
184
|
+
|endTime | Optional | rpClient.helpers.now() | End time of the launch. |
|
|
186
185
|
|status | Optional | '' | Status of launch, one of '', 'PASSED', 'FAILED', 'STOPPED', 'SKIPPED', 'INTERRUPTED', 'CANCELLED'. |
|
|
187
186
|
|
|
188
187
|
### getPromiseFinishAllItems
|
|
@@ -265,7 +264,7 @@ The method takes three arguments:
|
|
|
265
264
|
|type | Required | | Test item type, one of 'SUITE', 'STORY', 'TEST', 'SCENARIO', 'STEP', 'BEFORE_CLASS', 'BEFORE_GROUPS','BEFORE_METHOD', 'BEFORE_SUITE', 'BEFORE_TEST', 'AFTER_CLASS', 'AFTER_GROUPS', 'AFTER_METHOD', 'AFTER_SUITE', 'AFTER_TEST' |
|
|
266
265
|
|hasStats | Optional | true | Changes behavior for test item of type 'STEP'. When set to `true`, step is treaten as a test case (entity containig statistics). When false, step becomes a nested step. |
|
|
267
266
|
|description | Optional | '' | Description of the test item (supports markdown syntax). |
|
|
268
|
-
|startTime | Optional | rpClient.helpers.now() | Start time of the test item (
|
|
267
|
+
|startTime | Optional | rpClient.helpers.now() | Start time of the test item (unix time). |
|
|
269
268
|
|attributes | Optional | [] | Array of the test item attributes. |
|
|
270
269
|
|
|
271
270
|
* launch `tempId` (returned by the method `startLaunch`)
|
|
@@ -289,8 +288,8 @@ The method takes two arguments:
|
|
|
289
288
|
| Option | Necessity | Default | Description |
|
|
290
289
|
|---------|-----------|------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
|
|
291
290
|
| issue | Optional | true | Test item issue object. `issueType` is required, allowable values: 'pb***', 'ab***', 'si***', 'ti***', 'nd001'. Where `***` is locator id |
|
|
292
|
-
| status | Optional | 'PASSED' | Test item status, one of '', 'PASSED', 'FAILED', 'STOPPED', 'SKIPPED', 'INTERRUPTED', 'CANCELLED'.
|
|
293
|
-
| endTime | Optional | rpClient.helpers.now() | End time of the launch (
|
|
291
|
+
| status | Optional | 'PASSED' | Test item status, one of '', 'PASSED', 'FAILED', 'STOPPED', 'SKIPPED', 'INTERRUPTED', 'CANCELLED'. |
|
|
292
|
+
| endTime | Optional | rpClient.helpers.now() | End time of the launch (unix time). |
|
|
294
293
|
|
|
295
294
|
Example issue object:
|
|
296
295
|
```
|
|
@@ -325,11 +324,11 @@ The method takes three arguments:
|
|
|
325
324
|
* test item `tempId` (returned by method `startTestItem`)
|
|
326
325
|
* data object:
|
|
327
326
|
|
|
328
|
-
| Option | Necessity | Default | Description
|
|
329
|
-
|
|
330
|
-
| message | Optional | '' | The log message.
|
|
327
|
+
| Option | Necessity | Default | Description |
|
|
328
|
+
|---------|-----------|------------------------|----------------------------------------------------------------------|
|
|
329
|
+
| message | Optional | '' | The log message. |
|
|
331
330
|
| level | Optional | '' | The log level, one of 'trace', 'debug', 'info', 'warn', 'error', ''. |
|
|
332
|
-
| time | Optional | rpClient.helpers.now() | The time of the log
|
|
331
|
+
| time | Optional | rpClient.helpers.now() | The time of the log. |
|
|
333
332
|
|
|
334
333
|
* file object (optional):
|
|
335
334
|
|
|
@@ -370,23 +369,13 @@ The method takes one argument:
|
|
|
370
369
|
|-------------------------|-----------|-----------------------------------------|------------------------------------------------------------------------------------------------------------|
|
|
371
370
|
| description | Optional | config.description or 'Merged launch' | Description of the launch (supports markdown syntax). |
|
|
372
371
|
| attributes | Optional | config.attributes or [] | Array of launch attributes (tags). |
|
|
373
|
-
| endTime | Optional | rpClient.helpers.now() | End time of the launch (
|
|
372
|
+
| endTime | Optional | rpClient.helpers.now() | End time of the launch (unix time) |
|
|
374
373
|
| extendSuitesDescription | Optional | true | Whether to extend suites description or not. |
|
|
375
374
|
| launches | Optional | ids of the launches saved to filesystem | The array of the real launch ids, not UUIDs |
|
|
376
375
|
| mergeType | Optional | 'BASIC' | The type of the merge operation. Possible values are 'BASIC' or 'DEEP'. |
|
|
377
376
|
| mode | Optional | config.mode or 'DEFAULT' | 'DEFAULT' - results will be submitted to Launches page, 'DEBUG' - results will be submitted to Debug page. |
|
|
378
377
|
| name | Optional | config.launch or 'Test launch name' | Name of the launch after merge. |
|
|
379
378
|
|
|
380
|
-
## Time format
|
|
381
|
-
|
|
382
|
-
The unix Epoch time ISO string.
|
|
383
|
-
|
|
384
|
-
The [ReportPortal since product version 24.2]() (Service API version 5.12.0) supports the time with microsecond precision in the ISO string format (`2024-09-23T11:10:46.793546Z`).
|
|
385
|
-
Thus, it is recommended to report time in this format to have more accurate logs and test items order on the ReportPortal UI.
|
|
386
|
-
**Note:** Reporting the time in ISO string format with millisecond precision (`2024-09-23T11:10:46.793Z`) or as a number of milliseconds (`1727089846793`) is also acceptable with microseconds automatically added as zeros for backward compatibility.
|
|
387
|
-
|
|
388
|
-
The client use time with microsecond precision in the ISO string format by default since [version 5.3.0]().
|
|
389
|
-
|
|
390
379
|
# Copyright Notice
|
|
391
380
|
|
|
392
381
|
Licensed under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.
|
|
1
|
+
5.4.1-SNAPSHOT
|
package/lib/helpers.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const glob = require('glob');
|
|
3
3
|
const os = require('os');
|
|
4
|
-
const microtime = require('microtime');
|
|
5
4
|
const RestClient = require('./rest');
|
|
6
5
|
const pjson = require('../package.json');
|
|
7
6
|
|
|
@@ -18,16 +17,8 @@ const formatName = (name) => {
|
|
|
18
17
|
return (len < MIN ? name + new Array(MIN - len + 1).join('.') : name).slice(-MAX);
|
|
19
18
|
};
|
|
20
19
|
|
|
21
|
-
const formatMicrosecondsToISOString = (timestampInMicroseconds) => {
|
|
22
|
-
const milliseconds = Math.floor(timestampInMicroseconds / 1000);
|
|
23
|
-
const microseconds = String(timestampInMicroseconds).slice(-3);
|
|
24
|
-
const isoDate = new Date(milliseconds).toISOString();
|
|
25
|
-
|
|
26
|
-
return isoDate.replace('Z', `${microseconds}Z`);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
20
|
const now = () => {
|
|
30
|
-
return
|
|
21
|
+
return new Date().valueOf();
|
|
31
22
|
};
|
|
32
23
|
|
|
33
24
|
// TODO: deprecate and remove
|
|
@@ -110,7 +101,6 @@ const saveLaunchUuidToFile = (launchUuid) => {
|
|
|
110
101
|
|
|
111
102
|
module.exports = {
|
|
112
103
|
formatName,
|
|
113
|
-
formatMicrosecondsToISOString,
|
|
114
104
|
now,
|
|
115
105
|
getServerResult,
|
|
116
106
|
readLaunchesFromFile,
|
|
@@ -130,7 +130,9 @@ class RPClient {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
checkConnect() {
|
|
133
|
-
const url = [this.config.endpoint.replace('/v2', '/v1'), '
|
|
133
|
+
const url = [this.config.endpoint.replace('/v2', '/v1'), this.config.project, 'launch']
|
|
134
|
+
.join('/')
|
|
135
|
+
.concat('?page.page=1&page.size=1');
|
|
134
136
|
return this.restClient.request('GET', url, {});
|
|
135
137
|
}
|
|
136
138
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reportportal/client-javascript",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "ReportPortal client for Node.js",
|
|
5
5
|
"author": "ReportPortal.io",
|
|
6
6
|
"scripts": {
|
|
@@ -24,13 +24,12 @@
|
|
|
24
24
|
"node": ">=14.x"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"axios": "^1.
|
|
27
|
+
"axios": "^1.8.4",
|
|
28
28
|
"axios-retry": "^4.1.0",
|
|
29
29
|
"glob": "^8.1.0",
|
|
30
30
|
"ini": "^2.0.0",
|
|
31
31
|
"uniqid": "^5.4.0",
|
|
32
|
-
"uuid": "^9.0.1"
|
|
33
|
-
"microtime": "^3.1.1"
|
|
32
|
+
"uuid": "^9.0.1"
|
|
34
33
|
},
|
|
35
34
|
"license": "Apache-2.0",
|
|
36
35
|
"devDependencies": {
|