@comeonautomation/reportportal-client
Advanced tools
Comparing version
@@ -278,3 +278,3 @@ /* eslint-disable quotes,no-console,class-methods-use-this */ | ||
*/ | ||
forceStopAndMergeLaunches(mergeDescription) { | ||
forceStopAndDeleteSkippedTests() { | ||
if (this.isLaunchMergeRequired) { | ||
@@ -308,3 +308,3 @@ const statusUrl = ["launch", "status"].join("/"); | ||
this.logDebug(`Launches successfully stopped!`); | ||
this.deleteSkippedTest(mergeDescription) | ||
this.deleteSkippedTest() | ||
}); | ||
@@ -344,25 +344,20 @@ }); | ||
deleteSkippedTest(mergeDescription) { | ||
async deleteSkippedTest() { | ||
const launchIds = helpers.readLaunchesFromFile(); | ||
const hasSkipTestItems = []; | ||
for (let item in launchIds) { | ||
this.restClient | ||
.retrieve("/item?filter.eq.launchId="+launchIds[item]+"&isLatest=false") | ||
await this.restClient | ||
.retrieve("/item?filter.eq.launchId="+launchIds[item]+"&page.size=100") | ||
.then(response => { | ||
this.logDebug (`Total elements in ${launchIds[item]}: `+response.page.totalElements); | ||
for (var i=1;i<response.page.totalElements;i++){ | ||
for (var i=0;i<response.page.totalElements;i++){ | ||
this.logDebug('Test ID: '+response.content[i].id+' '+response.content[i].name+' Skipped:'+response.content[i].statistics.executions.skipped) | ||
const item_id_url='/item/uuid/'+response.content[i].id | ||
if (response.content[i].statistics.executions.skipped){ | ||
if (response.content[i].statistics.executions.skipped==1 && response.content[i].hasChildren == false){ | ||
this.restClient | ||
.retrieve(item_id_url) | ||
.then(response => { | ||
const test_item_delete_url = "/item?ids="+response.id; | ||
this.logDebug(test_item_delete_url) | ||
this.restClient | ||
.delete(test_item_delete_url) | ||
.then(response => { | ||
this.logDebug('Deleted Skipped tests successfully'); | ||
this.mergeLaunches(mergeDescription) | ||
}); | ||
hasSkipTestItems.push(response.id) | ||
}); | ||
@@ -373,5 +368,12 @@ } | ||
} | ||
const test_item_delete_url = "/item?ids="+hasSkipTestItems; | ||
this.logDebug(test_item_delete_url) | ||
this.restClient | ||
.delete(test_item_delete_url) | ||
.then(response => { | ||
this.logDebug('Deleted Skipped tests successfully'); | ||
}); | ||
} | ||
/* | ||
@@ -401,13 +403,26 @@ * This method is used to create data object for merge request to ReportPortal. | ||
*/ | ||
mergeLaunches(mergeDescription) { | ||
async mergeLaunches(mergeDescription) { | ||
if (this.isLaunchMergeRequired) { | ||
const url = ["launch", "merge"].join("/"); | ||
const launchIds = helpers.readLaunchesFromFile(); | ||
const data = this.getMergeLaunchesData(launchIds, mergeDescription); | ||
const activeLaunches = [] | ||
for (let items in launchIds) | ||
{ | ||
await this.restClient | ||
.retrieve('/launch/status?ids='+launchIds[items]) | ||
.then(response => { | ||
if (response.hasOwnProperty(launchIds[items])) | ||
{ | ||
activeLaunches.push(launchIds[items]) | ||
} | ||
}) | ||
} | ||
const data = this.getMergeLaunchesData(activeLaunches, mergeDescription); | ||
this.restClient | ||
.create(url, data, { headers: this.headers }) | ||
.then(() => { | ||
this.logDebug(`Launches successfully merged!`); | ||
}); | ||
this.restClient | ||
.create(url, data, { headers: this.headers }) | ||
.then(() => { | ||
this.logDebug(`Launches successfully merged!`); | ||
}); | ||
} else { | ||
@@ -414,0 +429,0 @@ this.logDebug(`Option isLaunchMergeRequired is false'`); |
{ | ||
"name": "@comeonautomation/reportportal-client", | ||
"version": "1.10.0", | ||
"version": "2.0.0", | ||
"description": "ReportPortal client for node.js", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
147492
0.23%1743
0.75%