wdio-reportportal-reporter
Advanced tools
Comparing version 5.1.0-beta to 5.2.2
@@ -13,3 +13,3 @@ "use strict"; | ||
} | ||
addTagsToTest() { | ||
addTags() { | ||
const tags = utils_1.parseTags(this.name); | ||
@@ -16,0 +16,0 @@ if (tags.length > 0) { |
@@ -13,2 +13,3 @@ "use strict"; | ||
const crypto_1 = require("crypto"); | ||
const path = require("path"); | ||
const ReportPortalClient = require("reportportal-js-client"); | ||
@@ -55,2 +56,5 @@ const constants_1 = require("./constants"); | ||
} | ||
if (this.options.parseTagsFromTestTitle) { | ||
suiteStartObj.addTags(); | ||
} | ||
suiteStartObj.description = this.sanitizedCapabilities; | ||
@@ -78,3 +82,3 @@ const { tempId, promise } = this.client.startTestItem(suiteStartObj, this.tempLaunchId, parentId); | ||
if (this.options.parseTagsFromTestTitle) { | ||
testStartObj.addTagsToTest(); | ||
testStartObj.addTags(); | ||
} | ||
@@ -126,2 +130,3 @@ utils_1.addBrowserParam(this.sanitizedCapabilities, testStartObj); | ||
} | ||
// @ts-ignore | ||
onRunnerStart(runner, client) { | ||
@@ -160,2 +165,3 @@ log.trace(`Runner start`); | ||
} | ||
// @ts-ignore | ||
onBeforeCommand(command) { | ||
@@ -174,2 +180,3 @@ if (!this.options.reportSeleniumCommands || this.isMultiremote) { | ||
} | ||
// @ts-ignore | ||
onAfterCommand(command) { | ||
@@ -274,3 +281,4 @@ if (this.isMultiremote) { | ||
const fileName = crypto_1.createHash("md5").update(name).digest("hex"); | ||
const promise = this.client.getRequestLogWithFile(saveLogRQ, { name: fileName, content, type }); | ||
const extension = path.extname(name) || ".dat"; | ||
const promise = this.client.getRequestLogWithFile(saveLogRQ, { name: `${fileName}${extension}`, content, type }); | ||
utils_1.promiseErrorHandler(promise); | ||
@@ -277,0 +285,0 @@ }); |
@@ -21,3 +21,3 @@ import {STATUS, TYPE} from "./constants"; | ||
public addTagsToTest() { | ||
public addTags() { | ||
const tags = parseTags(this.name); | ||
@@ -24,0 +24,0 @@ if (tags.length > 0) { |
import logger from "@wdio/logger"; | ||
import Reporter from "@wdio/reporter"; | ||
import {createHash} from "crypto"; | ||
import * as path from "path"; | ||
import * as ReportPortalClient from "reportportal-js-client"; | ||
@@ -64,2 +65,5 @@ import {EVENTS, LEVEL, STATUS, TYPE} from "./constants"; | ||
} | ||
if (this.options.parseTagsFromTestTitle) { | ||
suiteStartObj.addTags(); | ||
} | ||
suiteStartObj.description = this.sanitizedCapabilities; | ||
@@ -93,3 +97,3 @@ const {tempId, promise} = this.client.startTestItem( | ||
if (this.options.parseTagsFromTestTitle) { | ||
testStartObj.addTagsToTest(); | ||
testStartObj.addTags(); | ||
} | ||
@@ -155,2 +159,3 @@ addBrowserParam(this.sanitizedCapabilities, testStartObj); | ||
// @ts-ignore | ||
private onRunnerStart(runner: any, client: ReportPortalClient) { | ||
@@ -186,3 +191,3 @@ log.trace(`Runner start`); | ||
} | ||
// @ts-ignore | ||
private onBeforeCommand(command: any) { | ||
@@ -201,3 +206,3 @@ if (!this.options.reportSeleniumCommands || this.isMultiremote) { | ||
} | ||
// @ts-ignore | ||
private onAfterCommand(command: any) { | ||
@@ -312,3 +317,4 @@ if (this.isMultiremote) { | ||
const fileName = createHash("md5").update(name).digest("hex"); | ||
const promise = this.client.getRequestLogWithFile(saveLogRQ, {name: fileName, content, type}); | ||
const extension = path.extname(name) || ".dat"; | ||
const promise = this.client.getRequestLogWithFile(saveLogRQ, {name: `${fileName}${extension}`, content, type}); | ||
promiseErrorHandler(promise); | ||
@@ -315,0 +321,0 @@ } |
{ | ||
"name": "wdio-reportportal-reporter", | ||
"version": "5.1.0-beta", | ||
"version": "5.2.2", | ||
"description": "A WebdriverIO v5 plugin. Report results to Report Portal.", | ||
@@ -37,9 +37,9 @@ "main": "build/reporter.js", | ||
"json-stringify-safe": "~5.0.1", | ||
"validator": "^11.0.0", | ||
"@wdio/reporter": "^5.9.3", | ||
"validator": "^11.1.0", | ||
"@wdio/reporter": "^5.14.5", | ||
"@wdio/logger": "^5.9.3", | ||
"reportportal-js-client": "^1.1.0" | ||
"reportportal-js-client": "^1.2.0" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^24.0.16", | ||
"@types/jest": "^24.0.19", | ||
"@types/node": "^12.0.12", | ||
@@ -49,3 +49,3 @@ "jest": "^24.8.0", | ||
"npm-run-all": "^4.1.5", | ||
"rimraf": "^2.6.3", | ||
"rimraf": "^3.0.0", | ||
"ts-node": "^8.3.0", | ||
@@ -52,0 +52,0 @@ "tslint": "^5.17.0", |
@@ -5,3 +5,4 @@ WDIO Report Portal Reporter | ||
[![Build Status](https://travis-ci.org/BorisOsipov/wdio-reportportal-reporter.svg?branch=master)](https://travis-ci.org/BorisOsipov/wdio-reportportal-reporter) | ||
![npm](https://img.shields.io/npm/v/wdio-reportportal-reporter) | ||
![npm](https://img.shields.io/npm/dm/wdio-reportportal-reporter) | ||
> A WebdriverIO v5 reporter plugin to report results to Report Portal(http://reportportal.io/). | ||
@@ -15,4 +16,4 @@ > For v4 version see [this branch](https://github.com/BorisOsipov/wdio-reportportal-reporter/tree/wdio_v4#wdio-report-portal-reporter) | ||
"devDependencies": { | ||
"wdio-reportportal-reporter": "5.0.1", | ||
"wdio-reportportal-service": "5.0.2" | ||
"wdio-reportportal-reporter": "5.2.2", | ||
"wdio-reportportal-service": "5.2.2" | ||
} | ||
@@ -54,2 +55,5 @@ } | ||
# Complete guide with a project sample demonstrating integration of WebdriverIO with Report Portal | ||
See readme in [wdio-rp-integration-demoC](https://github.com/iAutomator/wdio-rp-integration-demo) | ||
# Additional API | ||
@@ -88,2 +92,4 @@ | ||
const reporter = require('wdio-reportportal-reporter'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
@@ -103,3 +109,3 @@ exports.config = { | ||
Cucumber example: | ||
WDIO Cucumber "5.14.3+" Example: | ||
```js | ||
@@ -110,7 +116,8 @@ const reporter = require('wdio-reportportal-reporter'); | ||
... | ||
afterStep: function (uri, feature, scenario, step, result) { | ||
if (result.status === 'failed') { | ||
afterStep: function (uri, feature, { error, result, duration, passed }, stepData, context) { | ||
if (!passed) { | ||
let failureObject = {}; | ||
failureObject.type = 'afterStep'; | ||
failureObject.title = step.keyword + step.text; | ||
failureObject.error = error; | ||
failureObject.title = `${stepData.step.keyword}${stepData.step.text}`; | ||
const screenShot = global.browser.takeScreenshot(); | ||
@@ -125,4 +132,40 @@ let attachment = Buffer.from(screenShot, 'base64'); | ||
## Getting link to Report Portal UI launch page | ||
```js | ||
const RpService = require("wdio-reportportal-service"); | ||
... | ||
onComplete: async function (_, config) { | ||
const link = await RpService.getLaunchUrl(config); | ||
console.log(`Report portal link ${link}`) | ||
} | ||
... | ||
``` | ||
or more complicated way | ||
```js | ||
const RpService = require("wdio-reportportal-service"); | ||
... | ||
onComplete: async function (_, config) { | ||
const rpVersion = 5; // or 4 for Report Portal v4 | ||
const protocol = 'http:'; | ||
const hostname = 'example.com'; | ||
const port = ':8080'; // or empty string for default 80/443 ports | ||
const link = await RpService.getLaunchUrlByParams(rpVersion, protocol, hostname, port, config); | ||
console.log(`Report portal link ${link}`) | ||
} | ||
... | ||
``` | ||
## Reporting test to existing launch | ||
If you want report test to existing active launch you may pass it to reporter by environment variable `REPORT_PORTAL_LAUNCH_ID` | ||
You are responsible for finishing launch as well as starting such launch. | ||
```sh | ||
$ export REPORT_PORTAL_LAUNCH_ID=SomeLaunchId | ||
$ npm run wdio | ||
``` | ||
## License | ||
This project is licensed under the MIT License - see the [LICENSE.md](https://github.com/BorisOsipov/wdio-reportportal-reporter/blob/master/LICENSE) file for details |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
60945
1358
0
165
Updated@wdio/reporter@^5.14.5
Updatedvalidator@^11.1.0