@elisra-devops/docgen-data-provider 1.96.0 → 1.98.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.
@@ -3577,14 +3577,18 @@ class ResultDataProvider {
3577
3577
  });
3578
3578
  resultObjectsToAdd.push(resultObj);
3579
3579
  }
3580
- resultObjectsToAdd.length > 0
3581
- ? detailedResults.push(...resultObjectsToAdd)
3582
- : detailedResults.push(options.createResultObject({
3580
+ if (resultObjectsToAdd.length > 0) {
3581
+ detailedResults.push(...resultObjectsToAdd);
3582
+ }
3583
+ else {
3584
+ 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`);
3585
+ detailedResults.push(options.createResultObject({
3583
3586
  testItem,
3584
3587
  point,
3585
3588
  fetchedTestCase,
3586
3589
  filteredFields,
3587
3590
  }));
3591
+ }
3588
3592
  }
3589
3593
  }
3590
3594
  /**
@@ -3629,14 +3633,26 @@ class ResultDataProvider {
3629
3633
  */
3630
3634
  createIterationsMap(iterations, isTestReporter, includeNotRunTestCases) {
3631
3635
  return iterations.reduce((map, iterationItem) => {
3632
- if ((isTestReporter && iterationItem.lastRunId && iterationItem.lastResultId) ||
3633
- iterationItem.iteration) {
3636
+ const hasRunIdentifiers = (iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.lastRunId) !== undefined &&
3637
+ (iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.lastRunId) !== null &&
3638
+ String(iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.lastRunId).trim() !== '' &&
3639
+ (iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.lastResultId) !== undefined &&
3640
+ (iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.lastResultId) !== null &&
3641
+ String(iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.lastResultId).trim() !== '';
3642
+ if (hasRunIdentifiers) {
3634
3643
  const key = `${iterationItem.lastRunId}-${iterationItem.lastResultId}-${iterationItem.testCaseId}`;
3635
3644
  map[key] = iterationItem;
3636
3645
  }
3637
3646
  else if (includeNotRunTestCases) {
3638
3647
  const key = `${iterationItem.testCaseId}`;
3639
3648
  map[key] = iterationItem;
3649
+ if (isTestReporter && (iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.iteration)) {
3650
+ logger_1.default.debug(`[RunlessResolver] createIterationsMap: mapped runless testCaseId=${String(iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.testCaseId)} to case-only key`);
3651
+ }
3652
+ }
3653
+ else if ((iterationItem === null || iterationItem === void 0 ? void 0 : iterationItem.iteration) && !isTestReporter) {
3654
+ const key = `${iterationItem.lastRunId}-${iterationItem.lastResultId}-${iterationItem.testCaseId}`;
3655
+ map[key] = iterationItem;
3640
3656
  }
3641
3657
  return map;
3642
3658
  }, {});
@@ -3730,7 +3746,7 @@ class ResultDataProvider {
3730
3746
  * Fetches result Data for a specific test point
3731
3747
  */
3732
3748
  async fetchResultDataBase(projectName, testSuiteId, point, fetchResultMethod, createResponseObject, additionalArgs = []) {
3733
- var _a;
3749
+ var _a, _b, _c, _d, _e, _f;
3734
3750
  try {
3735
3751
  const { lastRunId, lastResultId } = point;
3736
3752
  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);
@@ -3755,6 +3771,7 @@ class ResultDataProvider {
3755
3771
  });
3756
3772
  }
3757
3773
  const stepsList = await this.testStepParserHelper.parseTestSteps(resultData.stepsResultXml, sharedStepIdToRevisionLookupMap);
3774
+ 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)}`);
3758
3775
  sharedStepIdToRevisionLookupMap.clear();
3759
3776
  const stepMap = new Map();
3760
3777
  for (const step of stepsList) {
@@ -3774,6 +3791,7 @@ class ResultDataProvider {
3774
3791
  iteration.actionResults = actionResults
3775
3792
  .filter((result) => result.stepPosition)
3776
3793
  .sort((a, b) => this.compareActionResults(a.stepPosition, b.stepPosition));
3794
+ 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)`);
3777
3795
  }
3778
3796
  else {
3779
3797
  // Fallback for runs that have no action results: emit test definition steps as Not Run.
@@ -3793,6 +3811,7 @@ class ResultDataProvider {
3793
3811
  });
3794
3812
  })
3795
3813
  .sort((a, b) => this.compareActionResults(a.stepPosition, b.stepPosition));
3814
+ 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)`);
3796
3815
  }
3797
3816
  }
3798
3817
  return (resultData === null || resultData === void 0 ? void 0 : resultData.testCase)