mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(editor): Prevent running workflow that has issues if listening to webhook (#11402)
This commit is contained in:
parent
7fc3b25d21
commit
8b0a48f530
|
@ -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 });
|
||||
|
||||
|
|
|
@ -81,6 +81,11 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType<typeof u
|
|||
workflowsStore.activeExecutionId = response.executionId;
|
||||
}
|
||||
|
||||
if (response.waitingForWebhook === true && useWorkflowsStore().nodesIssuesExist) {
|
||||
uiStore.removeActiveAction('workflowRunning');
|
||||
throw new Error(i18n.baseText('workflowRun.showError.resolveOutstandingIssues'));
|
||||
}
|
||||
|
||||
if (response.waitingForWebhook === true) {
|
||||
workflowsStore.executionWaitingForWebhook = true;
|
||||
}
|
||||
|
|
|
@ -2130,6 +2130,7 @@
|
|||
"workflowRun.noActiveConnectionToTheServer": "Lost connection to the server",
|
||||
"workflowRun.showError.title": "Problem running workflow",
|
||||
"workflowRun.showError.payloadTooLarge": "Please execute the whole workflow, rather than just the node. (Existing execution data is too large.)",
|
||||
"workflowRun.showError.resolveOutstandingIssues": "Please resolve outstanding issues before you activate it",
|
||||
"workflowRun.showMessage.message": "Please fix them before executing",
|
||||
"workflowRun.showMessage.title": "Workflow has issues",
|
||||
"workflowSettings.callerIds": "IDs of workflows that can call this one",
|
||||
|
|
Loading…
Reference in a new issue