From b395de4ff09b67d0953ecb48d4ebc2640ae87d14 Mon Sep 17 00:00:00 2001 From: Volha Mardvilka Date: Thu, 6 Jun 2024 08:19:50 +0000 Subject: [PATCH 1/2] 345164706: (fix) disable start testrun btn in canceling state --- .../app/pages/testrun/testrun.component.html | 4 +++- .../pages/testrun/testrun.component.spec.ts | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/modules/ui/src/app/pages/testrun/testrun.component.html b/modules/ui/src/app/pages/testrun/testrun.component.html index 890378f12..028f109db 100644 --- a/modules/ui/src/app/pages/testrun/testrun.component.html +++ b/modules/ui/src/app/pages/testrun/testrun.component.html @@ -96,7 +96,9 @@

aria-label="Start new testrun" color="primary" [disabled]=" - hasDevices === false || isTestrunInProgress(systemStatus?.status) + hasDevices === false || + isTestrunInProgress(systemStatus?.status) || + systemStatus?.status === StatusOfTestrun.Cancelling " (click)="openTestRunModal()" mat-flat-button> diff --git a/modules/ui/src/app/pages/testrun/testrun.component.spec.ts b/modules/ui/src/app/pages/testrun/testrun.component.spec.ts index 0605254ce..a5bc8b5d9 100644 --- a/modules/ui/src/app/pages/testrun/testrun.component.spec.ts +++ b/modules/ui/src/app/pages/testrun/testrun.component.spec.ts @@ -480,6 +480,26 @@ describe('TestrunComponent', () => { }); }); + describe('with available systemStatus$ data, as Cancelling', () => { + beforeEach(() => { + store.overrideSelector( + selectSystemStatus, + MOCK_PROGRESS_DATA_CANCELLING + ); + // testRunServiceMock.testrunInProgress.and.returnValue(true); + store.overrideSelector(selectHasDevices, true); + fixture.detectChanges(); + }); + + it('should have disabled "Start" button', () => { + const startBtn = compiled.querySelector( + '.start-button' + ) as HTMLButtonElement; + + expect(startBtn.disabled).toBeTrue(); + }); + }); + describe('with available systemStatus$ data, as Monitoring', () => { beforeEach(() => { store.overrideSelector( From a15cb7ef17c9bee114c5d2aedd367221685f2825 Mon Sep 17 00:00:00 2001 From: Volha Mardvilka Date: Thu, 6 Jun 2024 08:26:07 +0000 Subject: [PATCH 2/2] 345164706: (fix) remove commented code --- modules/ui/src/app/pages/testrun/testrun.component.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/ui/src/app/pages/testrun/testrun.component.spec.ts b/modules/ui/src/app/pages/testrun/testrun.component.spec.ts index a5bc8b5d9..873212f72 100644 --- a/modules/ui/src/app/pages/testrun/testrun.component.spec.ts +++ b/modules/ui/src/app/pages/testrun/testrun.component.spec.ts @@ -486,7 +486,6 @@ describe('TestrunComponent', () => { selectSystemStatus, MOCK_PROGRESS_DATA_CANCELLING ); - // testRunServiceMock.testrunInProgress.and.returnValue(true); store.overrideSelector(selectHasDevices, true); fixture.detectChanges(); });