@qavajs/format-report-portal 0.0.5 → 0.0.6

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.
Files changed (3) hide show
  1. package/CHANGELOG.MD +3 -0
  2. package/index.js +28 -15
  3. package/package.json +3 -5
package/CHANGELOG.MD CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.0.6
2
+ - :rocket: enable support of cucumber logs
3
+
1
4
  ## 0.0.5
2
5
  - :rocket: updated step logging as nested steps instead plain logs
3
6
  - :beetle: added capability to attach multiple attachment to step
package/index.js CHANGED
@@ -104,18 +104,7 @@ class RPFormatter extends Formatter {
104
104
  }
105
105
  if (step.attachment) {
106
106
  for (const attachment of step.attachment) {
107
- const attachmentData = {
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;
107
+ await this.sendAttachment(attachment, nestedTestItem);
119
108
  }
120
109
  }
121
110
  const nestedItemFinish = this.rpClient.finishTestItem(nestedTestItem.tempId, {
@@ -167,10 +156,11 @@ class RPFormatter extends Formatter {
167
156
  }
168
157
 
169
158
  getStatus(step) {
170
- if (step.result.status !== Status.PASSED) {
171
- return Status.FAILED.toLowerCase()
159
+ switch (step.result.status) {
160
+ case Status.PASSED: return Status.PASSED.toLowerCase();
161
+ case Status.SKIPPED: return Status.SKIPPED.toLowerCase();
162
+ default: return Status.FAILED.toLowerCase()
172
163
  }
173
- return Status.PASSED.toLowerCase()
174
164
  }
175
165
 
176
166
  formatTable(dataTable) {
@@ -196,6 +186,29 @@ class RPFormatter extends Formatter {
196
186
  : attachment.body
197
187
  }
198
188
 
189
+ async sendAttachment(attachment, testItem) {
190
+ let log;
191
+ if (attachment.mediaType === 'text/x.cucumber.log+plain') {
192
+ log = await this.rpClient.sendLog(testItem.tempId, {
193
+ level: 'INFO',
194
+ message: attachment.body,
195
+ time: this.rpClient.helpers.now()
196
+ });
197
+ } else {
198
+ const attachmentData = {
199
+ name: 'attachment',
200
+ type: attachment.mediaType,
201
+ content: this.prepareContent(attachment),
202
+ };
203
+ log = await this.rpClient.sendLog(testItem.tempId, {
204
+ level: 'INFO',
205
+ message: 'Attachment',
206
+ time: this.rpClient.helpers.now()
207
+ }, attachmentData);
208
+ }
209
+ this.promiseQ.push(log.promise);
210
+ await log.promise;
211
+ }
199
212
  }
200
213
 
201
214
  module.exports = RPFormatter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qavajs/format-report-portal",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "cucumber formatter for report portal",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,9 +23,7 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "@cucumber/cucumber": "^9.0.0",
26
- "@qavajs/cli": "^0.0.18",
27
- "@qavajs/memory": "^1.2.0",
28
- "@qavajs/po-playwright": "^0.0.7",
29
- "@qavajs/steps-playwright": "^0.0.14"
26
+ "@qavajs/cli": "^0.0.19",
27
+ "@qavajs/memory": "^1.2.0"
30
28
  }
31
29
  }