@elisra-devops/docgen-data-provider 1.93.0 → 1.94.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.
@@ -201,6 +201,7 @@ export default class ResultDataProvider {
201
201
  private fetchTestCasesBySuiteId;
202
202
  private attachSuiteTestCaseContextToPoints;
203
203
  private extractWorkItemFieldsMap;
204
+ private getFieldValueByName;
204
205
  private resolveSuiteTestCaseRevision;
205
206
  private buildWorkItemSnapshotFromSuiteTestCase;
206
207
  private fetchWorkItemByRevision;
@@ -2516,7 +2516,7 @@ class ResultDataProvider {
2516
2516
  }
2517
2517
  // Fetch detailed information for each test point and map to required format
2518
2518
  const detailedPoints = await Promise.all(latestPoints.map(async (point) => {
2519
- const url = `${point.url}?witFields=Microsoft.VSTS.TCM.Steps&includePointDetails=true`;
2519
+ const url = `${point.url}?witFields=Microsoft.VSTS.TCM.Steps,System.Rev&includePointDetails=true`;
2520
2520
  const detailedPoint = await tfs_1.TFSServices.getItemContent(url, this.token);
2521
2521
  return this.mapTestPointForCrossPlans(detailedPoint, projectName);
2522
2522
  // return this.mapTestPointForCrossPlans(detailedPoint, projectName);
@@ -2597,7 +2597,7 @@ class ResultDataProvider {
2597
2597
  * Fetches test cases by suite ID.
2598
2598
  */
2599
2599
  async fetchTestCasesBySuiteId(projectName, testPlanId, suiteId) {
2600
- const url = `${this.orgUrl}${projectName}/_apis/testplan/Plans/${testPlanId}/Suites/${suiteId}/TestCase?witFields=Microsoft.VSTS.TCM.Steps`;
2600
+ const url = `${this.orgUrl}${projectName}/_apis/testplan/Plans/${testPlanId}/Suites/${suiteId}/TestCase?witFields=Microsoft.VSTS.TCM.Steps,System.Rev`;
2601
2601
  const { value: testCases } = await tfs_1.TFSServices.getItemContent(url, this.token);
2602
2602
  return testCases;
2603
2603
  }
@@ -2639,14 +2639,32 @@ class ResultDataProvider {
2639
2639
  }
2640
2640
  return fields;
2641
2641
  }
2642
+ getFieldValueByName(fields, fieldName) {
2643
+ if (!fields || typeof fields !== 'object')
2644
+ return undefined;
2645
+ if (Object.prototype.hasOwnProperty.call(fields, fieldName)) {
2646
+ return fields[fieldName];
2647
+ }
2648
+ const lookupName = String(fieldName || '').toLowerCase().trim();
2649
+ if (!lookupName)
2650
+ return undefined;
2651
+ const matchedKey = Object.keys(fields).find((key) => String(key || '').toLowerCase().trim() === lookupName);
2652
+ return matchedKey ? fields[matchedKey] : undefined;
2653
+ }
2642
2654
  resolveSuiteTestCaseRevision(testCaseItem) {
2643
- var _a, _b, _c, _d, _e;
2655
+ var _a, _b, _c, _d, _e, _f, _g;
2656
+ const fieldsFromList = this.extractWorkItemFieldsMap((_a = testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.workItem) === null || _a === void 0 ? void 0 : _a.workItemFields);
2657
+ const fieldsFromMap = ((_b = testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.workItem) === null || _b === void 0 ? void 0 : _b.fields) || {};
2658
+ const systemRevFromList = this.getFieldValueByName(fieldsFromList, 'System.Rev');
2659
+ const systemRevFromMap = this.getFieldValueByName(fieldsFromMap, 'System.Rev');
2644
2660
  const revisionCandidates = [
2645
- (_a = testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.workItem) === null || _a === void 0 ? void 0 : _a.rev,
2646
- (_b = testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.workItem) === null || _b === void 0 ? void 0 : _b.revision,
2647
- (_c = testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.workItem) === null || _c === void 0 ? void 0 : _c.version,
2648
- (_d = testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.workItem) === null || _d === void 0 ? void 0 : _d.workItemRevision,
2649
- (_e = testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.workItem) === null || _e === void 0 ? void 0 : _e.workItemVersion,
2661
+ systemRevFromList,
2662
+ systemRevFromMap,
2663
+ (_c = testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.workItem) === null || _c === void 0 ? void 0 : _c.rev,
2664
+ (_d = testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.workItem) === null || _d === void 0 ? void 0 : _d.revision,
2665
+ (_e = testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.workItem) === null || _e === void 0 ? void 0 : _e.version,
2666
+ (_f = testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.workItem) === null || _f === void 0 ? void 0 : _f.workItemRevision,
2667
+ (_g = testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.workItem) === null || _g === void 0 ? void 0 : _g.workItemVersion,
2650
2668
  testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.revision,
2651
2669
  testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.workItemRevision,
2652
2670
  testCaseItem === null || testCaseItem === void 0 ? void 0 : testCaseItem.workItemVersion,