@elisra-devops/docgen-data-provider 1.132.0 → 1.134.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.
@@ -60,7 +60,7 @@ export default class ResultDataProvider {
60
60
  *
61
61
  * @throws Will log an error if any step in the process fails.
62
62
  */
63
- getTestReporterResults(testPlanId: string, projectName: string, selectedSuiteIds: number[], selectedFields: string[], allowCrossTestPlan: boolean, enableRunTestCaseFilter: boolean, enableRunStepStatusFilter: boolean, linkedQueryRequest: any, errorFilterMode?: string, includeAllHistory?: boolean): Promise<any[] | undefined>;
63
+ getTestReporterResults(testPlanId: string, projectName: string, selectedSuiteIds: number[], selectedFields: string[], allowCrossTestPlan: boolean, enableRunTestCaseFilter: boolean, enableRunStepStatusFilter: boolean, linkedQueryRequest: any, errorFilterMode?: string, includeAllHistory?: boolean, useLatestTestCaseProperties?: boolean): Promise<any[] | undefined>;
64
64
  /**
65
65
  * Fetches and processes a flat list of test reporter rows for a given test plan.
66
66
  * Returns raw row data suitable for post-processing/formatting by the caller.
@@ -192,7 +192,7 @@ class ResultDataProvider {
192
192
  *
193
193
  * @throws Will log an error if any step in the process fails.
194
194
  */
195
- async getTestReporterResults(testPlanId, projectName, selectedSuiteIds, selectedFields, allowCrossTestPlan, enableRunTestCaseFilter, enableRunStepStatusFilter, linkedQueryRequest, errorFilterMode = 'none', includeAllHistory = false) {
195
+ async getTestReporterResults(testPlanId, projectName, selectedSuiteIds, selectedFields, allowCrossTestPlan, enableRunTestCaseFilter, enableRunStepStatusFilter, linkedQueryRequest, errorFilterMode = 'none', includeAllHistory = false, useLatestTestCaseProperties = false) {
196
196
  var _a;
197
197
  const fetchedTestResults = [];
198
198
  logger_1.default.debug(`Fetching test reporter results for test plan ID: ${testPlanId}, project name: ${projectName}`);
@@ -212,7 +212,7 @@ class ResultDataProvider {
212
212
  await ticketsDataProvider.GetQueryResultsFromWiql(linkedQueryRequest.testAssociatedQuery.wiql.href, true, this.testToAssociatedItemMap);
213
213
  this.querySelectedColumns = linkedQueryRequest.testAssociatedQuery.columns;
214
214
  }
215
- const runResults = await this.fetchAllResultDataTestReporter(testData, projectName, selectedFields, isQueryMode, includeAllHistory);
215
+ const runResults = await this.fetchAllResultDataTestReporter(testData, projectName, selectedFields, isQueryMode, includeAllHistory, false, useLatestTestCaseProperties);
216
216
  logger_1.default.debug(`Aligning steps with iterations for test reporter results`);
217
217
  const testReporterData = this.alignStepsWithIterationsTestReporter(testData, runResults, selectedFields, !enableRunTestCaseFilter);
218
218
  // Apply filters sequentially based on enabled flags
@@ -3012,8 +3012,13 @@ class ResultDataProvider {
3012
3012
  * Resolves runless test case data using ordered fallbacks:
3013
3013
  * 1) point-based `asOf` snapshot, 2) explicit revision, 3) suite payload snapshot, 4) latest WI.
3014
3014
  */
