@qavajs/format-report-portal 0.0.5 → 0.0.7
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 +6 -0
- package/index.js +40 -21
- package/package.json +6 -7
package/CHANGELOG.MD
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 0.0.7
|
|
2
|
+
- :beetle: implemented sending real step duration
|
|
3
|
+
|
|
4
|
+
## 0.0.6
|
|
5
|
+
- :rocket: enable support of cucumber logs
|
|
6
|
+
|
|
1
7
|
## 0.0.5
|
|
2
8
|
- :rocket: updated step logging as nested steps instead plain logs
|
|
3
9
|
- :beetle: added capability to attach multiple attachment to step
|
package/index.js
CHANGED
|
@@ -70,12 +70,14 @@ class RPFormatter extends Formatter {
|
|
|
70
70
|
await featureItem.promise;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
const featureTempId = this.features[featureName]
|
|
73
|
+
const featureTempId = this.features[featureName];
|
|
74
|
+
let startTime = this.rpClient.helpers.now();
|
|
75
|
+
let endTime;
|
|
74
76
|
// Start test item
|
|
75
77
|
const testItem = this.rpClient.startTestItem({
|
|
76
78
|
description: this.formatTags(testCase.pickle.tags),
|
|
77
79
|
name: testCase.pickle.name,
|
|
78
|
-
startTime
|
|
80
|
+
startTime,
|
|
79
81
|
type: 'STEP'
|
|
80
82
|
}, this.launchId, featureTempId);
|
|
81
83
|
this.promiseQ.push(testItem.promise);
|
|
@@ -84,10 +86,12 @@ class RPFormatter extends Formatter {
|
|
|
84
86
|
//send steps
|
|
85
87
|
const steps = this.getStepResults(testCase)
|
|
86
88
|
for (const step of steps) {
|
|
89
|
+
const duration = step.result.duration;
|
|
90
|
+
endTime = startTime + (duration.seconds * 1000) + Math.floor(duration.nanos / 1000);
|
|
87
91
|
const nestedTestItem = this.rpClient.startTestItem({
|
|
88
92
|
description: 'test description',
|
|
89
93
|
name: this.getStepText(step, steps),
|
|
90
|
-
startTime
|
|
94
|
+
startTime,
|
|
91
95
|
type: 'STEP',
|
|
92
96
|
hasStats: false
|
|
93
97
|
}, this.launchId, testItem.tempId);
|
|
@@ -97,33 +101,23 @@ class RPFormatter extends Formatter {
|
|
|
97
101
|
const log = await this.rpClient.sendLog(nestedTestItem.tempId, {
|
|
98
102
|
level: 'ERROR',
|
|
99
103
|
message: this.getMessage(step),
|
|
100
|
-
time:
|
|
104
|
+
time: startTime
|
|
101
105
|
});
|
|
102
106
|
this.promiseQ.push(log.promise);
|
|
103
107
|
await log.promise;
|
|
104
108
|
}
|
|
105
109
|
if (step.attachment) {
|
|
106
110
|
for (const attachment of step.attachment) {
|
|
107
|
-
|
|
108
|
-
name: 'attachment',
|
|
109
|
-
type: attachment.mediaType,
|
|
110
|
-
content: this.prepareContent(attachment),
|
|
111
|
-
};
|
|
112
|
-
const log = await this.rpClient.sendLog(nestedTestItem.tempId, {
|
|
113
|
-
level: 'INFO',
|
|
114
|
-
message: 'Attachment',
|
|
115
|
-
time: this.rpClient.helpers.now()
|
|
116
|
-
}, attachmentData);
|
|
117
|
-
this.promiseQ.push(log.promise);
|
|
118
|
-
await log.promise;
|
|
111
|
+
await this.sendAttachment(attachment, nestedTestItem, startTime);
|
|
119
112
|
}
|
|
120
113
|
}
|
|
121
114
|
const nestedItemFinish = this.rpClient.finishTestItem(nestedTestItem.tempId, {
|
|
122
115
|
status: this.getStatus(step),
|
|
123
|
-
endTime
|
|
116
|
+
endTime
|
|
124
117
|
});
|
|
125
118
|
this.promiseQ.push(nestedItemFinish.promise);
|
|
126
119
|
await nestedItemFinish.promise;
|
|
120
|
+
startTime = endTime;
|
|
127
121
|
}
|
|
128
122
|
|
|
129
123
|
//finish test item
|
|
@@ -131,7 +125,8 @@ class RPFormatter extends Formatter {
|
|
|
131
125
|
? Status.FAILED.toLowerCase()
|
|
132
126
|
: Status.PASSED.toLowerCase()
|
|
133
127
|
const testItemFinish = this.rpClient.finishTestItem(testItem.tempId, {
|
|
134
|
-
status
|
|
128
|
+
status,
|
|
129
|
+
endTime
|
|
135
130
|
});
|
|
136
131
|
this.promiseQ.push(testItemFinish.promise);
|
|
137
132
|
await testItemFinish.promise;
|
|
@@ -167,10 +162,11 @@ class RPFormatter extends Formatter {
|
|
|
167
162
|
}
|
|
168
163
|
|
|
169
164
|
getStatus(step) {
|
|
170
|
-
|
|
171
|
-
return Status.
|
|
165
|
+
switch (step.result.status) {
|
|
166
|
+
case Status.PASSED: return Status.PASSED.toLowerCase();
|
|
167
|
+
case Status.SKIPPED: return Status.SKIPPED.toLowerCase();
|
|
168
|
+
default: return Status.FAILED.toLowerCase()
|
|
172
169
|
}
|
|
173
|
-
return Status.PASSED.toLowerCase()
|
|
174
170
|
}
|
|
175
171
|
|
|
176
172
|
formatTable(dataTable) {
|
|
@@ -196,6 +192,29 @@ class RPFormatter extends Formatter {
|
|
|
196
192
|
: attachment.body
|
|
197
193
|
}
|
|
198
194
|
|
|
195
|
+
async sendAttachment(attachment, testItem, startTime) {
|
|
196
|
+
let log;
|
|
197
|
+
if (attachment.mediaType === 'text/x.cucumber.log+plain') {
|
|
198
|
+
log = await this.rpClient.sendLog(testItem.tempId, {
|
|
199
|
+
level: 'INFO',
|
|
200
|
+
message: attachment.body,
|
|
201
|
+
time: startTime
|
|
202
|
+
});
|
|
203
|
+
} else {
|
|
204
|
+
const attachmentData = {
|
|
205
|
+
name: 'attachment',
|
|
206
|
+
type: attachment.mediaType,
|
|
207
|
+
content: this.prepareContent(attachment),
|
|
208
|
+
};
|
|
209
|
+
log = await this.rpClient.sendLog(testItem.tempId, {
|
|
210
|
+
level: 'INFO',
|
|
211
|
+
message: 'Attachment',
|
|
212
|
+
time: startTime
|
|
213
|
+
}, attachmentData);
|
|
214
|
+
}
|
|
215
|
+
this.promiseQ.push(log.promise);
|
|
216
|
+
await log.promise;
|
|
217
|
+
}
|
|
199
218
|
}
|
|
200
219
|
|
|
201
220
|
module.exports = RPFormatter
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qavajs/format-report-portal",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "cucumber formatter for report portal",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"url": "git+https://github.com/qavajs/format-report-portal.git"
|
|
12
12
|
},
|
|
13
13
|
"authors": [
|
|
14
|
-
"Alexandr Galichenko"
|
|
14
|
+
"Alexandr Galichenko",
|
|
15
|
+
"Alexandr Legchilov"
|
|
15
16
|
],
|
|
16
17
|
"license": "MIT",
|
|
17
18
|
"bugs": {
|
|
@@ -22,10 +23,8 @@
|
|
|
22
23
|
"@reportportal/client-javascript": "^5.0.8"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
|
-
"@cucumber/cucumber": "^9.
|
|
26
|
-
"@qavajs/cli": "^0.0.
|
|
27
|
-
"@qavajs/memory": "^1.
|
|
28
|
-
"@qavajs/po-playwright": "^0.0.7",
|
|
29
|
-
"@qavajs/steps-playwright": "^0.0.14"
|
|
26
|
+
"@cucumber/cucumber": "^9.1.0",
|
|
27
|
+
"@qavajs/cli": "^0.0.21",
|
|
28
|
+
"@qavajs/memory": "^1.3.0"
|
|
30
29
|
}
|
|
31
30
|
}
|