From 1222b8bcde01d9d3eca62f08dc57502e188ab78f Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Mon, 2 Dec 2024 15:25:09 +0100 Subject: [PATCH 1/4] Set running state as soon as button is clicked and clear running state when refreshing browser --- code/core/src/manager-api/modules/experimental_testmodule.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/core/src/manager-api/modules/experimental_testmodule.ts b/code/core/src/manager-api/modules/experimental_testmodule.ts index 6b33f04c2e4f..a461adc8ce89 100644 --- a/code/core/src/manager-api/modules/experimental_testmodule.ts +++ b/code/core/src/manager-api/modules/experimental_testmodule.ts @@ -93,6 +93,8 @@ export const init: ModuleFn = ({ store, fullAPI }) => { const index = store.getState().index; invariant(index, 'The index is currently unavailable'); + api.updateTestProviderState(id, { running: true, failed: false, crashed: false }); + const provider = store.getState().testProviders[id]; const indexUrl = new URL('index.json', window.location.href).toString(); @@ -158,6 +160,7 @@ export const init: ModuleFn = ({ store, fullAPI }) => { ...config, ...initialTestProviderState, ...(state?.testProviders?.[id] || {}), + running: false, } as TestProviders[0], ] ) From 76514a18e0607b3e63b6f1be201e735d0de29e09 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Mon, 2 Dec 2024 15:34:02 +0100 Subject: [PATCH 2/4] Allow running tests when crashed --- code/addons/test/src/components/TestProviderRender.tsx | 4 ++-- code/core/src/manager/components/sidebar/TestingModule.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/addons/test/src/components/TestProviderRender.tsx b/code/addons/test/src/components/TestProviderRender.tsx index ca6be687c88d..af7bd3ae0779 100644 --- a/code/addons/test/src/components/TestProviderRender.tsx +++ b/code/addons/test/src/components/TestProviderRender.tsx @@ -112,7 +112,7 @@ export const TestProviderRender: FC<{ padding="small" active={state.watching} onClick={() => api.setTestProviderWatchMode(state.id, !state.watching)} - disabled={state.crashed || state.running} + disabled={state.running} > @@ -135,7 +135,7 @@ export const TestProviderRender: FC<{ variant="ghost" padding="small" onClick={() => api.runTestProvider(state.id)} - disabled={state.crashed || state.running} + disabled={state.running} > diff --git a/code/core/src/manager/components/sidebar/TestingModule.tsx b/code/core/src/manager/components/sidebar/TestingModule.tsx index b7d5536ce203..b66512007c08 100644 --- a/code/core/src/manager/components/sidebar/TestingModule.tsx +++ b/code/core/src/manager/components/sidebar/TestingModule.tsx @@ -263,7 +263,7 @@ export const TestingModule = ({ onClick={(e: SyntheticEvent) => { e.stopPropagation(); testProviders - .filter((state) => !state.crashed && !state.running && state.runnable) + .filter((state) => !state.running && state.runnable) .forEach(({ id }) => api.runTestProvider(id)); }} disabled={isRunning} From 728031e4f50fc6dc569eace29a95ab2c4d42cfeb Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Mon, 2 Dec 2024 15:34:29 +0100 Subject: [PATCH 3/4] Remove unused import --- code/core/src/types/modules/addons.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/code/core/src/types/modules/addons.ts b/code/core/src/types/modules/addons.ts index 06c64c21f788..388d27135f35 100644 --- a/code/core/src/types/modules/addons.ts +++ b/code/core/src/types/modules/addons.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/naming-convention */ import type { FC, PropsWithChildren, ReactElement, ReactNode } from 'react'; -import type { ListItem } from '../../components'; import type { TestProviderConfig, TestingModuleProgressReportProgress } from '../../core-events'; import type { RenderData as RouterData } from '../../router/types'; import type { ThemeVars } from '../../theming/types'; From 7687574927533ff5bf763dd00bfd3ff51b96e4a9 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 3 Dec 2024 10:34:15 +0100 Subject: [PATCH 4/4] Update code/core/src/manager-api/modules/experimental_testmodule.ts Co-authored-by: Jeppe Reinhold --- code/core/src/manager-api/modules/experimental_testmodule.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/core/src/manager-api/modules/experimental_testmodule.ts b/code/core/src/manager-api/modules/experimental_testmodule.ts index a72e1539871d..294355c73bc6 100644 --- a/code/core/src/manager-api/modules/experimental_testmodule.ts +++ b/code/core/src/manager-api/modules/experimental_testmodule.ts @@ -85,8 +85,6 @@ export const init: ModuleFn = ({ store, fullAPI }) => { runTestProvider(id, options) { const index = store.getState().index; invariant(index, 'The index is currently unavailable'); - api.updateTestProviderState(id, { running: true }); - api.updateTestProviderState(id, { running: true, failed: false, crashed: false }); const provider = store.getState().testProviders[id];