3015
- async resolveRunlessTestCaseData(projectName, testCaseId, suiteTestCaseRevision, pointAsOfTimestamp, fallbackSnapshot, expandAll) {
3015
+ async resolveRunlessTestCaseData(projectName, testCaseId, suiteTestCaseRevision, pointAsOfTimestamp, fallbackSnapshot, expandAll, useLatestTestCaseProperties = false) {
3016
3016
  let bestSnapshotWithoutSteps = null;
3017
+ if (useLatestTestCaseProperties) {
3018
+ const latest = await this.fetchWorkItemLatest(projectName, testCaseId, expandAll);
3019
+ if (latest)
3020
+ return latest;
3021
+ }
3017
3022
  if (pointAsOfTimestamp) {
3018
3023
  const asOfSnapshot = await this.fetchWorkItemByAsOf(projectName, testCaseId, pointAsOfTimestamp, expandAll);
3019
3024
  if (asOfSnapshot) {
@@ -3055,14 +3060,14 @@ class ResultDataProvider {
3055
3060
  * @param isQueryMode - (Optional) A flag indicating whether the result data is being fetched in query mode.
3056
3061
  * @returns A promise that resolves to the fetched result data.
3057
3062
  */
3058
- async fetchResultDataBasedOnWiBase(projectName, runId, resultId, isTestReporter = false, selectedFields, isQueryMode, point, includeAllHistory = false, useRunlessAsOf = false) {
3063
+ async fetchResultDataBasedOnWiBase(projectName, runId, resultId, isTestReporter = false, selectedFields, isQueryMode, point, includeAllHistory = false, useRunlessAsOf = false, useLatestTestCaseProperties = false) {
3059
3064
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
3060
3065
  try {
3061
3066
  let filteredFields = {};
3062
3067
  let relatedRequirements = [];
3063
3068
  let relatedBugs = [];
3064
3069
  let relatedCRs = [];
3065
- if (runId === '0' || resultId === '0') {
3070
+ if (useLatestTestCaseProperties || runId === '0' || resultId === '0') {
3066
3071
  if (!point) {
3067
3072
  logger_1.default.warn(`Invalid run result ${runId} or result ${resultId}`);
3068
3073
  return null;
@@ -3074,7 +3079,7 @@ class ResultDataProvider {
3074
3079
  ? String((point === null || point === void 0 ? void 0 : point.pointAsOfTimestamp) || '').trim()
3075
3080
  : '';
3076
3081
  const fallbackSnapshot = this.buildWorkItemSnapshotFromSuiteTestCase(suiteTestCaseItem, testCaseId, String((point === null || point === void 0 ? void 0 : point.testCaseName) || ''));
3077
- const testCaseData = await this.resolveRunlessTestCaseData(projectName, testCaseId, suiteTestCaseRevision, pointAsOfTimestamp, fallbackSnapshot, isTestReporter);
3082
+ const testCaseData = await this.resolveRunlessTestCaseData(projectName, testCaseId, suiteTestCaseRevision, pointAsOfTimestamp, fallbackSnapshot, isTestReporter, useLatestTestCaseProperties);
3078
3083
  if (!testCaseData) {
3079
3084
  logger_1.default.warn(`Could not resolve test case ${point.testCaseId} for runless point fallback.`);
3080
3085
  return null;
@@ -4419,8 +4424,8 @@ class ResultDataProvider {
4419
4424
  * @param selectedFields - (Optional) An array of field names to include in the result data.
4420
4425
  * @returns A promise that resolves to the fetched result data.
4421
4426
  */
4422
- async fetchResultDataBasedOnWiTestReporter(projectName, runId, resultId, selectedFields, isQueryMode, point, includeAllHistory = false, useRunlessAsOf = false) {
4423
- return this.fetchResultDataBasedOnWiBase(projectName, runId, resultId, true, selectedFields, isQueryMode, point, includeAllHistory, useRunlessAsOf);
4427
+ async fetchResultDataBasedOnWiTestReporter(projectName, runId, resultId, selectedFields, isQueryMode, point, includeAllHistory = false, useRunlessAsOf = false, useLatestTestCaseProperties = false) {
4428
+ return this.fetchResultDataBasedOnWiBase(projectName, runId, resultId, true, selectedFields, isQueryMode, point, includeAllHistory, useRunlessAsOf, useLatestTestCaseProperties);
4424
4429
  }
4425
4430
  /**
4426
4431
  * Fetches all result data for the test reporter by processing the provided test data.
@@ -4434,8 +4439,8 @@ class ResultDataProvider {
4434
4439
  * @param selectedFields - An optional array of field names to include in the result data.
4435
4440
  * @returns A promise that resolves to an array of processed result data.
4436
4441
  */
4437
- async fetchAllResultDataTestReporter(testData, projectName, selectedFields, isQueryMode, includeAllHistory = false, useRunlessAsOf = false) {
4438
- return this.fetchAllResultDataBase(testData, projectName, true, (projectName, testSuiteId, point, selectedFields, isQueryMode, includeAllHistory, useRunlessAsOf) => this.fetchResultDataForTestReporter(projectName, testSuiteId, point, selectedFields, isQueryMode, includeAllHistory, useRunlessAsOf), [selectedFields, isQueryMode, includeAllHistory, useRunlessAsOf]);
4442
+ async fetchAllResultDataTestReporter(testData, projectName, selectedFields, isQueryMode, includeAllHistory = false, useRunlessAsOf = false, useLatestTestCaseProperties = false) {
4443
+ return this.fetchAllResultDataBase(testData, projectName, true, (projectName, testSuiteId, point, selectedFields, isQueryMode, includeAllHistory, useRunlessAsOf, useLatestTestCaseProperties) => this.fetchResultDataForTestReporter(projectName, testSuiteId, point, selectedFields, isQueryMode, includeAllHistory, useRunlessAsOf, useLatestTestCaseProperties), [selectedFields, isQueryMode, includeAllHistory, useRunlessAsOf, useLatestTestCaseProperties]);
4439
4444
  }
4440
4445
  /**
4441
4446
  * Aligns test steps with iterations for the test reporter by processing test data and iterations
@@ -4543,8 +4548,8 @@ class ResultDataProvider {
4543
4548
  * @returns A promise that resolves to the formatted result data object containing details about the test case,
4544
4549
  * test suite, last run, iteration, and other selected fields.
4545
4550
  */
4546
- async fetchResultDataForTestReporter(projectName, testSuiteId, point, selectedFields, isQueryMode, includeAllHistory = false, useRunlessAsOf = false) {
4547
- return this.fetchResultDataBase(projectName, testSuiteId, point, (project, runId, resultId, fields, isQueryMode, point, includeAllHistory, useRunlessAsOf) => this.fetchResultDataBasedOnWiTestReporter(project, runId, resultId, fields, isQueryMode, point, includeAllHistory, useRunlessAsOf), (resultData, testSuiteId, point, selectedFields) => {
4551
+ async fetchResultDataForTestReporter(projectName, testSuiteId, point, selectedFields, isQueryMode, includeAllHistory = false, useRunlessAsOf = false, useLatestTestCaseProperties = false) {
4552
+ return this.fetchResultDataBase(projectName, testSuiteId, point, (project, runId, resultId, fields, isQueryMode, point, includeAllHistory, useRunlessAsOf, useLatestTestCaseProperties) => this.fetchResultDataBasedOnWiTestReporter(project, runId, resultId, fields, isQueryMode, point, includeAllHistory, useRunlessAsOf, useLatestTestCaseProperties), (resultData, testSuiteId, point, selectedFields) => {
4548
4553
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
4549
4554
  const { lastRunId, lastResultId, configurationName, lastResultDetails } = point;
4550
4555
  try {