reportportal-client
Advanced tools
Comparing version 5.0.0 to 5.1.0
@@ -86,23 +86,39 @@ const UniqId = require('uniqid'); | ||
* } | ||
* @Returns an object which contains a tempID and a promise | ||
* | ||
* This method works in two ways: | ||
* First - If launchDataRQ object doesn't contain ID field , it would create a new Launch instance at the | ||
* Report Portal with it ID. | ||
* Second - If launchDataRQ would contain ID field , client would connect to the existing Launch which ID | ||
* has been sent , and would send all data to it. | ||
* Notice that Launch which ID has been sent must be 'IN PROGRESS' state at the Report Portal | ||
* or it would throw an error. | ||
* | ||
*/ | ||
startLaunch(launchDataRQ) { | ||
const tempId = this.getUniqId(); | ||
if (launchDataRQ.id) { | ||
this.map[tempId]= this.getNewItemObj((resolve, reject) => { | ||
resolve(launchDataRQ); | ||
}); | ||
this.map[tempId].realId = launchDataRQ.id; | ||
} else{ | ||
let launchData = Object.assign({ | ||
name: this.config.launch || 'Test launch name', | ||
start_time: this.helpers.now() | ||
}, launchDataRQ); | ||
let launchData = Object.assign({ | ||
name: this.config.launch || 'Test launch name', | ||
start_time: this.helpers.now() | ||
}, launchDataRQ); | ||
this.map[tempId] = this.getNewItemObj((resolve, reject) => { | ||
const url = [this.baseURL, "launch"].join("/"); | ||
this.debug && console.log(`Start launch ${tempId}`); | ||
helpers.getServerResult(url, launchData, {headers: this.headers}, "POST") | ||
.then((responce) => { | ||
this.map[tempId].realId = responce.id; | ||
resolve(responce); | ||
}, (error) => { | ||
console.dir(error); | ||
reject(); | ||
}) | ||
}); | ||
this.map[tempId] = this.getNewItemObj((resolve, reject) => { | ||
const url = [this.baseURL, "launch"].join("/"); | ||
this.debug && console.log(`Start launch ${tempId}`); | ||
helpers.getServerResult(url, launchData, {headers: this.headers}, "POST") | ||
.then((responce) => { | ||
this.map[tempId].realId = responce.id; | ||
resolve(responce); | ||
}, (error) => { | ||
console.dir(error); | ||
reject(); | ||
}) | ||
}); | ||
} | ||
return { | ||
@@ -122,2 +138,3 @@ tempId, | ||
* } | ||
* @Returns an object which contains a tempID and a promise | ||
*/ | ||
@@ -164,3 +181,15 @@ finishLaunch(launchTempId, finishExecutionRQ) { | ||
/* | ||
* This method is used for frameworks as Jasmine. There is problems when | ||
* it doesn't wait for promise resolve and stop the process. So it better to call | ||
* this method at the spec's function as @afterAll() and manually resolve this promise. | ||
* | ||
* @return Promise | ||
*/ | ||
getPromiseFinishAllItems(launchTempId) { | ||
const launchObj = this.map[launchTempId]; | ||
return Promise.all( launchObj.childrens.map((itemId) => { return this.map[itemId].promiseFinish; })); | ||
} | ||
/** | ||
@@ -178,2 +207,3 @@ * Update launch. | ||
} | ||
* @Returns an object which contains a tempID and a promise | ||
*/ | ||
@@ -227,2 +257,3 @@ updateLaunch(launchTempId, launchData) { | ||
* @param {string} parentTempId (optional) - temp item id (returned in the query "startTestItem"). | ||
* @Returns an object which contains a tempID and a promise | ||
*/ | ||
@@ -308,2 +339,3 @@ startTestItem( testItemDataRQ, launchTempId, parentTempId) { | ||
} | ||
* @Returns an object which contains a tempID and a promise | ||
*/ | ||
@@ -310,0 +342,0 @@ finishTestItem(itemTempId, finishTestItemRQ) { |
{ | ||
"name": "reportportal-client", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "ReportPortal client for node.js", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
[![Build Status](https://travis-ci.org/reportportal/client-javascript.svg?branch=master)](https://travis-ci.org/reportportal/client-javascript)[![Code Coverage](https://codecov.io/gh/reportportal/client-javascript/branch/master/graph/badge.svg)](https://codecov.io/gh/reportportal/client-javascript)[![npm version](https://badge.fury.io/js/reportportal-client.svg)](https://badge.fury.io/js/reportportal-client) | ||
#ReportPortal js client | ||
# ReportPortal js client | ||
This Client is to communicate with the Report Portal on node js. | ||
@@ -78,3 +78,5 @@ | ||
description: "description of the launch", | ||
tags: ["tag1", "tag2"] | ||
tags: ["tag1", "tag2"], | ||
//this param used only when you need client to send data into the existing launch | ||
id: 'id' | ||
}); | ||
@@ -93,2 +95,3 @@ console.log(launchObj.tempId); | ||
tags | (optional) array of launch tags | ||
id | id of the existing launch in which tests data would be sent, without this param new launch instance would be created | ||
@@ -123,2 +126,14 @@ To know the real launch id wait for the method to finish (the real id is not used by the client) | ||
### getPromiseFinishAllItems | ||
getPromiseFinishAllItems - returns promise that contains status about all data has been sent to the Report Protal. | ||
This method needed when test frameworks don't wait for async methods and stop processed. | ||
```javascript | ||
// jasmine example. tempLaunchId - id of the client's process | ||
agent.getAllClientPromises(agent.tempLaunchId).then(()=> done()); | ||
``` | ||
Parameter | Description | ||
--------- | ----------- | ||
tempLaunchId | id of the client's process | ||
### updateLaunch | ||
@@ -125,0 +140,0 @@ updateLaunch - updates launch data. Will send a request to the server only after finishing the launch. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
144833
999
252
0