diff --git a/packages/editor-ui/src/composables/__tests__/useRunWorkflow.spec.ts b/packages/editor-ui/src/composables/__tests__/useRunWorkflow.spec.ts index 608fc36e870e7..08fa852b3926e 100644 --- a/packages/editor-ui/src/composables/__tests__/useRunWorkflow.spec.ts +++ b/packages/editor-ui/src/composables/__tests__/useRunWorkflow.spec.ts @@ -23,6 +23,7 @@ vi.mock('@/stores/workflows.store', () => ({ getCurrentWorkflow: vi.fn().mockReturnValue({ id: '123' }), getNodeByName: vi.fn(), getExecution: vi.fn(), + nodeIssuesExit: vi.fn(), }), })); @@ -124,6 +125,21 @@ describe('useRunWorkflow({ router })', () => { expect(uiStore.addActiveAction).toHaveBeenCalledWith('workflowRunning'); }); + it('should prevent running a webhook-based workflow that has issues', async () => { + const { runWorkflowApi } = useRunWorkflow({ router }); + vi.mocked(workflowsStore).nodesIssuesExist = true; + vi.mocked(workflowsStore).runWorkflow.mockResolvedValue({ + executionId: '123', + waitingForWebhook: true, + }); + + await expect(runWorkflowApi({} as IStartRunData)).rejects.toThrow( + 'workflowRun.showError.resolveOutstandingIssues', + ); + + vi.mocked(workflowsStore).nodesIssuesExist = false; + }); + it('should handle workflow run failure', async () => { const { runWorkflowApi } = useRunWorkflow({ router }); diff --git a/packages/editor-ui/src/composables/useRunWorkflow.ts b/packages/editor-ui/src/composables/useRunWorkflow.ts index 8369921f8a119..658e35b3c6229 100644 --- a/packages/editor-ui/src/composables/useRunWorkflow.ts +++ b/packages/editor-ui/src/composables/useRunWorkflow.ts @@ -81,6 +81,11 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType