@elisra-devops/docgen-data-provider 1.97.0 → 1.99.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.
@@ -3498,7 +3498,7 @@ class ResultDataProvider {
3498
3498
  * @returns An array of detailed result objects, either at the test level or step level, depending on the options.
3499
3499
  */
3500
3500
  alignStepsWithIterationsBase(testData, iterations, includeNotRunTestCases, includeItemsWithNoIterations, isTestReporter, options) {
3501
- var _a, _b, _c;
3501
+ var _a, _b, _c, _d;
3502
3502
  const detailedResults = [];
3503
3503
  if (!iterations || (iterations === null || iterations === void 0 ? void 0 : iterations.length) === 0) {
3504
3504
  return detailedResults;
@@ -3516,10 +3516,19 @@ class ResultDataProvider {
3516
3516
  }
3517
3517
  }
3518
3518
  for (const point of testItem.testPointsItems) {
3519
- const testCase = testCaseById.get(Number(point.testCaseId));
3520
- if (!testCase)
3519
+ const pointTestCaseId = Number((point === null || point === void 0 ? void 0 : point.testCaseId) || 0);
3520
+ const testCase = testCaseById.get(pointTestCaseId) || {
3521
+ workItem: { id: pointTestCaseId, workItemFields: [] },
3522
+ };
3523
+ if (!Number.isFinite(pointTestCaseId) || pointTestCaseId <= 0)
3521
3524
  continue;
3522
- if (testCase.workItem.workItemFields.length === 0) {
3525
+ if (!testCaseById.has(pointTestCaseId) && isTestReporter) {
3526
+ logger_1.default.debug(`[RunlessResolver] Missing suite testCase payload for point testCaseId=${String(pointTestCaseId)}; using point fallback for alignment`);
3527
+ }
3528
+ const testCaseWorkItemFields = Array.isArray((_d = testCase === null || testCase === void 0 ? void 0 : testCase.workItem) === null || _d === void 0 ? void 0 : _d.workItemFields)
3529
+ ? testCase.workItem.workItemFields
3530
+ : [];
3531
+ if (testCaseWorkItemFields.length === 0) {
3523
3532
  logger_1.default.warn(`Could not fetch the steps from WI ${JSON.stringify(testCase.workItem.id)}`);
3524
3533
  if (!isTestReporter) {
3525
3534
  continue;
@@ -3577,14 +3586,18 @@ class ResultDataProvider {
3577
3586
  });
3578
3587
  resultObjectsToAdd.push(resultObj);
3579
3588
  }
3580
- resultObjectsToAdd.length > 0
3581
- ? detailedResults.push(...resultObjectsToAdd)
3582
- : detailedResults.push(options.createResultObject({
3589
+ if (resultObjectsToAdd.length > 0) {
3590
+ detailedResults.push(...resultObjectsToAdd);
3591
+ }
3592
+ else {
3593
+ logger_1.default.debug(`[RunlessResolver] No step rows generated for testCaseId=${String((point === null || point === void 0 ? void 0 : point.testCaseId) || '')}; falling back to test-level row`);
3594
+ detailedResults.push(options.createResultObject({
3583
3595
  testItem,
3584
3596
  point,
3585
3597
  fetchedTestCase,
3586
3598
  filteredFields,
3587
3599
  }));
3600
+ }
3588
3601
  }
3589
3602
  }
3590
3603
  /**
@@ -3742,7 +3755,7 @@ class ResultDataProvider {
3742
3755
  * Fetches result Data for a specific test point
3743
3756
  */
3744
3757
  async fetchResultDataBase(projectName, testSuiteId, point, fetchResultMethod, createResponseObject, additionalArgs = []) {
3745
- var _a;
3758
+ var _a, _b, _c, _d, _e, _f;
3746
3759
  try {
3747
3760
  const { lastRunId, lastResultId } = point;
3748
3761
  const resultData = await fetchResultMethod(projectName, (lastRunId === null || lastRunId === void 0 ? void 0 : lastRunId.toString()) || '0', (lastResultId === null || lastResultId === void 0 ? void 0 : lastResultId.toString()) || '0', ...additionalArgs);
@@ -3767,6 +3780,7 @@ class ResultDataProvider {
3767
3780
  });
3768
3781
  }
3769
3782
  const stepsList = await this.testStepParserHelper.parseTestSteps(resultData.stepsResultXml, sharedStepIdToRevisionLookupMap);
3783
+ logger_1.default.debug(`[RunlessResolver] TC ${String((point === null || point === void 0 ? void 0 : point.testCaseId) || ((_b = resultData === null || resultData === void 0 ? void 0 : resultData.testCase) === null || _b === void 0 ? void 0 : _b.id) || '')}: parseTestSteps xmlLength=${String(String(resultData.stepsResultXml || '').length)}, parsedSteps=${String(stepsList.length)}, actionResultsBeforeMap=${String(actionResults.length)}`);
3770
3784
  sharedStepIdToRevisionLookupMap.clear();
3771
3785
  const stepMap = new Map();
3772
3786
  for (const step of stepsList) {
@@ -3786,6 +3800,7 @@ class ResultDataProvider {
3786
3800
  iteration.actionResults = actionResults
3787
3801
  .filter((result) => result.stepPosition)
3788
3802
  .sort((a, b) => this.compareActionResults(a.stepPosition, b.stepPosition));
3803
+ logger_1.default.debug(`[RunlessResolver] TC ${String((point === null || point === void 0 ? void 0 : point.testCaseId) || ((_c = resultData === null || resultData === void 0 ? void 0 : resultData.testCase) === null || _c === void 0 ? void 0 : _c.id) || '')}: mappedActionResults=${String(((_d = iteration.actionResults) === null || _d === void 0 ? void 0 : _d.length) || 0)} (from existing iteration actionResults)`);
3789
3804
  }
3790
3805
  else {
3791
3806
  // Fallback for runs that have no action results: emit test definition steps as Not Run.
@@ -3805,6 +3820,7 @@ class ResultDataProvider {
3805
3820
  });
3806
3821
  })
3807
3822
  .sort((a, b) => this.compareActionResults(a.stepPosition, b.stepPosition));
3823
+ logger_1.default.debug(`[RunlessResolver] TC ${String((point === null || point === void 0 ? void 0 : point.testCaseId) || ((_e = resultData === null || resultData === void 0 ? void 0 : resultData.testCase) === null || _e === void 0 ? void 0 : _e.id) || '')}: fallbackActionResults=${String(((_f = iteration.actionResults) === null || _f === void 0 ? void 0 : _f.length) || 0)} (from parsed steps)`);
3808
3824
  }
3809
3825
  }
3810
3826
  return (resultData === null || resultData === void 0 ? void 0 : resultData.testCase)