mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
feat: Add AI tool building capabilities (#7336)
Github issue / Community forum post (link here to close automatically): https://community.n8n.io/t/langchain-memory-chat/23733 --------- Signed-off-by: Oleg Ivaniv <me@olegivaniv.com> Co-authored-by: Oleg Ivaniv <me@olegivaniv.com> Co-authored-by: Val <68596159+valya@users.noreply.github.com> Co-authored-by: Alex Grozav <alex@grozav.com> Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in> Co-authored-by: Deborah <deborah@starfallprojects.co.uk> Co-authored-by: Jesper Bylund <mail@jesperbylund.com> Co-authored-by: Jon <jonathan.bennetts@gmail.com> Co-authored-by: Michael Kret <88898367+michael-radency@users.noreply.github.com> Co-authored-by: Giulio Andreini <andreini@netseven.it> Co-authored-by: Mason Geloso <Mason.geloso@gmail.com> Co-authored-by: Mason Geloso <hone@Masons-Mac-mini.local> Co-authored-by: Mutasem Aldmour <mutasem@n8n.io>
This commit is contained in:
135
cypress/utils/executions.ts
Normal file
135
cypress/utils/executions.ts
Normal file
@@ -0,0 +1,135 @@
|
||||
import { ITaskData } from '../../packages/workflow/src';
|
||||
import { IPinData } from '../../packages/workflow';
|
||||
import { clickExecuteWorkflowButton } from '../composables/workflow';
|
||||
|
||||
export function createMockNodeExecutionData(
|
||||
name: string,
|
||||
{
|
||||
data,
|
||||
inputOverride,
|
||||
executionStatus = 'success',
|
||||
jsonData,
|
||||
...rest
|
||||
}: Partial<ITaskData> & { jsonData?: Record<string, object> },
|
||||
): Record<string, ITaskData> {
|
||||
return {
|
||||
[name]: {
|
||||
startTime: new Date().getTime(),
|
||||
executionTime: 0,
|
||||
executionStatus,
|
||||
data: jsonData
|
||||
? Object.keys(jsonData).reduce((acc, key) => {
|
||||
acc[key] = [
|
||||
[
|
||||
{
|
||||
json: jsonData[key],
|
||||
pairedItem: { item: 0 },
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
return acc;
|
||||
}, {})
|
||||
: data,
|
||||
source: [null],
|
||||
...rest,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function createMockWorkflowExecutionData({
|
||||
executionId,
|
||||
runData,
|
||||
pinData = {},
|
||||
lastNodeExecuted,
|
||||
}: {
|
||||
executionId: string;
|
||||
runData: Record<string, ITaskData | ITaskData[]>;
|
||||
pinData?: IPinData;
|
||||
lastNodeExecuted: string;
|
||||
}) {
|
||||
return {
|
||||
executionId,
|
||||
data: {
|
||||
data: {
|
||||
startData: {},
|
||||
resultData: {
|
||||
runData,
|
||||
pinData,
|
||||
lastNodeExecuted,
|
||||
},
|
||||
executionData: {
|
||||
contextData: {},
|
||||
nodeExecutionStack: [],
|
||||
metadata: {},
|
||||
waitingExecution: {},
|
||||
waitingExecutionSource: {},
|
||||
},
|
||||
},
|
||||
mode: 'manual',
|
||||
startedAt: new Date().toISOString(),
|
||||
stoppedAt: new Date().toISOString(),
|
||||
status: 'success',
|
||||
finished: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function runMockWorkflowExcution({
|
||||
trigger,
|
||||
lastNodeExecuted,
|
||||
runData,
|
||||
workflowExecutionData,
|
||||
}: {
|
||||
trigger?: () => void;
|
||||
lastNodeExecuted: string;
|
||||
runData: Array<ReturnType<typeof createMockNodeExecutionData>>;
|
||||
workflowExecutionData?: ReturnType<typeof createMockWorkflowExecutionData>;
|
||||
}) {
|
||||
const executionId = Math.random().toString(36).substring(4);
|
||||
|
||||
cy.intercept('POST', '/rest/workflows/run', {
|
||||
statusCode: 201,
|
||||
body: {
|
||||
data: {
|
||||
executionId,
|
||||
},
|
||||
},
|
||||
}).as('runWorkflow');
|
||||
|
||||
if (trigger) {
|
||||
trigger();
|
||||
} else {
|
||||
clickExecuteWorkflowButton();
|
||||
}
|
||||
|
||||
cy.wait('@runWorkflow');
|
||||
|
||||
const resolvedRunData = {};
|
||||
runData.forEach((nodeExecution) => {
|
||||
const nodeName = Object.keys(nodeExecution)[0];
|
||||
const nodeRunData = nodeExecution[nodeName];
|
||||
|
||||
cy.push('nodeExecuteBefore', {
|
||||
executionId,
|
||||
nodeName,
|
||||
});
|
||||
cy.push('nodeExecuteAfter', {
|
||||
executionId,
|
||||
nodeName,
|
||||
data: nodeRunData,
|
||||
});
|
||||
|
||||
resolvedRunData[nodeName] = nodeExecution[nodeName];
|
||||
});
|
||||
|
||||
cy.push(
|
||||
'executionFinished',
|
||||
createMockWorkflowExecutionData({
|
||||
executionId,
|
||||
lastNodeExecuted,
|
||||
runData: resolvedRunData,
|
||||
...workflowExecutionData,
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -1 +1,3 @@
|
||||
export * from './executions';
|
||||
export * from './modal';
|
||||
export * from './popper';
|
||||
|
||||
Reference in New Issue
Block a user