diff --git a/packages/editor-ui/src/composables/useRunWorkflow.test.ts b/packages/editor-ui/src/composables/useRunWorkflow.test.ts index e999e9629e..e6b8c586f5 100644 --- a/packages/editor-ui/src/composables/useRunWorkflow.test.ts +++ b/packages/editor-ui/src/composables/useRunWorkflow.test.ts @@ -219,6 +219,55 @@ describe('useRunWorkflow({ router })', () => { type: 'error', }); }); + it('should execute workflow has pin data and is active with single webhook trigger', async () => { + const pinia = createTestingPinia({ stubActions: false }); + setActivePinia(pinia); + const toast = useToast(); + const i18n = useI18n(); + const { runWorkflow } = useRunWorkflow({ router }); + + vi.mocked(workflowsStore).isWorkflowActive = true; + + vi.mocked(useWorkflowHelpers({ router })).getWorkflowDataToSave.mockResolvedValue({ + nodes: [ + { + name: 'Slack', + type: 'n8n-nodes-base.slackTrigger', + disabled: false, + }, + ], + pinData: { + Slack: [{ json: { value: 'data2' } }], + }, + } as unknown as IWorkflowData); + + const mockExecutionResponse = { executionId: '123' }; + + vi.mocked(uiStore).activeActions = ['']; + vi.mocked(workflowHelpers).getCurrentWorkflow.mockReturnValue({ + name: 'Test Workflow', + } as unknown as Workflow); + vi.mocked(workflowsStore).runWorkflow.mockResolvedValue(mockExecutionResponse); + vi.mocked(workflowsStore).nodesIssuesExist = true; + vi.mocked(workflowHelpers).getWorkflowDataToSave.mockResolvedValue({ + id: 'workflowId', + nodes: [], + } as unknown as IWorkflowData); + vi.mocked(workflowsStore).getWorkflowRunData = { + NodeName: [], + }; + + const result = await runWorkflow({}); + expect(result).toEqual(mockExecutionResponse); + + expect(toast.showMessage).not.toHaveBeenCalledWith({ + title: i18n.baseText('workflowRun.showError.deactivate'), + message: i18n.baseText('workflowRun.showError.productionActive', { + interpolate: { nodeName: 'Webhook' }, + }), + type: 'error', + }); + }); }); describe('runWorkflow()', () => { diff --git a/packages/editor-ui/src/composables/useRunWorkflow.ts b/packages/editor-ui/src/composables/useRunWorkflow.ts index a21345caf4..a5489af869 100644 --- a/packages/editor-ui/src/composables/useRunWorkflow.ts +++ b/packages/editor-ui/src/composables/useRunWorkflow.ts @@ -240,7 +240,11 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType