Skip to content

Commit 8a04a10

Browse files
Fixed run comparisson
1 parent f8b1735 commit 8a04a10

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

report-ng/app/src/components/history/run-comparison/run-comparison.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,14 @@ export class RunComparison extends AbstractViewModel {
100100
pastStatus = pastRun.context.resultStatus;
101101
}
102102

103-
if (currentStatus === ResultStatusType.PASSED && pastStatus === ResultStatusType.PASSED) {
103+
if (
104+
(currentStatus === ResultStatusType.PASSED && pastStatus === ResultStatusType.PASSED)
105+
|| pastStatus === ResultStatusType.FAILED_RETRIED
106+
|| currentStatus === ResultStatusType.FAILED_RETRIED) {
104107
return null;
105108
}
106109

110+
107111
if (method.runs.length > 1) {
108112
methodHistoryAvailable = true;
109113
}

report-ng/app/src/services/statistic-models.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,18 @@ export class HistoryStatistics {
229229

230230
clsStat.methods.forEach((method) => {
231231
let methodHistory = classHistory.methods.find(
232-
methodHistoryStatistics => methodHistoryStatistics.identifier === method.identifier && this._compareRelatedMethods(methodHistoryStatistics.relatedMethods, method.relatedMethods)
232+
methodHistoryStatistics => {
233+
// Retried methods have the same identifier, so we have duplicates in related methods array.
234+
const uniqueHistoryRelatedMethods = this._filterUniqueItems(methodHistoryStatistics.relatedMethods);
235+
const uniqueRelatedMethods = this._filterUniqueItems(method.relatedMethods);
236+
return methodHistoryStatistics.identifier === method.identifier
237+
&& this._compareRelatedMethods(uniqueHistoryRelatedMethods, uniqueRelatedMethods);
238+
}
233239
);
234-
235240
if (!methodHistory) {
236241
methodHistory = new MethodHistoryStatistics(method);
237242
classHistory.addMethod(methodHistory);
238243
}
239-
240244
methodHistory.addRun(method, currentHistoryIndex);
241245
});
242246
});
@@ -245,6 +249,11 @@ export class HistoryStatistics {
245249
this._classHistory = Array.from(classHistoryMap.values());
246250
}
247251

252+
private _filterUniqueItems(arr: string[]): string[] {
253+
const uniqueItems = new Set(arr);
254+
return Array.from(uniqueItems);
255+
}
256+
248257
private _compareRelatedMethods(arr1: string[], arr2: string[]): boolean {
249258
if (arr1.length !== arr2.length) {
250259
return false;

0 commit comments

Comments
 (0)