Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions modules/ui/src/app/mocks/progress.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
14 changes: 14 additions & 0 deletions modules/ui/src/app/pages/testrun/progress.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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', () => {
Expand Down
3 changes: 2 additions & 1 deletion modules/ui/src/app/pages/testrun/progress.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down