@qavajs/format-report-portal 0.9.4 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.MD +7 -0
- package/README.MD +3 -2
- package/index.js +19 -3
- package/package.json +5 -5
package/CHANGELOG.MD
CHANGED
package/README.MD
CHANGED
|
@@ -17,7 +17,7 @@ module.exports = {
|
|
|
17
17
|
rpConfig: {
|
|
18
18
|
enable: true,
|
|
19
19
|
debug: false,
|
|
20
|
-
|
|
20
|
+
apiKey: 'your token',
|
|
21
21
|
endpoint: 'https://your-rp-instance/api/v1',
|
|
22
22
|
description: 'Description',
|
|
23
23
|
tags: ['Tag'],
|
|
@@ -25,7 +25,8 @@ module.exports = {
|
|
|
25
25
|
launch: 'your launch name',
|
|
26
26
|
mode: 'DEFAULT',
|
|
27
27
|
retry: 1, // number of retries to send result to report portal (default - 1)
|
|
28
|
-
ignoreErrors: false // ignore RP errors (default: false)
|
|
28
|
+
ignoreErrors: false, // ignore RP errors (default: false)
|
|
29
|
+
showLaunchURL: true // log report portal launch link
|
|
29
30
|
},
|
|
30
31
|
}
|
|
31
32
|
}
|
package/index.js
CHANGED
|
@@ -16,10 +16,14 @@ class RPFormatter extends Formatter {
|
|
|
16
16
|
this.rpConfig = options.parsedArgvOptions.rpConfig;
|
|
17
17
|
this.rpClient = new RPClient(this.rpConfig);
|
|
18
18
|
this.promiseQ = [];
|
|
19
|
+
this.stepDefinitions = {};
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
async processEnvelope(envelope) {
|
|
22
23
|
try {
|
|
24
|
+
if (envelope.stepDefinition || envelope.hook) {
|
|
25
|
+
return this.readStepDefinition(envelope);
|
|
26
|
+
}
|
|
23
27
|
if (envelope.testRunStarted) {
|
|
24
28
|
const startLaunch = this.startLaunch();
|
|
25
29
|
this.promiseQ.push(startLaunch);
|
|
@@ -42,6 +46,11 @@ class RPFormatter extends Formatter {
|
|
|
42
46
|
}
|
|
43
47
|
}
|
|
44
48
|
|
|
49
|
+
readStepDefinition(stepDefinition) {
|
|
50
|
+
const definition = stepDefinition.stepDefinition ?? stepDefinition.hook;
|
|
51
|
+
this.stepDefinitions[definition.id] = definition;
|
|
52
|
+
}
|
|
53
|
+
|
|
45
54
|
async startLaunch() {
|
|
46
55
|
const launchObj = this.rpClient.startLaunch({
|
|
47
56
|
name: this.rpConfig.launch,
|
|
@@ -62,13 +71,14 @@ class RPFormatter extends Formatter {
|
|
|
62
71
|
for (const featureName in this.features) {
|
|
63
72
|
await this.rpClient.finishTestItem(this.features[featureName], { status: 'PASSED' }).promise;
|
|
64
73
|
}
|
|
65
|
-
await this.rpClient.finishLaunch(this.launchId, {
|
|
74
|
+
const launch = await this.rpClient.finishLaunch(this.launchId, {
|
|
66
75
|
endTime: this.rpClient.helpers.now()
|
|
67
76
|
}).promise;
|
|
77
|
+
|
|
78
|
+
if (this.rpConfig.showLaunchURL) console.log(`RP launch link: ${launch.link}`);
|
|
68
79
|
}
|
|
69
80
|
|
|
70
81
|
async finishTest(envelope) {
|
|
71
|
-
if (envelope.testCaseFinished.willBeRetried) return;
|
|
72
82
|
const testCase = this.eventDataCollector.getTestCaseAttempt(envelope.testCaseFinished.testCaseStartedId);
|
|
73
83
|
const featureName = testCase.gherkinDocument.feature.name;
|
|
74
84
|
if (!this.features[featureName]) {
|
|
@@ -106,13 +116,15 @@ class RPFormatter extends Formatter {
|
|
|
106
116
|
});
|
|
107
117
|
|
|
108
118
|
// Start test
|
|
119
|
+
const retryTest = Boolean(testCase.attempt);
|
|
109
120
|
const testItem = await retry(async () => {
|
|
110
121
|
const testItem = this.rpClient.startTestItem({
|
|
111
122
|
description: this.formatTags(testCase.pickle.tags),
|
|
112
123
|
name: testCase.pickle.name,
|
|
113
124
|
startTime,
|
|
114
125
|
type: 'STEP',
|
|
115
|
-
attributes
|
|
126
|
+
attributes,
|
|
127
|
+
retry: retryTest
|
|
116
128
|
}, this.launchId, featureTempId);
|
|
117
129
|
await testItem.promise;
|
|
118
130
|
return testItem;
|
|
@@ -175,6 +187,8 @@ class RPFormatter extends Formatter {
|
|
|
175
187
|
|
|
176
188
|
getStepResults(testCase) {
|
|
177
189
|
return testCase.testCase.testSteps.map(step => ({
|
|
190
|
+
id: step.id,
|
|
191
|
+
stepDefinitionId: step.pickleStepId ?? step.hookId,
|
|
178
192
|
result: testCase.stepResults[step.id],
|
|
179
193
|
pickle: testCase.pickle.steps.find(pickle => pickle.id === step.pickleStepId),
|
|
180
194
|
attachment: testCase.stepAttachments[step.id] ?? []
|
|
@@ -195,6 +209,8 @@ class RPFormatter extends Formatter {
|
|
|
195
209
|
}
|
|
196
210
|
|
|
197
211
|
hookKeyword(step, steps) {
|
|
212
|
+
const hook = this.stepDefinitions[step.stepDefinitionId];
|
|
213
|
+
if (hook?.name) return hook.name;
|
|
198
214
|
const stepsBefore = steps.slice(0, steps.findIndex((element) => element === step));
|
|
199
215
|
return stepsBefore.every(element => element.pickle === undefined) ? 'Before' : 'After'
|
|
200
216
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qavajs/format-report-portal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "cucumber formatter for report portal",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/qavajs/format-report-portal#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@reportportal/client-javascript": "^5.0.
|
|
23
|
+
"@reportportal/client-javascript": "^5.0.13"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@cucumber/cucumber": "^9.
|
|
27
|
-
"@qavajs/cli": "^0.
|
|
28
|
-
"@qavajs/memory": "^1.
|
|
26
|
+
"@cucumber/cucumber": "^9.4.0",
|
|
27
|
+
"@qavajs/cli": "^0.28.0",
|
|
28
|
+
"@qavajs/memory": "^1.6.2"
|
|
29
29
|
}
|
|
30
30
|
}
|