wdio-reportportal-reporter
Advanced tools
Comparing version 6.0.1 to 6.1.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MODE = exports.CUCUMBER_STATUS = exports.CUCUMBER_TYPE = exports.TYPE = exports.LEVEL = exports.STATUS = exports.EVENTS = void 0; | ||
var EVENTS; | ||
@@ -4,0 +5,0 @@ (function (EVENTS) { |
@@ -13,2 +13,3 @@ import { STATUS, TYPE } from "./constants"; | ||
addTags(): void; | ||
addSauseLabId(id: string): void; | ||
} | ||
@@ -15,0 +16,0 @@ export declare class EndTestItem { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.StorageEntity = exports.Issue = exports.EndTestItem = exports.StartTestItem = void 0; | ||
const ReporterOptions_1 = require("./ReporterOptions"); | ||
const utils_1 = require("./utils"); | ||
const ReporterOptions_1 = require("./ReporterOptions"); | ||
class StartTestItem { | ||
@@ -23,2 +24,7 @@ constructor(name, type) { | ||
} | ||
addSauseLabId(id) { | ||
if (id) { | ||
this.attributes.push({ key: "SLID", value: id }); | ||
} | ||
} | ||
} | ||
@@ -25,0 +31,0 @@ exports.StartTestItem = StartTestItem; |
@@ -19,2 +19,3 @@ import Reporter from "@wdio/reporter"; | ||
private sanitizedCapabilities; | ||
private sessionId; | ||
private rpPromisesCompleted; | ||
@@ -21,0 +22,0 @@ private specFile; |
@@ -122,2 +122,5 @@ "use strict"; | ||
} | ||
if (this.options.isSauseLabRun) { | ||
testStartObj.addSauseLabId(this.sessionId); | ||
} | ||
if (this.options.setRetryTrue) { | ||
@@ -166,9 +169,2 @@ testStartObj.retry = true; | ||
}); | ||
if (this.options.cucumberNestedSteps) { | ||
const suiteItem = this.storage.getCurrentSuite(); | ||
this.client.sendLog(suiteItem.id, { | ||
level: constants_1.LEVEL.ERROR, | ||
message, | ||
}); | ||
} | ||
} | ||
@@ -184,2 +180,3 @@ const { promise } = this.client.finishTestItem(testItem.id, finishTestObj); | ||
this.sanitizedCapabilities = runner.sanitizedCapabilities; | ||
this.sessionId = runner.sessionId; | ||
this.client = client || new ReportPortalClient(this.options.reportPortalClientConfig); | ||
@@ -189,6 +186,6 @@ this.launchId = process.env.RP_LAUNCH_ID; | ||
const startLaunchObj = { | ||
attributes: this.options.reportPortalClientConfig.attributes, | ||
description: this.options.reportPortalClientConfig.description, | ||
id: this.launchId, | ||
mode: this.options.reportPortalClientConfig.mode, | ||
attributes: this.options.reportPortalClientConfig.attributes, | ||
}; | ||
@@ -202,5 +199,3 @@ const { tempId } = this.client.startLaunch(startLaunchObj); | ||
try { | ||
const finishPromise = yield this.client.getPromiseFinishAllItems(this.tempLaunchId); | ||
log.trace(`Runner end sync ${this.isSynchronised}`); | ||
return finishPromise; | ||
return yield this.client.getPromiseFinishAllItems(this.tempLaunchId); | ||
} | ||
@@ -213,2 +208,3 @@ catch (e) { | ||
this.isSynchronised = true; | ||
log.trace(`Runner end sync`); | ||
} | ||
@@ -215,0 +211,0 @@ }); |
@@ -15,2 +15,3 @@ import { LEVEL, MODE } from "./constants"; | ||
setRetryTrue: boolean; | ||
isSauseLabRun: boolean; | ||
cucumberNestedSteps: boolean; | ||
@@ -17,0 +18,0 @@ autoAttachCucumberFeatureToScenario: boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Attribute = void 0; | ||
const constants_1 = require("./constants"); | ||
@@ -20,2 +21,3 @@ class Attribute { | ||
this.setRetryTrue = false; | ||
this.isSauseLabRun = false; | ||
this.cucumberNestedSteps = false; | ||
@@ -22,0 +24,0 @@ this.autoAttachCucumberFeatureToScenario = false; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Storage = void 0; | ||
class Storage { | ||
@@ -4,0 +5,0 @@ constructor() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sendToReporter = exports.isScreenshotCommand = exports.parseTags = exports.addDescription = exports.addBrowserParam = exports.limit = exports.isEmpty = exports.promiseErrorHandler = void 0; | ||
// @ts-ignore | ||
@@ -4,0 +5,0 @@ const logger_1 = require("@wdio/logger"); |
@@ -0,4 +1,4 @@ | ||
import {Attribute} from "../../build/ReporterOptions"; | ||
import {MODE} from "../constants"; | ||
import {getOptions, RPClient} from "./reportportal-client.mock"; | ||
import {Attribute} from "../../build/ReporterOptions"; | ||
@@ -27,6 +27,6 @@ const Reporter = require("../../build/reporter"); | ||
const launchObj = { | ||
attributes: options.reportPortalClientConfig.attributes, | ||
description: options.reportPortalClientConfig.description, | ||
id: REAL_LAUNCH_ID, | ||
mode: options.reportPortalClientConfig.mode, | ||
attributes: options.reportPortalClientConfig.attributes, | ||
}; | ||
@@ -53,6 +53,6 @@ expect(reporter.client.startLaunch).toBeCalledWith(launchObj); | ||
const launchObj = { | ||
attributes: options.reportPortalClientConfig.attributes, | ||
description: options.reportPortalClientConfig.description, | ||
id: REAL_LAUNCH_ID, | ||
mode: options.reportPortalClientConfig.mode, | ||
attributes: options.reportPortalClientConfig.attributes, | ||
}; | ||
@@ -59,0 +59,0 @@ expect(reporter.client.startLaunch).toBeCalledWith(launchObj); |
@@ -24,2 +24,13 @@ import {TYPE} from "../constants"; | ||
test("should add SauseLab id", () => { | ||
const testStartObj = new StartTestItem("foo", TYPE.STEP); | ||
testStartObj.addSauseLabId("foo"); | ||
expect(testStartObj.attributes).toEqual([{key: "SLID", value: "foo"}]); | ||
}); | ||
test("should not add SauseLab id is empty", () => { | ||
const testStartObj = new StartTestItem("foo", TYPE.STEP); | ||
testStartObj.addSauseLabId(null); | ||
expect(testStartObj.attributes).toEqual([]); | ||
}); | ||
}); |
import {STATUS, TYPE} from "./constants"; | ||
import {Attribute} from "./ReporterOptions"; | ||
import {parseTags} from "./utils"; | ||
import {Attribute} from "./ReporterOptions"; | ||
@@ -30,2 +30,8 @@ export class StartTestItem { | ||
} | ||
public addSauseLabId(id: string) { | ||
if (id) { | ||
this.attributes.push({key: "SLID", value: id}); | ||
} | ||
} | ||
} | ||
@@ -32,0 +38,0 @@ |
@@ -52,2 +52,3 @@ import logger from "@wdio/logger"; | ||
private sanitizedCapabilities: string; | ||
private sessionId: string; | ||
private rpPromisesCompleted = false; | ||
@@ -148,2 +149,5 @@ private specFile: string; | ||
} | ||
if (this.options.isSauseLabRun) { | ||
testStartObj.addSauseLabId(this.sessionId); | ||
} | ||
if (this.options.setRetryTrue) { | ||
@@ -203,10 +207,2 @@ testStartObj.retry = true; | ||
}); | ||
if (this.options.cucumberNestedSteps) { | ||
const suiteItem = this.storage.getCurrentSuite(); | ||
this.client.sendLog(suiteItem.id, { | ||
level: LEVEL.ERROR, | ||
message, | ||
}); | ||
} | ||
} | ||
@@ -225,2 +221,3 @@ | ||
this.sanitizedCapabilities = runner.sanitizedCapabilities; | ||
this.sessionId = runner.sessionId; | ||
this.client = client || new ReportPortalClient(this.options.reportPortalClientConfig); | ||
@@ -230,6 +227,6 @@ this.launchId = process.env.RP_LAUNCH_ID; | ||
const startLaunchObj = { | ||
attributes: this.options.reportPortalClientConfig.attributes, | ||
description: this.options.reportPortalClientConfig.description, | ||
id: this.launchId, | ||
mode: this.options.reportPortalClientConfig.mode, | ||
attributes: this.options.reportPortalClientConfig.attributes, | ||
}; | ||
@@ -243,5 +240,3 @@ const {tempId} = this.client.startLaunch(startLaunchObj); | ||
try { | ||
const finishPromise = await this.client.getPromiseFinishAllItems(this.tempLaunchId); | ||
log.trace(`Runner end sync ${this.isSynchronised}`); | ||
return finishPromise; | ||
return await this.client.getPromiseFinishAllItems(this.tempLaunchId); | ||
} catch (e) { | ||
@@ -252,2 +247,3 @@ log.error("An error occurs on finish test items"); | ||
this.isSynchronised = true; | ||
log.trace(`Runner end sync`); | ||
} | ||
@@ -254,0 +250,0 @@ } |
@@ -21,2 +21,3 @@ import {LEVEL, MODE} from "./constants"; | ||
public setRetryTrue = false; | ||
public isSauseLabRun = false; | ||
public cucumberNestedSteps = false; | ||
@@ -23,0 +24,0 @@ public autoAttachCucumberFeatureToScenario = false; |
{ | ||
"name": "wdio-reportportal-reporter", | ||
"version": "6.0.1", | ||
"description": "A WebdriverIO v5 plugin. Report results to Report Portal.", | ||
"version": "6.1.0", | ||
"description": "A WebdriverIO v6 plugin. Report results to Report Portal.", | ||
"main": "build/reporter.js", | ||
@@ -37,17 +37,17 @@ "scripts": { | ||
"json-stringify-safe": "~5.0.1", | ||
"validator": "^13.0.0", | ||
"@wdio/reporter": "^5.22.4", | ||
"@wdio/logger": "^5.16.10", | ||
"reportportal-js-client": "^2.0.0" | ||
"validator": "^13.1.1", | ||
"@wdio/reporter": "^6.3.6", | ||
"@wdio/logger": "^6.0.16", | ||
"reportportal-js-client": "^2.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^25.2.1", | ||
"@types/node": "^13.11.0", | ||
"jest": "^25.2.7", | ||
"ts-jest": "^25.3.1", | ||
"@types/jest": "^26.0.10", | ||
"@types/node": "^14.6.2", | ||
"jest": "^26.4.2", | ||
"ts-jest": "^26.3.0", | ||
"npm-run-all": "^4.1.5", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^8.8.2", | ||
"tslint": "^6.1.1", | ||
"typescript": "^3.8.3" | ||
"ts-node": "^9.0.0", | ||
"tslint": "^6.1.3", | ||
"typescript": "^3.9.4" | ||
}, | ||
@@ -54,0 +54,0 @@ "contributors": [ |
@@ -7,3 +7,3 @@ WDIO Report Portal 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/). | ||
> A WebdriverIO v6 reporter plugin to report results to Report Portal(http://reportportal.io/). | ||
> For v4 version see [this branch](https://github.com/BorisOsipov/wdio-reportportal-reporter/tree/wdio_v4#wdio-report-portal-reporter) | ||
@@ -17,4 +17,4 @@ > For Report Portal v4 use `5.X.X` releases | ||
"devDependencies": { | ||
"wdio-reportportal-reporter": "6.0.0", | ||
"wdio-reportportal-service": "6.0.0" | ||
"wdio-reportportal-reporter": "6.1.0", | ||
"wdio-reportportal-service": "6.1.0" | ||
} | ||
@@ -48,3 +48,4 @@ } | ||
cucumberNestedSteps: false, // report cucumber steps as Report Portal steps | ||
autoAttachCucumberFeatureToScenario: false // requires cucumberNestedSteps to be true for use | ||
autoAttachCucumberFeatureToScenario: false, // requires cucumberNestedSteps to be true for use | ||
isSauseLabRun: false // automatically add SauseLab ID to rp tags. | ||
}; | ||
@@ -112,2 +113,23 @@ | ||
Jasmine example: | ||
```js | ||
const reportportal = require('wdio-reportportal-reporter'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
exports.config = { | ||
... | ||
afterTest(test) { | ||
if (test.passed === false) { | ||
const filename = "screnshot.png"; | ||
const outputFile = path.join(__dirname, filename); | ||
browser.saveScreenshot(outputFile); | ||
//!! | ||
Object.assign(test, {title: test.description}} | ||
reportportal.sendFileToTest(test, 'info', filename, fs.readFileSync(outputFile)); | ||
} | ||
} | ||
... | ||
``` | ||
WDIO Cucumber "5.14.3+" Example: | ||
@@ -114,0 +136,0 @@ ```js |
78923
1820
190
+ Added@types/cucumber@6.0.1(transitive)
+ Added@wdio/logger@6.10.10(transitive)
+ Added@wdio/reporter@6.11.0(transitive)
+ Addedat-least-node@1.0.0(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedfs-extra@9.1.0(transitive)
+ Addedjsonfile@6.1.0(transitive)
+ Addeduniversalify@2.0.1(transitive)
- Removed@wdio/logger@5.16.10(transitive)
- Removed@wdio/reporter@5.22.4(transitive)
- Removedchalk@3.0.0(transitive)
- Removedfs-extra@8.1.0(transitive)
- Removedjsonfile@4.0.0(transitive)
- Removeduniversalify@0.1.2(transitive)
Updated@wdio/logger@^6.0.16
Updated@wdio/reporter@^6.3.6
Updatedvalidator@^13.1.1