@elisra-devops/docgen-data-provider 1.99.0 → 1.100.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/bin/modules/ResultDataProvider.d.ts +6 -0
- package/bin/modules/ResultDataProvider.js +73 -8
- package/bin/modules/ResultDataProvider.js.map +1 -1
- package/bin/tests/modules/ResultDataProvider.test.js +183 -2
- package/bin/tests/modules/ResultDataProvider.test.js.map +1 -1
- package/package.json +1 -1
- package/src/modules/ResultDataProvider.ts +87 -9
- package/src/tests/modules/ResultDataProvider.test.ts +207 -2
|
@@ -338,6 +338,12 @@ export default class ResultDataProvider {
|
|
|
338
338
|
* Creates a mapping of iterations by their unique keys.
|
|
339
339
|
*/
|
|
340
340
|
private createIterationsMap;
|
|
341
|
+
/**
|
|
342
|
+
* Builds a stable lookup key for joining points to fetched iteration payloads.
|
|
343
|
+
* Run-backed items are keyed by run/result/testCase, while runless items prefer
|
|
344
|
+
* testPointId to avoid collisions across suites that share the same testCaseId.
|
|
345
|
+
*/
|
|
346
|
+
private buildIterationLookupKey;
|
|
341
347
|
/**
|
|
342
348
|
* Fetches test data for all suites, including test points and test cases.
|
|
343
349
|
*/
|
|
@@ -3534,10 +3534,30 @@ class ResultDataProvider {
|
|
|
3534
3534
|
continue;
|
|
3535
3535
|
}
|
|
3536
3536
|
}
|
|
3537
|
-
const iterationKey =
|
|
3538
|
-
|
|
3539
|
-
:
|
|
3540
|
-
|
|
3537
|
+
const iterationKey = this.buildIterationLookupKey({
|
|
3538
|
+
testCaseId: testCase.workItem.id,
|
|
3539
|
+
lastRunId: point === null || point === void 0 ? void 0 : point.lastRunId,
|
|
3540
|
+
lastResultId: point === null || point === void 0 ? void 0 : point.lastResultId,
|
|
3541
|
+
testPointId: point === null || point === void 0 ? void 0 : point.testPointId,
|
|
3542
|
+
testCaseRevision: this.resolveSuiteTestCaseRevision(testCase) ||
|
|
3543
|
+
this.resolveSuiteTestCaseRevision(point === null || point === void 0 ? void 0 : point.suiteTestCase),
|
|
3544
|
+
});
|
|
3545
|
+
const fallbackRevision = Number(this.resolveSuiteTestCaseRevision(testCase) ||
|
|
3546
|
+
this.resolveSuiteTestCaseRevision(point === null || point === void 0 ? void 0 : point.suiteTestCase) ||
|
|
3547
|
+
0);
|
|
3548
|
+
const fallbackRevisionKey = Number.isFinite(fallbackRevision) && fallbackRevision > 0
|
|
3549
|
+
? this.buildIterationLookupKey({
|
|
3550
|
+
testCaseId: testCase.workItem.id,
|
|
3551
|
+
testCaseRevision: fallbackRevision,
|
|
3552
|
+
})
|
|
3553
|
+
: '';
|
|
3554
|
+
const fallbackCaseOnlyKey = `${testCase.workItem.id}`;
|
|
3555
|
+
const fetchedTestCase = iterationsMap[iterationKey] ||
|
|
3556
|
+
(fallbackRevisionKey && fallbackRevisionKey !== iterationKey
|
|
3557
|
+
? iterationsMap[fallbackRevisionKey]
|
|
3558
|
+
: undefined) ||
|
|
3559
|
+
(iterationKey !== fallbackCaseOnlyKey ? iterationsMap[fallbackCaseOnlyKey] : undefined) ||
|
|
3560
|
+
(includeNotRunTestCases ? testCase : undefined);
|
|
3541
3561
|
// First check if fetchedTestCase exists
|
|
3542
3562
|
if (!fetchedTestCase)
|
|
3543
3563
|
continue;
|
|
@@ -3649,23 +3669,67 @@ class ResultDataProvider {
|
|
|
3649
3669
|
(iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.lastResultId) !== null &&
|
|
3650
3670
|
String(iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.lastResultId).trim() !== '';
|
|
3651
3671
|
if (hasRunIdentifiers) {
|
|
3652
|
-
const key =
|
|
3672
|
+
const key = this.buildIterationLookupKey({
|
|
3673
|
+
testCaseId: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.testCaseId,
|
|
3674
|
+
lastRunId: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.lastRunId,
|
|
3675
|
+
lastResultId: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.lastResultId,
|
|
3676
|
+
testPointId: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.testPointId,
|
|
3677
|
+
testCaseRevision: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.testCaseRevision,
|
|
3678
|
+
});
|
|
3653
3679
|
map[key] = iterationItem;
|
|
3654
3680
|
}
|
|
3655
3681
|
else if (includeNotRunTestCases) {
|
|
3656
|
-
const key =
|
|
3682
|
+
const key = this.buildIterationLookupKey({
|
|
3683
|
+
testCaseId: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.testCaseId,
|
|
3684
|
+
lastRunId: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.lastRunId,
|
|
3685
|
+
lastResultId: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.lastResultId,
|
|
3686
|
+
testPointId: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.testPointId,
|
|
3687
|
+
testCaseRevision: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.testCaseRevision,
|
|
3688
|
+
});
|
|
3657
3689
|
map[key] = iterationItem;
|
|
3658
3690
|
if (isTestReporter && (iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.iteration)) {
|
|
3659
|
-
logger_1.default.debug(`[RunlessResolver] createIterationsMap: mapped runless testCaseId=${String(iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.testCaseId)} to
|
|
3691
|
+
logger_1.default.debug(`[RunlessResolver] createIterationsMap: mapped runless testCaseId=${String(iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.testCaseId)} to key=${key}`);
|
|
3660
3692
|
}
|
|
3661
3693
|
}
|
|
3662
3694
|
else if ((iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.iteration) && !isTestReporter) {
|
|
3663
|
-
const key =
|
|
3695
|
+
const key = this.buildIterationLookupKey({
|
|
3696
|
+
testCaseId: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.testCaseId,
|
|
3697
|
+
lastRunId: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.lastRunId,
|
|
3698
|
+
lastResultId: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.lastResultId,
|
|
3699
|
+
testPointId: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.testPointId,
|
|
3700
|
+
testCaseRevision: iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.testCaseRevision,
|
|
3701
|
+
});
|
|
3664
3702
|
map[key] = iterationItem;
|
|
3665
3703
|
}
|
|
3666
3704
|
return map;
|
|
3667
3705
|
}, {});
|
|
3668
3706
|
}
|
|
3707
|
+
/**
|
|
3708
|
+
* Builds a stable lookup key for joining points to fetched iteration payloads.
|
|
3709
|
+
* Run-backed items are keyed by run/result/testCase, while runless items prefer
|
|
3710
|
+
* testPointId to avoid collisions across suites that share the same testCaseId.
|
|
3711
|
+
*/
|
|
3712
|
+
buildIterationLookupKey(input) {
|
|
3713
|
+
const testCaseId = Number((input === null || input === void 0 ? void 0 : input.testCaseId) || 0);
|
|
3714
|
+
const hasRunIdentifiers = (input === null || input === void 0 ? void 0 : input.lastRunId) !== undefined &&
|
|
3715
|
+
(input === null || input === void 0 ? void 0 : input.lastRunId) !== null &&
|
|
3716
|
+
String(input === null || input === void 0 ? void 0 : input.lastRunId).trim() !== '' &&
|
|
3717
|
+
(input === null || input === void 0 ? void 0 : input.lastResultId) !== undefined &&
|
|
3718
|
+
(input === null || input === void 0 ? void 0 : input.lastResultId) !== null &&
|
|
3719
|
+
String(input === null || input === void 0 ? void 0 : input.lastResultId).trim() !== '';
|
|
3720
|
+
if (hasRunIdentifiers) {
|
|
3721
|
+
return `${input === null || input === void 0 ? void 0 : input.lastRunId}-${input === null || input === void 0 ? void 0 : input.lastResultId}-${testCaseId}`;
|
|
3722
|
+
}
|
|
3723
|
+
const testPointId = Number((input === null || input === void 0 ? void 0 : input.testPointId) || 0);
|
|
3724
|
+
if (Number.isFinite(testPointId) && testPointId > 0) {
|
|
3725
|
+
return `point-${testPointId}-${testCaseId}`;
|
|
3726
|
+
}
|
|
3727
|
+
const testCaseRevision = Number((input === null || input === void 0 ? void 0 : input.testCaseRevision) || 0);
|
|
3728
|
+
if (Number.isFinite(testCaseRevision) && testCaseRevision > 0) {
|
|
3729
|
+
return `rev-${testCaseId}-${testCaseRevision}`;
|
|
3730
|
+
}
|
|
3731
|
+
return `${testCaseId}`;
|
|
3732
|
+
}
|
|
3669
3733
|
/**
|
|
3670
3734
|
* Fetches test data for all suites, including test points and test cases.
|
|
3671
3735
|
*/
|
|
@@ -4326,6 +4390,7 @@ class ResultDataProvider {
|
|
|
4326
4390
|
const resultDataResponse = {
|
|
4327
4391
|
testCaseName: `${(_e = (_d = resultData === null || resultData === void 0 ? void 0 : resultData.testCase) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : ''} - ${(_g = (_f = resultData === null || resultData === void 0 ? void 0 : resultData.testCase) === null || _f === void 0 ? void 0 : _f.id) !== null && _g !== void 0 ? _g : ''}`,
|
|
4328
4392
|
testCaseId: (_h = resultData === null || resultData === void 0 ? void 0 : resultData.testCase) === null || _h === void 0 ? void 0 : _h.id,
|
|
4393
|
+
testPointId: point === null || point === void 0 ? void 0 : point.testPointId,
|
|
4329
4394
|
testSuiteName: `${(_k = (_j = resultData === null || resultData === void 0 ? void 0 : resultData.testSuite) === null || _j === void 0 ? void 0 : _j.name) !== null && _k !== void 0 ? _k : ''}`,
|
|
4330
4395
|
testSuiteId,
|
|
4331
4396
|
lastRunId,
|