mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
test(editor): Add e2e test cases for the logs view (#15060)
This commit is contained in:
@@ -32,7 +32,7 @@ import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
||||
|
||||
export type SimplifiedExecution = Pick<
|
||||
IExecutionResponse,
|
||||
'workflowId' | 'workflowData' | 'data' | 'status' | 'startedAt' | 'stoppedAt'
|
||||
'workflowId' | 'workflowData' | 'data' | 'status' | 'startedAt' | 'stoppedAt' | 'id'
|
||||
>;
|
||||
|
||||
/**
|
||||
@@ -74,9 +74,10 @@ export async function executionFinished(
|
||||
let successToastAlreadyShown = false;
|
||||
let execution: SimplifiedExecution | undefined;
|
||||
if (data.rawData) {
|
||||
const { workflowId, status, rawData } = data;
|
||||
const { executionId, workflowId, status, rawData } = data;
|
||||
|
||||
execution = {
|
||||
id: executionId,
|
||||
workflowId,
|
||||
workflowData: workflowsStore.workflow,
|
||||
data: parse(rawData),
|
||||
@@ -125,6 +126,7 @@ export async function fetchExecutionData(
|
||||
}
|
||||
|
||||
return {
|
||||
id: executionId,
|
||||
workflowId: executionResponse.workflowId,
|
||||
workflowData: workflowsStore.workflow,
|
||||
data: parse(executionResponse.data as unknown as string),
|
||||
@@ -450,7 +452,6 @@ export function handleExecutionFinishedWithOther(
|
||||
export function setRunExecutionData(
|
||||
execution: SimplifiedExecution,
|
||||
runExecutionData: IRunExecutionData,
|
||||
normalize = true,
|
||||
) {
|
||||
const workflowsStore = useWorkflowsStore();
|
||||
const nodeHelpers = useNodeHelpers();
|
||||
@@ -467,13 +468,12 @@ export function setRunExecutionData(
|
||||
|
||||
workflowsStore.executingNode.length = 0;
|
||||
|
||||
if (normalize) {
|
||||
// As a temporary workaround for https://linear.app/n8n/issue/PAY-2762,
|
||||
// remove runs that is still 'running' status when execution is finished
|
||||
removeRunningTaskData(execution as IExecutionResponse);
|
||||
}
|
||||
|
||||
workflowsStore.setWorkflowExecutionData(workflowExecution as IExecutionResponse);
|
||||
workflowsStore.setWorkflowExecutionData({
|
||||
...workflowExecution,
|
||||
status: execution.status,
|
||||
id: execution.id,
|
||||
stoppedAt: execution.stoppedAt,
|
||||
} as IExecutionResponse);
|
||||
workflowsStore.setWorkflowExecutionRunData(runExecutionData);
|
||||
workflowsStore.setActiveExecutionId(undefined);
|
||||
|
||||
@@ -505,22 +505,3 @@ export function setRunExecutionData(
|
||||
const lineNumber = runExecutionData.resultData?.error?.lineNumber;
|
||||
codeNodeEditorEventBus.emit('highlightLine', lineNumber ?? 'last');
|
||||
}
|
||||
|
||||
function removeRunningTaskData(execution: IExecutionResponse): void {
|
||||
if (execution.data) {
|
||||
execution.data = {
|
||||
...execution.data,
|
||||
resultData: {
|
||||
...execution.data.resultData,
|
||||
runData: Object.fromEntries(
|
||||
Object.entries(execution.data.resultData.runData)
|
||||
.map(([nodeName, runs]) => [
|
||||
nodeName,
|
||||
runs.filter((run) => run.executionStatus !== 'running'),
|
||||
])
|
||||
.filter(([, runs]) => runs.length > 0),
|
||||
),
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user