From df9b00fa0702da2269344f0668d4b688d6122901 Mon Sep 17 00:00:00 2001 From: "reportportal.io" Date: Thu, 11 Apr 2024 15:37:37 +0000 Subject: [PATCH 1/4] 5.1.3 -> 5.1.4-SNAPSHOT --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index cdb98d2..e118921 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.1.3 +5.1.4-SNAPSHOT From ded610fbe341ecf0507cb840b3864d3105c51129 Mon Sep 17 00:00:00 2001 From: hoangthanhtri <68146773+hoangthanhtri@users.noreply.github.com> Date: Wed, 22 May 2024 16:14:56 +0700 Subject: [PATCH 2/4] Print UUID after merging launches. Update launch search URL based on config mode (#203) * chore: Update launch search URL based on config mode * feat: Add launch UUID print functionality The code changes in `report-portal-client.js` add functionality to print the UUID of the merged launches if the `launchUuidPrint` configuration option is enabled. This is achieved by calling the `launchUuidPrintOutput` function with the UUID as an argument. * Update launch search URL based on config mode * Update launch search URL based on config mode and fix type error * Remove unused "mode" property of mergeLaunch method --- lib/report-portal-client.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/report-portal-client.js b/lib/report-portal-client.js index be95cee..05402e1 100644 --- a/lib/report-portal-client.js +++ b/lib/report-portal-client.js @@ -332,7 +332,8 @@ class RPClient { 'filter.in.uuid': launchUUIds, 'page.size': launchUUIds.length, }); - const launchSearchUrl = `launch?${params.toString()}`; + const launchSearchUrl = this.config.mode === 'DEBUG' ? + `launch/mode?${params.toString()}` : `launch?${params.toString()}`; this.logDebug(`Find launches with UUIDs to merge: ${launchUUIds}`); return this.restClient .retrieveSyncAPI(launchSearchUrl, { headers: this.headers }) @@ -353,8 +354,11 @@ class RPClient { const mergeURL = 'launch/merge'; return this.restClient.create(mergeURL, request, { headers: this.headers }); }) - .then(() => { + .then((response) => { this.logDebug(`Launches with UUIDs: ${launchUUIds} were successfully merged!`); + if (this.config.launchUuidPrint) { + this.config.launchUuidPrintOutput(response.uuid); + } }) .catch((error) => { this.logDebug(`Error merging launches with UUIDs: ${launchUUIds}`, error); From 04d0a576161cd7ba04edd82da35f19b1ada58575 Mon Sep 17 00:00:00 2001 From: Ilya Date: Wed, 22 May 2024 16:01:12 +0200 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f8dbb4..eb26a17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### Fixed +- Use correct launch search URL based on config mode while merging launches. Resolves [#200](https://github.com/reportportal/client-javascript/issues/200). Thanks to [hoangthanhtri](https://github.com/hoangthanhtri). +- Print launch UUID after merging launches. Resolves [#202](https://github.com/reportportal/client-javascript/issues/202). Thanks to [hoangthanhtri](https://github.com/hoangthanhtri). ## [5.1.3] - 2024-04-11 ### Added From 31f6a378f4fbfe13bbaf19d112352572354aed4a Mon Sep 17 00:00:00 2001 From: Ilya Hancharyk Date: Wed, 22 May 2024 16:50:41 +0200 Subject: [PATCH 4/4] Update tests --- spec/report-portal-client.spec.js | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/spec/report-portal-client.spec.js b/spec/report-portal-client.spec.js index 9a864a5..cc3ef88 100644 --- a/spec/report-portal-client.spec.js +++ b/spec/report-portal-client.spec.js @@ -543,7 +543,7 @@ describe('ReportPortal javascript client', () => { name: 'Test launch name', }; - it('should calls client', (done) => { + it('should call rest client with required parameters', async () => { const client = new RPClient({ apiKey: 'startLaunchTest', endpoint: 'https://rp.us/api/v1', @@ -564,16 +564,13 @@ describe('ReportPortal javascript client', () => { const promise = client.mergeLaunches(); expect(promise.then).toBeDefined(); - promise.then(() => { - expect(client.restClient.create).toHaveBeenCalledWith('launch/merge', fakeMergeDataRQ, { - headers: client.headers, - }); - - done(); + await promise; + expect(client.restClient.create).toHaveBeenCalledWith('launch/merge', fakeMergeDataRQ, { + headers: client.headers, }); }); - it('should not call client if something went wrong', (done) => { + it('should not call rest client if something went wrong', async () => { const client = new RPClient({ apiKey: 'startLaunchTest', endpoint: 'https://rp.us/api/v1', @@ -585,13 +582,9 @@ describe('ReportPortal javascript client', () => { spyOn(client.restClient, 'retrieveSyncAPI').and.resolveTo(); spyOn(client.restClient, 'create').and.rejectWith(); - const promise = client.mergeLaunches(); - - promise.then(() => { - expect(client.restClient.create).not.toHaveBeenCalled(); + await client.mergeLaunches(); - done(); - }); + expect(client.restClient.create).not.toHaveBeenCalled(); }); it('should return undefined if isLaunchMergeRequired is false', () => {