From 1fb0353839256f93b9dfc6bb83ca5666d20c15e9 Mon Sep 17 00:00:00 2001 From: kurilova Date: Mon, 18 Mar 2024 10:52:16 +0000 Subject: [PATCH] Adds empty table for cancelled state (if no tests are available) --- modules/ui/src/app/mocks/progress.mock.ts | 3 +++ .../app/pages/testrun/progress.component.spec.ts | 14 ++++++++++++++ .../ui/src/app/pages/testrun/progress.component.ts | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/modules/ui/src/app/mocks/progress.mock.ts b/modules/ui/src/app/mocks/progress.mock.ts index 7d855bfd5..2911ea794 100644 --- a/modules/ui/src/app/mocks/progress.mock.ts +++ b/modules/ui/src/app/mocks/progress.mock.ts @@ -99,6 +99,9 @@ export const MOCK_PROGRESS_DATA_COMPLIANT: TestrunStatus = export const MOCK_PROGRESS_DATA_CANCELLED: TestrunStatus = PROGRESS_DATA_RESPONSE(StatusOfTestrun.Cancelled, null, TEST_DATA); +export const MOCK_PROGRESS_DATA_CANCELLED_EMPTY: TestrunStatus = + PROGRESS_DATA_RESPONSE(StatusOfTestrun.Cancelled, null, []); + export const MOCK_PROGRESS_DATA_MONITORING: TestrunStatus = PROGRESS_DATA_RESPONSE(StatusOfTestrun.Monitoring, null, TEST_DATA); diff --git a/modules/ui/src/app/pages/testrun/progress.component.spec.ts b/modules/ui/src/app/pages/testrun/progress.component.spec.ts index 2ef51d620..ca6fd3fa3 100644 --- a/modules/ui/src/app/pages/testrun/progress.component.spec.ts +++ b/modules/ui/src/app/pages/testrun/progress.component.spec.ts @@ -27,6 +27,7 @@ import { of } from 'rxjs'; import { EMPTY_RESULT, MOCK_PROGRESS_DATA_CANCELLED, + MOCK_PROGRESS_DATA_CANCELLED_EMPTY, MOCK_PROGRESS_DATA_CANCELLING, MOCK_PROGRESS_DATA_COMPLIANT, MOCK_PROGRESS_DATA_IN_PROGRESS, @@ -240,6 +241,19 @@ describe('ProgressComponent', () => { expect(res).toEqual(expectedResult); }); }); + + it('should set value with empty values for status "Cancelled" and empty result', () => { + const expectedResult = EMPTY_RESULT; + + testRunServiceMock.systemStatus$ = of( + MOCK_PROGRESS_DATA_CANCELLED_EMPTY + ); + component.ngOnInit(); + + component.dataSource$.subscribe(res => { + expect(res).toEqual(expectedResult); + }); + }); }); it('should call focusFirstElementInContainer when testrun stops after cancelling', () => { diff --git a/modules/ui/src/app/pages/testrun/progress.component.ts b/modules/ui/src/app/pages/testrun/progress.component.ts index 9f8d72a68..7a643de7a 100644 --- a/modules/ui/src/app/pages/testrun/progress.component.ts +++ b/modules/ui/src/app/pages/testrun/progress.component.ts @@ -135,7 +135,8 @@ export class ProgressComponent implements OnInit, OnDestroy { const results = (res.tests as TestsData)?.results || []; if ( res.status === StatusOfTestrun.Monitoring || - res.status === StatusOfTestrun.WaitingForDevice + res.status === StatusOfTestrun.WaitingForDevice || + (res.status === StatusOfTestrun.Cancelled && !results.length) ) { return EMPTY_RESULT; }