@testomatio/reporter 1.4.1 → 1.4.2-beta-specflow-compat.2
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/lib/fileUploader.js +3 -3
- package/lib/junit-adapter/csharp.js +1 -0
- package/lib/xmlReader.js +30 -5
- package/package.json +1 -1
package/lib/fileUploader.js
CHANGED
|
@@ -103,9 +103,9 @@ const uploadUsingS3 = async (filePath, runId) => {
|
|
|
103
103
|
let Key;
|
|
104
104
|
|
|
105
105
|
if (typeof filePath === 'object') {
|
|
106
|
-
ContentType = filePath
|
|
107
|
-
filePath = filePath
|
|
108
|
-
Key = filePath
|
|
106
|
+
ContentType = filePath.type;
|
|
107
|
+
filePath = filePath.path;
|
|
108
|
+
Key = filePath.name;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
const { TESTOMATIO_PRIVATE_ARTIFACTS, S3_BUCKET } = getConfig();
|
package/lib/xmlReader.js
CHANGED
|
@@ -429,6 +429,7 @@ function reduceTestCases(prev, item) {
|
|
|
429
429
|
.forEach(testCaseItem => {
|
|
430
430
|
const file = testCaseItem.file || item.filepath || '';
|
|
431
431
|
|
|
432
|
+
|
|
432
433
|
let stack = '';
|
|
433
434
|
let message = '';
|
|
434
435
|
if (testCaseItem.error) stack = testCaseItem.error;
|
|
@@ -441,6 +442,15 @@ function reduceTestCases(prev, item) {
|
|
|
441
442
|
if (testCaseItem.error && testCaseItem.error['#text']) stack = testCaseItem.error['#text'];
|
|
442
443
|
if (!message) message = stack.trim().split('\n')[0];
|
|
443
444
|
|
|
445
|
+
// SpecFlow config
|
|
446
|
+
let { title, tags } = fetchProperties(item.type === 'ParameterizedMethod' ? item : testCaseItem);
|
|
447
|
+
|
|
448
|
+
title ||= testCaseItem.name || testCaseItem.methodname || testCaseItem.classname;
|
|
449
|
+
tags ||= [];
|
|
450
|
+
|
|
451
|
+
let example = testCaseItem.name.match(/\((.*?)\)/);
|
|
452
|
+
if (example) example = { ...example[1].split(',') };
|
|
453
|
+
|
|
444
454
|
// eslint-disable-next-line
|
|
445
455
|
stack = `${
|
|
446
456
|
testCaseItem['system-out'] || testCaseItem.output || testCaseItem.log || ''
|
|
@@ -455,13 +465,15 @@ function reduceTestCases(prev, item) {
|
|
|
455
465
|
create: true,
|
|
456
466
|
file,
|
|
457
467
|
stack,
|
|
468
|
+
example,
|
|
469
|
+
tags,
|
|
458
470
|
test_id: testId,
|
|
459
471
|
message,
|
|
460
472
|
line: testCaseItem.lineno,
|
|
461
473
|
// seconds are used in junit reports, but ms are used by testomatio
|
|
462
474
|
run_time: parseFloat(testCaseItem.time || testCaseItem.duration) * 1000,
|
|
463
475
|
status,
|
|
464
|
-
title
|
|
476
|
+
title,
|
|
465
477
|
suite_title: reduceOptions.preferClassname ? testCaseItem.classname : item.name || testCaseItem.classname,
|
|
466
478
|
});
|
|
467
479
|
});
|
|
@@ -471,14 +483,27 @@ function reduceTestCases(prev, item) {
|
|
|
471
483
|
function processTestSuite(testsuite) {
|
|
472
484
|
if (!testsuite) return [];
|
|
473
485
|
if (testsuite.testsuite) return processTestSuite(testsuite.testsuite);
|
|
474
|
-
if (testsuite['test-suite']) return processTestSuite(testsuite['test-suite']);
|
|
475
|
-
|
|
486
|
+
if (testsuite['test-suite'] && !testsuite['test-case']) return processTestSuite(testsuite['test-suite']);
|
|
487
|
+
|
|
476
488
|
let suites = testsuite;
|
|
477
489
|
if (!Array.isArray(testsuite)) {
|
|
478
490
|
suites = [testsuite];
|
|
479
491
|
}
|
|
492
|
+
if (testsuite['test-suite']) suites.push(testsuite['test-suite']);
|
|
480
493
|
|
|
481
|
-
const res = suites.reduce(reduceTestCases, []);
|
|
482
|
-
|
|
494
|
+
const res = suites.flat().reduce(reduceTestCases, []);
|
|
495
|
+
|
|
483
496
|
return res;
|
|
484
497
|
}
|
|
498
|
+
|
|
499
|
+
function fetchProperties(item) {
|
|
500
|
+
let tags = [];
|
|
501
|
+
let title = '';
|
|
502
|
+
|
|
503
|
+
if (!item.properties) return {};
|
|
504
|
+
|
|
505
|
+
const prop = [item.properties?.property].flat().find(p => p.name === 'Description');
|
|
506
|
+
if (prop) title = prop.value;
|
|
507
|
+
[item.properties?.property].flat().filter(p => p.name === 'Category').forEach(p => tags.push(p.value));
|
|
508
|
+
return { title, tags }
|
|
509
|
+
}
|