feat(core): Improve debugging of sub-workflows (#11602)

This commit is contained in:
Mutasem Aldmour
2024-11-14 23:04:43 +01:00
committed by GitHub
parent f4ca4b792f
commit fd3254d587
36 changed files with 1843 additions and 265 deletions

View File

@@ -0,0 +1,29 @@
/**
* Getters
*/
export const getExecutionsSidebar = () => cy.getByTestId('executions-sidebar');
export const getWorkflowExecutionPreviewIframe = () => cy.getByTestId('workflow-preview-iframe');
export const getExecutionPreviewBody = () =>
getWorkflowExecutionPreviewIframe()
.its('0.contentDocument.body')
.then((el) => cy.wrap(el));
export const getExecutionPreviewBodyNodes = () =>
getExecutionPreviewBody().findChildByTestId('canvas-node');
export const getExecutionPreviewBodyNodesByName = (name: string) =>
getExecutionPreviewBody().findChildByTestId('canvas-node').filter(`[data-name="${name}"]`).eq(0);
export function getExecutionPreviewOutputPanelRelatedExecutionLink() {
return getExecutionPreviewBody().findChildByTestId('related-execution-link');
}
/**
* Actions
*/
export const openExecutionPreviewNode = (name: string) =>
getExecutionPreviewBodyNodesByName(name).dblclick();

View File

@@ -48,10 +48,38 @@ export function getOutputTableRow(row: number) {
return getOutputTableRows().eq(row);
}
export function getOutputTableHeaders() {
return getOutputPanelDataContainer().find('table thead th');
}
export function getOutputTableHeaderByText(text: string) {
return getOutputTableHeaders().contains(text);
}
export function getOutputTbodyCell(row: number, col: number) {
return getOutputTableRows().eq(row).find('td').eq(col);
}
export function getOutputRunSelector() {
return getOutputPanel().findChildByTestId('run-selector');
}
export function getOutputRunSelectorInput() {
return getOutputRunSelector().find('input');
}
export function getOutputPanelTable() {
return getOutputPanelDataContainer().get('table');
}
export function getOutputPanelItemsCount() {
return getOutputPanel().getByTestId('ndv-items-count');
}
export function getOutputPanelRelatedExecutionLink() {
return getOutputPanel().getByTestId('related-execution-link');
}
/**
* Actions
*/
@@ -90,3 +118,8 @@ export function setParameterSelectByContent(name: string, content: string) {
getParameterInputByName(name).realClick();
getVisibleSelect().find('.option-headline').contains(content).click();
}
export function changeOutputRunSelector(runName: string) {
getOutputRunSelector().click();
getVisibleSelect().find('.el-select-dropdown__item').contains(runName).click();
}

View File

@@ -76,6 +76,14 @@ export function getCanvasNodes() {
);
}
export function getSaveButton() {
return cy.getByTestId('workflow-save-button');
}
export function getZoomToFitButton() {
return cy.getByTestId('zoom-to-fit');
}
/**
* Actions
*/
@@ -170,3 +178,19 @@ export function clickManualChatButton() {
export function openNode(nodeName: string) {
getNodeByName(nodeName).dblclick();
}
export function saveWorkflowOnButtonClick() {
cy.intercept('POST', '/rest/workflows').as('createWorkflow');
getSaveButton().should('contain', 'Save');
getSaveButton().click();
getSaveButton().should('contain', 'Saved');
cy.url().should('not.have.string', '/new');
}
export function pasteWorkflow(workflow: object) {
cy.get('body').paste(JSON.stringify(workflow));
}
export function clickZoomToFit() {
getZoomToFitButton().click();
}

View File

@@ -31,29 +31,31 @@ describe('NDV', () => {
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).realHover();
ndv.actions.dragMainPanelToRight();
ndv.getters.inputTableRow(1).realMouseMove(10, 1);
ndv.getters.outputTableRow(4).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.inputTableRow(2).realHover();
ndv.getters.inputTableRow(2).realMouseMove(10, 1);
ndv.getters.outputTableRow(2).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.inputTableRow(3).realHover();
ndv.getters.inputTableRow(3).realMouseMove(10, 1);
ndv.getters.outputTableRow(6).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
// output to input
ndv.getters.outputTableRow(1).realHover();
ndv.actions.dragMainPanelToLeft();
ndv.getters.outputTableRow(1).realMouseMove(10, 1);
ndv.getters.inputTableRow(4).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.outputTableRow(4).realHover();
ndv.getters.outputTableRow(4).realMouseMove(10, 1);
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.outputTableRow(2).realHover();
ndv.getters.outputTableRow(2).realMouseMove(10, 1);
ndv.getters.inputTableRow(2).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.outputTableRow(6).realHover();
ndv.getters.outputTableRow(6).realMouseMove(10, 1);
ndv.getters.inputTableRow(3).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.outputTableRow(1).realHover();
ndv.getters.outputTableRow(1).realMouseMove(10, 1);
ndv.getters.inputTableRow(4).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
});
@@ -75,31 +77,32 @@ describe('NDV', () => {
ndv.actions.switchInputMode('Table');
ndv.actions.switchOutputMode('Table');
ndv.getters.backToCanvas().realHover(); // reset to default hover
ndv.getters.backToCanvas().realMouseMove(10, 1); // reset to default hover
ndv.getters.outputHoveringItem().should('not.exist');
ndv.getters.parameterExpressionPreview('value').should('include.text', '1111');
ndv.actions.selectInputNode('Set1');
ndv.getters.backToCanvas().realHover(); // reset to default hover
ndv.getters.backToCanvas().realMouseMove(10, 1); // reset to default hover
ndv.getters.inputTableRow(1).should('have.text', '1000');
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).realHover();
cy.wait(50);
ndv.actions.dragMainPanelToRight();
ndv.getters.inputTbodyCell(1, 0).realMouseMove(10, 1);
ndv.getters.outputHoveringItem().should('have.text', '1000');
ndv.getters.parameterExpressionPreview('value').should('include.text', '1000');
ndv.actions.selectInputNode('Sort');
ndv.actions.dragMainPanelToLeft();
ndv.actions.changeOutputRunSelector('1 of 2 (6 items)');
ndv.getters.backToCanvas().realHover(); // reset to default hover
ndv.getters.backToCanvas().realMouseMove(10, 1); // reset to default hover
ndv.getters.inputTableRow(1).should('have.text', '1111');
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).realHover();
cy.wait(50);
ndv.actions.dragMainPanelToRight();
ndv.getters.inputTbodyCell(1, 0).realMouseMove(10, 1);
ndv.getters.outputHoveringItem().should('have.text', '1111');
ndv.getters.parameterExpressionPreview('value').should('include.text', '1111');
});
@@ -132,20 +135,22 @@ describe('NDV', () => {
ndv.getters.inputTableRow(1).should('have.text', '1111');
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.actions.dragMainPanelToLeft();
ndv.getters.outputTableRow(1).should('have.text', '1111');
ndv.getters.outputTableRow(1).realHover();
ndv.getters.outputTableRow(1).realMouseMove(10, 1);
ndv.getters.outputTableRow(3).should('have.text', '4444');
ndv.getters.outputTableRow(3).realHover();
ndv.getters.outputTableRow(3).realMouseMove(10, 1);
ndv.getters.inputTableRow(3).should('have.text', '4444');
ndv.getters.inputTableRow(3).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.actions.changeOutputRunSelector('2 of 2 (6 items)');
cy.wait(50);
ndv.getters.inputTableRow(1).should('have.text', '1000');
ndv.getters.inputTableRow(1).realHover();
ndv.actions.dragMainPanelToRight();
ndv.getters.inputTableRow(1).realMouseMove(10, 1);
ndv.getters.outputTableRow(1).should('have.text', '1000');
ndv.getters
@@ -155,7 +160,8 @@ describe('NDV', () => {
.should('equal', 'hovering-item');
ndv.getters.outputTableRow(3).should('have.text', '2000');
ndv.getters.outputTableRow(3).realHover();
ndv.actions.dragMainPanelToLeft();
ndv.getters.outputTableRow(3).realMouseMove(10, 1);
ndv.getters.inputTableRow(3).should('have.text', '2000');
@@ -175,14 +181,15 @@ describe('NDV', () => {
ndv.actions.switchOutputBranch('False Branch (2 items)');
ndv.getters.outputTableRow(1).should('have.text', '8888');
ndv.getters.outputTableRow(1).realHover();
ndv.actions.dragMainPanelToLeft();
ndv.getters.outputTableRow(1).realMouseMove(10, 1);
ndv.getters.inputTableRow(5).should('have.text', '8888');
ndv.getters.inputTableRow(5).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.outputTableRow(2).should('have.text', '9999');
ndv.getters.outputTableRow(2).realHover();
ndv.getters.outputTableRow(2).realMouseMove(10, 1);
ndv.getters.inputTableRow(6).should('have.text', '9999');
@@ -192,29 +199,35 @@ describe('NDV', () => {
workflowPage.actions.openNode('Set5');
ndv.actions.dragMainPanelToRight();
ndv.actions.switchInputBranch('True Branch');
ndv.actions.dragMainPanelToLeft();
ndv.actions.changeOutputRunSelector('1 of 2 (2 items)');
ndv.getters.outputTableRow(1).should('have.text', '8888');
ndv.getters.outputTableRow(1).realHover();
cy.wait(100);
ndv.getters.outputTableRow(1).realMouseMove(10, 1);
ndv.getters.inputHoveringItem().should('not.exist');
ndv.getters.inputTableRow(1).should('have.text', '1111');
ndv.getters.inputTableRow(1).realHover();
cy.wait(100);
ndv.actions.dragMainPanelToRight();
ndv.getters.inputTableRow(1).realMouseMove(10, 1);
ndv.getters.outputHoveringItem().should('not.exist');
ndv.actions.switchInputBranch('False Branch');
ndv.getters.inputTableRow(1).should('have.text', '8888');
ndv.getters.inputTableRow(1).realHover();
ndv.actions.dragMainPanelToRight();
ndv.getters.inputTableRow(1).realMouseMove(10, 1);
ndv.actions.dragMainPanelToLeft();
ndv.actions.changeOutputRunSelector('2 of 2 (4 items)');
ndv.getters.outputTableRow(1).should('have.text', '1111');
ndv.getters.outputTableRow(1).realHover();
ndv.getters.outputTableRow(1).realMouseMove(10, 1);
ndv.actions.changeOutputRunSelector('1 of 2 (2 items)');
ndv.getters.inputTableRow(1).should('have.text', '8888');
ndv.getters.inputTableRow(1).realHover();
ndv.actions.dragMainPanelToRight();
ndv.getters.inputTableRow(1).realMouseMove(10, 1);
ndv.getters.outputHoveringItem().should('have.text', '8888');
// todo there's a bug here need to fix ADO-534
// ndv.getters.outputHoveringItem().should('not.exist');

View File

@@ -0,0 +1,140 @@
import {
getExecutionPreviewOutputPanelRelatedExecutionLink,
getExecutionsSidebar,
getWorkflowExecutionPreviewIframe,
openExecutionPreviewNode,
} from '../composables/executions';
import {
changeOutputRunSelector,
getOutputPanelItemsCount,
getOutputPanelRelatedExecutionLink,
getOutputRunSelectorInput,
getOutputTableHeaders,
getOutputTableRows,
getOutputTbodyCell,
} from '../composables/ndv';
import {
clickExecuteWorkflowButton,
clickZoomToFit,
getCanvasNodes,
navigateToNewWorkflowPage,
openNode,
pasteWorkflow,
saveWorkflowOnButtonClick,
} from '../composables/workflow';
import SUBWORKFLOW_DEBUGGING_EXAMPLE from '../fixtures/Subworkflow-debugging-execute-workflow.json';
describe('Subworkflow debugging', () => {
beforeEach(() => {
navigateToNewWorkflowPage();
pasteWorkflow(SUBWORKFLOW_DEBUGGING_EXAMPLE);
saveWorkflowOnButtonClick();
getCanvasNodes().should('have.length', 11);
clickZoomToFit();
clickExecuteWorkflowButton();
});
describe('can inspect sub executed workflow', () => {
it('(Run once with all items/ Wait for Sub-workflow completion) (default behavior)', () => {
openNode('Execute Workflow with param');
getOutputPanelItemsCount().should('contain.text', '2 items, 1 sub-execution');
getOutputPanelRelatedExecutionLink().should('contain.text', 'Inspect Sub-Execution');
getOutputPanelRelatedExecutionLink().should('have.attr', 'href');
// ensure workflow executed and waited on output
getOutputTableHeaders().should('have.length', 2);
getOutputTbodyCell(1, 0).should('have.text', 'world Natalie Moore');
});
it('(Run once for each item/ Wait for Sub-workflow completion)', () => {
openNode('Execute Workflow with param1');
getOutputPanelItemsCount().should('contain.text', '2 items, 2 sub-execution');
getOutputPanelRelatedExecutionLink().should('not.exist');
// ensure workflow executed and waited on output
getOutputTableHeaders().should('have.length', 3);
getOutputTbodyCell(1, 0).find('a').should('have.attr', 'href');
getOutputTbodyCell(1, 1).should('have.text', 'world Natalie Moore');
});
it('(Run once with all items/ Wait for Sub-workflow completion)', () => {
openNode('Execute Workflow with param2');
getOutputPanelItemsCount().should('not.exist');
getOutputPanelRelatedExecutionLink().should('contain.text', 'Inspect Sub-Execution');
getOutputPanelRelatedExecutionLink().should('have.attr', 'href');
// ensure workflow executed but returned same data as input
getOutputRunSelectorInput().should('have.value', '2 of 2 (3 items, 1 sub-execution)');
getOutputTableHeaders().should('have.length', 6);
getOutputTableHeaders().eq(0).should('have.text', 'uid');
getOutputTableRows().should('have.length', 4);
getOutputTbodyCell(1, 1).should('include.text', 'Jon_Ebert@yahoo.com');
changeOutputRunSelector('1 of 2 (2 items, 1 sub-execution)');
getOutputRunSelectorInput().should('have.value', '1 of 2 (2 items, 1 sub-execution)');
getOutputTableHeaders().should('have.length', 6);
getOutputTableHeaders().eq(0).should('have.text', 'uid');
getOutputTableRows().should('have.length', 3);
getOutputTbodyCell(1, 1).should('include.text', 'Terry.Dach@hotmail.com');
});
it('(Run once for each item/ Wait for Sub-workflow completion)', () => {
openNode('Execute Workflow with param3');
// ensure workflow executed but returned same data as input
getOutputRunSelectorInput().should('have.value', '2 of 2 (3 items, 3 sub-executions)');
getOutputTableHeaders().should('have.length', 7);
getOutputTableHeaders().eq(1).should('have.text', 'uid');
getOutputTableRows().should('have.length', 4);
getOutputTbodyCell(1, 0).find('a').should('have.attr', 'href');
getOutputTbodyCell(1, 2).should('include.text', 'Jon_Ebert@yahoo.com');
changeOutputRunSelector('1 of 2 (2 items, 2 sub-executions)');
getOutputRunSelectorInput().should('have.value', '1 of 2 (2 items, 2 sub-executions)');
getOutputTableHeaders().should('have.length', 7);
getOutputTableHeaders().eq(1).should('have.text', 'uid');
getOutputTableRows().should('have.length', 3);
getOutputTbodyCell(1, 0).find('a').should('have.attr', 'href');
getOutputTbodyCell(1, 2).should('include.text', 'Terry.Dach@hotmail.com');
});
});
it('can inspect parent executions', () => {
cy.url().then((workflowUrl) => {
openNode('Execute Workflow with param');
getOutputPanelItemsCount().should('contain.text', '2 items, 1 sub-execution');
getOutputPanelRelatedExecutionLink().should('contain.text', 'Inspect Sub-Execution');
getOutputPanelRelatedExecutionLink().should('have.attr', 'href');
// ensure workflow executed and waited on output
getOutputTableHeaders().should('have.length', 2);
getOutputTbodyCell(1, 0).should('have.text', 'world Natalie Moore');
// cypress cannot handle new tabs so removing it
getOutputPanelRelatedExecutionLink().invoke('removeAttr', 'target').click();
getExecutionsSidebar().should('be.visible');
getWorkflowExecutionPreviewIframe().should('be.visible');
openExecutionPreviewNode('Execute Workflow Trigger');
getExecutionPreviewOutputPanelRelatedExecutionLink().should(
'include.text',
'Inspect Parent Execution',
);
getExecutionPreviewOutputPanelRelatedExecutionLink()
.invoke('removeAttr', 'target')
.click({ force: true });
cy.url().then((currentUrl) => {
expect(currentUrl === workflowUrl);
});
});
});
});

View File

@@ -0,0 +1,354 @@
{
"meta": {
"instanceId": "08ce71ad998aeaade0abedb8dd96153d8eaa03fcb84cfccc1530095bf9ee478e"
},
"nodes": [
{
"parameters": {},
"id": "4535ce3e-280e-49b0-8854-373472ec86d1",
"name": "When clicking Test workflow",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [80, 860]
},
{
"parameters": {
"category": "randomData",
"randomDataSeed": "0",
"randomDataCount": 2
},
"id": "d7fba18a-d51f-4509-af45-68cd9425ac6b",
"name": "DebugHelper1",
"type": "n8n-nodes-base.debugHelper",
"typeVersion": 1,
"position": [280, 860]
},
{
"parameters": {
"source": "parameter",
"workflowJson": "{\n \"meta\": {\n \"instanceId\": \"a786b722078489c1fa382391a9f3476c2784761624deb2dfb4634827256d51a0\"\n },\n \"nodes\": [\n {\n \"parameters\": {},\n \"type\": \"n8n-nodes-base.executeWorkflowTrigger\",\n \"typeVersion\": 1,\n \"position\": [\n 0,\n 0\n ],\n \"id\": \"00600a51-e63a-4b6e-93f5-f01d50a21e0c\",\n \"name\": \"Execute Workflow Trigger\"\n },\n {\n \"parameters\": {\n \"assignments\": {\n \"assignments\": [\n {\n \"id\": \"87ff01af-2e28-48da-ae6c-304040200b15\",\n \"name\": \"hello\",\n \"value\": \"=world {{ $json.firstname }} {{ $json.lastname }}\",\n \"type\": \"string\"\n }\n ]\n },\n \"includeOtherFields\": false,\n \"options\": {}\n },\n \"type\": \"n8n-nodes-base.set\",\n \"typeVersion\": 3.4,\n \"position\": [\n 280,\n 0\n ],\n \"id\": \"642219a1-d655-4a30-af5c-fcccbb690322\",\n \"name\": \"Edit Fields\"\n }\n ],\n \"connections\": {\n \"Execute Workflow Trigger\": {\n \"main\": [\n [\n {\n \"node\": \"Edit Fields\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n }\n },\n \"pinData\": {}\n}",
"mode": "each",
"options": {
"waitForSubWorkflow": false
}
},
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.1,
"position": [680, 1540],
"id": "f90a25da-dd89-4bf8-8f5b-bf8ee1de0b70",
"name": "Execute Workflow with param3"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "c93f26bd-3489-467b-909e-6462e1463707",
"name": "uid",
"value": "={{ $json.uid }}",
"type": "string"
},
{
"id": "3dd706ce-d925-4219-8531-ad12369972fe",
"name": "email",
"value": "={{ $json.email }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [900, 1540],
"id": "3be57648-3be8-4b0f-abfa-8fdcafee804d",
"name": "Edit Fields8"
},
{
"parameters": {
"source": "parameter",
"workflowJson": "{\n \"meta\": {\n \"instanceId\": \"a786b722078489c1fa382391a9f3476c2784761624deb2dfb4634827256d51a0\"\n },\n \"nodes\": [\n {\n \"parameters\": {},\n \"type\": \"n8n-nodes-base.executeWorkflowTrigger\",\n \"typeVersion\": 1,\n \"position\": [\n 0,\n 0\n ],\n \"id\": \"00600a51-e63a-4b6e-93f5-f01d50a21e0c\",\n \"name\": \"Execute Workflow Trigger\"\n },\n {\n \"parameters\": {\n \"assignments\": {\n \"assignments\": [\n {\n \"id\": \"87ff01af-2e28-48da-ae6c-304040200b15\",\n \"name\": \"hello\",\n \"value\": \"=world {{ $json.firstname }} {{ $json.lastname }}\",\n \"type\": \"string\"\n }\n ]\n },\n \"includeOtherFields\": false,\n \"options\": {}\n },\n \"type\": \"n8n-nodes-base.set\",\n \"typeVersion\": 3.4,\n \"position\": [\n 280,\n 0\n ],\n \"id\": \"642219a1-d655-4a30-af5c-fcccbb690322\",\n \"name\": \"Edit Fields\"\n }\n ],\n \"connections\": {\n \"Execute Workflow Trigger\": {\n \"main\": [\n [\n {\n \"node\": \"Edit Fields\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n }\n },\n \"pinData\": {}\n}",
"options": {
"waitForSubWorkflow": false
}
},
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.1,
"position": [620, 1220],
"id": "dabc2356-3660-4d17-b305-936a002029ba",
"name": "Execute Workflow with param2"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "c93f26bd-3489-467b-909e-6462e1463707",
"name": "uid",
"value": "={{ $json.uid }}",
"type": "string"
},
{
"id": "3dd706ce-d925-4219-8531-ad12369972fe",
"name": "email",
"value": "={{ $json.email }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [840, 1220],
"id": "9d2a9dda-e2a1-43e8-a66f-a8a555692e5f",
"name": "Edit Fields7"
},
{
"parameters": {
"source": "parameter",
"workflowJson": "{\n \"meta\": {\n \"instanceId\": \"a786b722078489c1fa382391a9f3476c2784761624deb2dfb4634827256d51a0\"\n },\n \"nodes\": [\n {\n \"parameters\": {},\n \"type\": \"n8n-nodes-base.executeWorkflowTrigger\",\n \"typeVersion\": 1,\n \"position\": [\n 0,\n 0\n ],\n \"id\": \"00600a51-e63a-4b6e-93f5-f01d50a21e0c\",\n \"name\": \"Execute Workflow Trigger\"\n },\n {\n \"parameters\": {\n \"assignments\": {\n \"assignments\": [\n {\n \"id\": \"87ff01af-2e28-48da-ae6c-304040200b15\",\n \"name\": \"hello\",\n \"value\": \"=world {{ $json.firstname }} {{ $json.lastname }}\",\n \"type\": \"string\"\n }\n ]\n },\n \"includeOtherFields\": false,\n \"options\": {}\n },\n \"type\": \"n8n-nodes-base.set\",\n \"typeVersion\": 3.4,\n \"position\": [\n 280,\n 0\n ],\n \"id\": \"642219a1-d655-4a30-af5c-fcccbb690322\",\n \"name\": \"Edit Fields\"\n }\n ],\n \"connections\": {\n \"Execute Workflow Trigger\": {\n \"main\": [\n [\n {\n \"node\": \"Edit Fields\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n }\n },\n \"pinData\": {}\n}",
"mode": "each",
"options": {
"waitForSubWorkflow": true
}
},
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.1,
"position": [560, 900],
"id": "07e47f60-622a-484c-ab24-35f6f2280595",
"name": "Execute Workflow with param1"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "c93f26bd-3489-467b-909e-6462e1463707",
"name": "uid",
"value": "={{ $json.uid }}",
"type": "string"
},
{
"id": "3dd706ce-d925-4219-8531-ad12369972fe",
"name": "email",
"value": "={{ $json.email }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [760, 900],
"id": "80563d0a-0bab-444f-a04c-4041a505d78b",
"name": "Edit Fields6"
},
{
"parameters": {
"source": "parameter",
"workflowJson": "{\n \"meta\": {\n \"instanceId\": \"a786b722078489c1fa382391a9f3476c2784761624deb2dfb4634827256d51a0\"\n },\n \"nodes\": [\n {\n \"parameters\": {},\n \"type\": \"n8n-nodes-base.executeWorkflowTrigger\",\n \"typeVersion\": 1,\n \"position\": [\n 0,\n 0\n ],\n \"id\": \"00600a51-e63a-4b6e-93f5-f01d50a21e0c\",\n \"name\": \"Execute Workflow Trigger\"\n },\n {\n \"parameters\": {\n \"assignments\": {\n \"assignments\": [\n {\n \"id\": \"87ff01af-2e28-48da-ae6c-304040200b15\",\n \"name\": \"hello\",\n \"value\": \"=world {{ $json.firstname }} {{ $json.lastname }}\",\n \"type\": \"string\"\n }\n ]\n },\n \"includeOtherFields\": false,\n \"options\": {}\n },\n \"type\": \"n8n-nodes-base.set\",\n \"typeVersion\": 3.4,\n \"position\": [\n 280,\n 0\n ],\n \"id\": \"642219a1-d655-4a30-af5c-fcccbb690322\",\n \"name\": \"Edit Fields\"\n }\n ],\n \"connections\": {\n \"Execute Workflow Trigger\": {\n \"main\": [\n [\n {\n \"node\": \"Edit Fields\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n }\n },\n \"pinData\": {}\n}",
"options": {
"waitForSubWorkflow": true
}
},
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.1,
"position": [560, 580],
"id": "f04af481-f4d9-4d91-a60a-a377580e8393",
"name": "Execute Workflow with param"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "c93f26bd-3489-467b-909e-6462e1463707",
"name": "uid",
"value": "={{ $json.uid }}",
"type": "string"
},
{
"id": "3dd706ce-d925-4219-8531-ad12369972fe",
"name": "email",
"value": "={{ $json.email }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [760, 580],
"id": "80c10607-a0ac-4090-86a1-890da0a2aa52",
"name": "Edit Fields2"
},
{
"parameters": {
"content": "## Execute Workflow (Run once with all items/ DONT Wait for Sub-workflow completion)",
"height": 254.84308966329985,
"width": 457.58120569815793
},
"id": "534ef523-3453-4a16-9ff0-8ac9f025d47d",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [500, 1080]
},
{
"parameters": {
"content": "## Execute Workflow (Run once with for each item/ DONT Wait for Sub-workflow completion) ",
"height": 284.59778445962905,
"width": 457.58120569815793
},
"id": "838f0fa3-5ee4-4d1a-afb8-42e009f1aa9e",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [580, 1400]
},
{
"parameters": {
"category": "randomData",
"randomDataSeed": "1",
"randomDataCount": 3
},
"id": "86699a49-2aa7-488e-8ea9-828404c98f08",
"name": "DebugHelper",
"type": "n8n-nodes-base.debugHelper",
"typeVersion": 1,
"position": [320, 1120]
},
{
"parameters": {
"content": "## Execute Workflow (Run once with for each item/ Wait for Sub-workflow completion) ",
"height": 284.59778445962905,
"width": 457.58120569815793
},
"id": "885d35f0-8ae6-45ec-821b-a82c27e7577a",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [480, 760]
},
{
"parameters": {
"content": "## Execute Workflow (Run once with all items/ Wait for Sub-workflow completion) (default behavior)",
"height": 254.84308966329985,
"width": 457.58120569815793
},
"id": "505bd7f2-767e-41b8-9325-77300aed5883",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [460, 460]
}
],
"connections": {
"When clicking Test workflow": {
"main": [
[
{
"node": "DebugHelper1",
"type": "main",
"index": 0
},
{
"node": "DebugHelper",
"type": "main",
"index": 0
}
]
]
},
"DebugHelper1": {
"main": [
[
{
"node": "Execute Workflow with param3",
"type": "main",
"index": 0
},
{
"node": "Execute Workflow with param2",
"type": "main",
"index": 0
},
{
"node": "Execute Workflow with param1",
"type": "main",
"index": 0
},
{
"node": "Execute Workflow with param",
"type": "main",
"index": 0
}
]
]
},
"Execute Workflow with param3": {
"main": [
[
{
"node": "Edit Fields8",
"type": "main",
"index": 0
}
]
]
},
"Execute Workflow with param2": {
"main": [
[
{
"node": "Edit Fields7",
"type": "main",
"index": 0
}
]
]
},
"Execute Workflow with param1": {
"main": [
[
{
"node": "Edit Fields6",
"type": "main",
"index": 0
}
]
]
},
"Execute Workflow with param": {
"main": [
[
{
"node": "Edit Fields2",
"type": "main",
"index": 0
}
]
]
},
"DebugHelper": {
"main": [
[
{
"node": "Execute Workflow with param2",
"type": "main",
"index": 0
},
{
"node": "Execute Workflow with param3",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {}
}

View File

@@ -323,6 +323,12 @@ export class NDV extends BasePage {
addItemToFixedCollection: (paramName: string) => {
this.getters.fixedCollectionParameter(paramName).getByTestId('fixed-collection-add').click();
},
dragMainPanelToLeft: () => {
cy.drag('[data-test-id=panel-drag-button]', [-1000, 0], { moveTwice: true });
},
dragMainPanelToRight: () => {
cy.drag('[data-test-id=panel-drag-button]', [1000, 0], { moveTwice: true });
},
};
}

View File

@@ -177,6 +177,16 @@ Cypress.Commands.add('drag', (selector, pos, options) => {
pageY: newPosition.y,
force: true,
});
if (options?.moveTwice) {
// first move like hover to trigger object to be visible
// like in main panel in ndv
element.trigger('mousemove', {
which: 1,
pageX: newPosition.x,
pageY: newPosition.y,
force: true,
});
}
if (options?.clickToFinish) {
// Click to finish the drag
// For some reason, mouseup isn't working when moving nodes

View File

@@ -59,7 +59,13 @@ declare global {
drag(
selector: string | Chainable<JQuery<HTMLElement>>,
target: [number, number],
options?: { abs?: boolean; index?: number; realMouse?: boolean; clickToFinish?: boolean },
options?: {
abs?: boolean;
index?: number;
realMouse?: boolean;
clickToFinish?: boolean;
moveTwice?: boolean;
},
): void;
draganddrop(
draggableSelector: string,