Skip to content

Commit 252db99

Browse files
Fix Import status
Fix Resolution chart
1 parent 106d630 commit 252db99

File tree

6 files changed

+30
-23
lines changed

6 files changed

+30
-23
lines changed

e2e/data/import/cucumber.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"result": {
2828
"status": "passed",
29-
"duration": 7033
29+
"duration": 1684328900
3030
}
3131
},
3232
{
@@ -39,7 +39,7 @@
3939
},
4040
"result": {
4141
"status": "passed",
42-
"duration": 86
42+
"duration": 1684328900
4343
}
4444
}
4545
]
@@ -61,7 +61,7 @@
6161
},
6262
"result": {
6363
"status": "passed",
64-
"duration": 7033
64+
"duration": 2667613100
6565
}
6666
},
6767
{
@@ -74,7 +74,7 @@
7474
},
7575
"result": {
7676
"status": "failed",
77-
"duration": 86,
77+
"duration": 2667613100,
7878
"error_message": "step was failed"
7979
}
8080
}
@@ -97,7 +97,7 @@
9797
},
9898
"result": {
9999
"status": "passed",
100-
"duration": 7033
100+
"duration": 2667613100
101101
}
102102
},
103103
{
@@ -110,7 +110,7 @@
110110
},
111111
"result": {
112112
"status": "skipped",
113-
"duration": 86,
113+
"duration": 1684328900,
114114
"error_message": "step was skipped"
115115
}
116116
}

e2e/data/import/cucumberSpecialSymbols.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"result": {
2828
"status": "passed",
29-
"duration": 7033
29+
"duration": 1684328900
3030
}
3131
},
3232
{
@@ -39,7 +39,7 @@
3939
},
4040
"result": {
4141
"status": "passed",
42-
"duration": 86
42+
"duration": 1684328900
4343
}
4444
}
4545
]
@@ -61,7 +61,7 @@
6161
},
6262
"result": {
6363
"status": "passed",
64-
"duration": 7033
64+
"duration": 1684328900
6565
}
6666
},
6767
{
@@ -74,7 +74,7 @@
7474
},
7575
"result": {
7676
"status": "failed",
77-
"duration": 86,
77+
"duration": 1684328900,
7878
"error_message": "step was failed !”#$%&’()*+,-./:;<=>?@[\\]^_`{|}~"
7979
}
8080
}
@@ -97,7 +97,7 @@
9797
},
9898
"result": {
9999
"status": "passed",
100-
"duration": 7033
100+
"duration": 1684328900
101101
}
102102
},
103103
{
@@ -110,7 +110,7 @@
110110
},
111111
"result": {
112112
"status": "skipped",
113-
"duration": 86,
113+
"duration": 1684328900,
114114
"error_message": "step was skipped"
115115
}
116116
}

src/app/pages/project/import/import.component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,18 @@ export class ImportComponent {
4747
importResults: Import[];
4848
resultsColumnsToShow: TFColumn[];
4949
timerToken: any;
50-
statuses: { name: string, color: number }[] = [{
50+
statuses: { id: number, name: string, color: number }[] = [{
51+
id: 1,
5152
name: 'Finished',
5253
color: 5
5354
}, {
55+
id: 0,
5456
name: 'In Progress',
5557
color: 2
58+
}, {
59+
id: 2,
60+
name: 'Failed',
61+
color: 1
5662
}];
5763
sortBy = { order: TFOrder.asc, property: 'started' };
5864
imports: { name: string, key: string }[] = [
@@ -92,9 +98,7 @@ export class ImportComponent {
9298
this.importService.importResults(this.route.snapshot.params.projectId).subscribe(res => {
9399
this.importResults = res;
94100
this.importResults.forEach(result => {
95-
result['status'] = result.is_finished === 1
96-
? this.statuses.find(status => status.color === 5)
97-
: this.statuses.find(status => status.color === 2);
101+
result['status'] = this.statuses.find(status => status.id === result.finish_status);
98102
});
99103
this.resultsColumnsToShow = [
100104
{

src/app/pages/project/results/results-grid/results.grid.component.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class ResultGridComponent implements OnInit {
3434
@Input() testResults: TestResult[];
3535
@Input() sortBy = { property: 'final_result.name', order: TFOrder.desc };
3636
@Input() showOnly: string[] = ['Test Name', 'Fail Reason', 'Result', 'Resolution', 'Assignee', 'Comment', 'Last Results'];
37-
@Output() resultUpdated = new EventEmitter;
37+
@Output() resultUpdated = new EventEmitter<TestResult[]>();
3838
listOfResolutions: ResultResolution[];
3939
finalResults: FinalResult[];
4040
users: LocalPermissions[];
@@ -98,11 +98,12 @@ export class ResultGridComponent implements OnInit {
9898
assignee: result.assigned_user ? result.assigned_user.user_id : undefined
9999
};
100100
await this.testResultService.createTestResult(testResultUpdateTemplate);
101-
this.resultUpdated.emit(result);
101+
this.resultUpdated.emit([result]);
102102
}
103103

104-
bulkResultUpdate(results: TestResult[]) {
105-
return this.testResultService.bulkUpdate(results);
104+
async bulkResultUpdate(results: TestResult[]) {
105+
await this.testResultService.bulkUpdate(results);
106+
this.resultUpdated.emit(results);
106107
}
107108

108109
async getResults(testResultTemplate: TestResult) {

src/app/pages/project/testrun/testrun-view/testrun.view.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,10 @@ export class TestRunViewComponent implements OnInit {
144144
testUpdatedTestRun = await this.testRunService.createTestRun(testUpdatedTestRun);
145145
}
146146

147-
updateResult($event: TestResult) {
148-
this.testResults[this.testResults.findIndex(x => x.id === $event.id)] = $event;
147+
updateResult(updatedResults: TestResult[]) {
148+
updatedResults.forEach(updatedResult => {
149+
this.testResults[this.testResults.findIndex(x => x.id === updatedResult.id)] = updatedResult;
150+
});
149151
this.resultResolutionsCharts.ngOnChanges();
150152
}
151153

src/app/shared/models/import.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export class Import {
22
id?: number;
33
testrun_id?: number;
44
project_id?: number;
5-
is_finished?: number;
5+
finish_status?: number;
66
started?: Date|String|number;
77
finished?: Date|String|number;
88
log?: string;

0 commit comments

Comments
 (0)