Skip to content

Commit

Permalink
Merge pull request #147 from reportportal/develop
Browse files Browse the repository at this point in the history
Release 5.0.8
  • Loading branch information
AmsterGet authored Jan 24, 2023
2 parents 390d718 + a5f36f8 commit d2d4491
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### Added
- `mergeOptions` parameter to `mergeLaunches` method.
- Dynamic page size for launch merge based on launches count, resolves [#86](https://github.com/reportportal/client-javascript/issues/86).
### Security
- Updated versions of vulnerable packages (json5, minimist).

## [5.0.7] - 2022-12-26
### Added
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.7
5.0.8-SNAPSHOT
29 changes: 20 additions & 9 deletions lib/report-portal-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,30 +278,41 @@ class RPClient {
*
* @Returns {Object} - an object which contains a data for merge launches in ReportPortal.
*/
getMergeLaunchesRequest(launchIds) {
getMergeLaunchesRequest(launchIds, mergeOptions = {}) {
return {
description: 'Merged launch',
endTime: this.helpers.now(),
extendSuitesDescription: true,
launches: launchIds,
mergeType: 'BASIC',
mode: 'DEFAULT',
description: this.config.description || 'Merged launch',
mode: this.config.mode || 'DEFAULT',
name: this.config.launch || 'Test launch name',
attributes: this.config.attributes,
endTime: this.helpers.now(),
extendSuitesDescription: true,
...mergeOptions,
};
}

/*
/**
* This method is used for merge launches in ReportPortal.
*
* @param {Object} mergeOptions - options for merge request, can override default options.
* mergeOptions should look like this
* {
* "extendSuitesDescription": boolean,
* "description": string,
* "mergeType": 'BASIC' | 'DEEP',
* "name": string
* }
* Please, keep in mind that this method is work only in case
* the option isLaunchMergeRequired is true.
*
* @Returns {Promise}
*/
mergeLaunches() {
mergeLaunches(mergeOptions= {}) {
if (this.isLaunchMergeRequired) {
const launchUUIds = helpers.readLaunchesFromFile();
const params = new URLSearchParams({
'filter.in.uuid': launchUUIds,
'page.size': launchUUIds.length,
});
const launchSearchUrl = `launch?${params.toString()}`;
this.logDebug(`Find launches with UUIDs to merge: ${launchUUIds}`);
Expand All @@ -319,7 +330,7 @@ class RPClient {
},
)
.then((launchIds) => {
const request = this.getMergeLaunchesRequest(launchIds);
const request = this.getMergeLaunchesRequest(launchIds, mergeOptions);
this.logDebug(`Merge launches with ids: ${launchIds}`, request);
const mergeURL = 'launch/merge';
return this.restClient.create(mergeURL, request, { headers: this.headers });
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d2d4491

Please sign in to comment.