cucumberjs-qase-reporter 2.0.1 → 2.0.3
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 +32 -0
- package/dist/models.d.ts +1 -0
- package/dist/storage.d.ts +2 -0
- package/dist/storage.js +55 -13
- package/package.json +3 -2
package/changelog.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
# qase-cucumberjs@2.0.3
|
|
2
|
+
|
|
3
|
+
## What's new
|
|
4
|
+
|
|
5
|
+
Support attachments in the test results.
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
const { Given, Then } = require('cucumber');
|
|
9
|
+
|
|
10
|
+
Given('I have a step with attachment', async function () {
|
|
11
|
+
await this.attach('Hello, world!', 'text/plain');
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
Then('I have a step with attachment', async function () {
|
|
15
|
+
await this.attach('Hello, world!', 'text/plain');
|
|
16
|
+
});
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
# qase-cucumberjs@2.0.2
|
|
20
|
+
|
|
21
|
+
## What's new
|
|
22
|
+
|
|
23
|
+
- Support `QaseIgnore` tag. If the test case has the `QaseIgnore` tag, the reporter will not send the result to the Qase
|
|
24
|
+
TMS.
|
|
25
|
+
|
|
26
|
+
```cucumber
|
|
27
|
+
@QaseIgnore
|
|
28
|
+
Scenario: simple test
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- Improved error handling.
|
|
32
|
+
|
|
1
33
|
# qase-cucumberjs@2.0.0
|
|
2
34
|
|
|
3
35
|
## What's new
|
package/dist/models.d.ts
CHANGED
package/dist/storage.d.ts
CHANGED
package/dist/storage.js
CHANGED
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Storage = void 0;
|
|
4
4
|
const qase_javascript_commons_1 = require("qase-javascript-commons");
|
|
5
5
|
const cucumber_1 = require("@cucumber/cucumber");
|
|
6
|
+
const uuid_1 = require("uuid");
|
|
6
7
|
const qaseIdRegExp = /^@[Qq]-?(\d+)$/g;
|
|
7
8
|
const newQaseIdRegExp = /^@[Qq]ase[Ii][Dd]=(\d+)$/g;
|
|
8
9
|
const qaseTitleRegExp = /^@[Qq]ase[Tt]itle=(.+)$/g;
|
|
9
10
|
const qaseFieldsRegExp = /^@[Qq]ase[Ff]ields:(.+?)=(.+)$/g;
|
|
11
|
+
const qaseIgnoreRegExp = /^@[Qq]ase[Ii][Gg][Nn][Oo][Rr][Ee]$/g;
|
|
10
12
|
class Storage {
|
|
11
13
|
constructor() {
|
|
12
14
|
/**
|
|
@@ -76,17 +78,17 @@ class Storage {
|
|
|
76
78
|
* @param {Attach} attachment
|
|
77
79
|
*/
|
|
78
80
|
addAttachment(attachment) {
|
|
79
|
-
if (attachment.
|
|
80
|
-
if (!this.attachments[attachment.
|
|
81
|
-
this.attachments[attachment.
|
|
81
|
+
if (attachment.testStepId) {
|
|
82
|
+
if (!this.attachments[attachment.testStepId]) {
|
|
83
|
+
this.attachments[attachment.testStepId] = [];
|
|
82
84
|
}
|
|
83
|
-
this.attachments[attachment.
|
|
84
|
-
file_name: attachment.
|
|
85
|
+
this.attachments[attachment.testStepId]?.push({
|
|
86
|
+
file_name: this.getFileNameFromMediaType(attachment.mediaType),
|
|
85
87
|
mime_type: attachment.mediaType,
|
|
86
88
|
file_path: null,
|
|
87
89
|
content: attachment.body,
|
|
88
90
|
size: 0,
|
|
89
|
-
id:
|
|
91
|
+
id: (0, uuid_1.v4)(),
|
|
90
92
|
});
|
|
91
93
|
}
|
|
92
94
|
}
|
|
@@ -150,10 +152,11 @@ class Storage {
|
|
|
150
152
|
if (!pickle) {
|
|
151
153
|
return undefined;
|
|
152
154
|
}
|
|
153
|
-
|
|
154
|
-
if (
|
|
155
|
-
|
|
155
|
+
const metadata = this.parseTags(pickle.tags);
|
|
156
|
+
if (metadata.isIgnore) {
|
|
157
|
+
return undefined;
|
|
156
158
|
}
|
|
159
|
+
const error = this.getError(tcs.id);
|
|
157
160
|
let relations = null;
|
|
158
161
|
const nodeId = pickle.astNodeIds[pickle.astNodeIds.length - 1];
|
|
159
162
|
if (nodeId != undefined && this.scenarios[nodeId] != undefined) {
|
|
@@ -168,7 +171,6 @@ class Storage {
|
|
|
168
171
|
},
|
|
169
172
|
};
|
|
170
173
|
}
|
|
171
|
-
const metadata = this.parseTags(pickle.tags);
|
|
172
174
|
return {
|
|
173
175
|
attachments: [],
|
|
174
176
|
author: null,
|
|
@@ -177,11 +179,11 @@ class Storage {
|
|
|
177
179
|
start_time: null,
|
|
178
180
|
end_time: null,
|
|
179
181
|
duration: Math.abs(testCase.timestamp.seconds - tcs.timestamp.seconds),
|
|
180
|
-
stacktrace: error?.
|
|
182
|
+
stacktrace: error?.stacktrace ?? null,
|
|
181
183
|
thread: null,
|
|
182
184
|
},
|
|
183
185
|
fields: metadata.fields,
|
|
184
|
-
message: null,
|
|
186
|
+
message: error?.message ?? null,
|
|
185
187
|
muted: false,
|
|
186
188
|
params: {},
|
|
187
189
|
group_params: {},
|
|
@@ -226,7 +228,7 @@ class Storage {
|
|
|
226
228
|
end_time: null,
|
|
227
229
|
duration: finished.testStepResult.duration.seconds,
|
|
228
230
|
},
|
|
229
|
-
attachments: [],
|
|
231
|
+
attachments: this.attachments[s.id] ?? [],
|
|
230
232
|
steps: [],
|
|
231
233
|
parent_id: null,
|
|
232
234
|
};
|
|
@@ -239,6 +241,7 @@ class Storage {
|
|
|
239
241
|
ids: [],
|
|
240
242
|
fields: {},
|
|
241
243
|
title: null,
|
|
244
|
+
isIgnore: false,
|
|
242
245
|
};
|
|
243
246
|
for (const tag of tags) {
|
|
244
247
|
if (qaseIdRegExp.test(tag.name)) {
|
|
@@ -264,6 +267,9 @@ class Storage {
|
|
|
264
267
|
// do nothing
|
|
265
268
|
}
|
|
266
269
|
}
|
|
270
|
+
if (qaseIgnoreRegExp.test(tag.name)) {
|
|
271
|
+
metadata.isIgnore = true;
|
|
272
|
+
}
|
|
267
273
|
}
|
|
268
274
|
return metadata;
|
|
269
275
|
}
|
|
@@ -281,6 +287,42 @@ class Storage {
|
|
|
281
287
|
}
|
|
282
288
|
return signature;
|
|
283
289
|
}
|
|
290
|
+
getError(testCaseId) {
|
|
291
|
+
const testErrors = this.testCaseStartedErrors[testCaseId];
|
|
292
|
+
if (!testErrors) {
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
const error = new qase_javascript_commons_1.CompoundError();
|
|
296
|
+
testErrors.forEach((message) => {
|
|
297
|
+
error.addMessage(message);
|
|
298
|
+
error.addStacktrace(message);
|
|
299
|
+
});
|
|
300
|
+
return error;
|
|
301
|
+
}
|
|
302
|
+
getFileNameFromMediaType(mediaType) {
|
|
303
|
+
const extensions = {
|
|
304
|
+
'text/plain': 'txt',
|
|
305
|
+
'application/json': 'json',
|
|
306
|
+
'image/png': 'png',
|
|
307
|
+
'image/jpeg': 'jpg',
|
|
308
|
+
'image/gif': 'gif',
|
|
309
|
+
'text/html': 'html',
|
|
310
|
+
'application/pdf': 'pdf',
|
|
311
|
+
'application/xml': 'xml',
|
|
312
|
+
'application/zip': 'zip',
|
|
313
|
+
'application/msword': 'doc',
|
|
314
|
+
'application/vnd.ms-excel': 'xls',
|
|
315
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'docx',
|
|
316
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xlsx',
|
|
317
|
+
};
|
|
318
|
+
const extension = extensions[mediaType];
|
|
319
|
+
if (extension) {
|
|
320
|
+
return `file.${extension}`;
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
return 'file';
|
|
324
|
+
}
|
|
325
|
+
}
|
|
284
326
|
}
|
|
285
327
|
exports.Storage = Storage;
|
|
286
328
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cucumberjs-qase-reporter",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Qase TMS CucumberJS Reporter",
|
|
5
5
|
"homepage": "https://github.com/qase-tms/qase-javascript",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"@jest/globals": "^29.5.0",
|
|
50
50
|
"@types/jest": "^29.5.2",
|
|
51
51
|
"jest": "^29.5.0",
|
|
52
|
-
"ts-jest": "^29.1.0"
|
|
52
|
+
"ts-jest": "^29.1.0",
|
|
53
|
+
"uuid": "^9.0.0"
|
|
53
54
|
}
|
|
54
55
|
}
|