-
Notifications
You must be signed in to change notification settings - Fork 9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(editor): Implement workflowSelector parameter type (#10482)
- Loading branch information
1 parent
a73b9a3
commit 84e54be
Showing
18 changed files
with
954 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { EXECUTE_WORKFLOW_NODE_NAME } from '../constants'; | ||
import { WorkflowPage as WorkflowPageClass, NDV } from '../pages'; | ||
import { getVisiblePopper } from '../utils'; | ||
|
||
const workflowPage = new WorkflowPageClass(); | ||
const ndv = new NDV(); | ||
|
||
describe('Workflow Selector Parameter', () => { | ||
beforeEach(() => { | ||
cy.resetDatabase(); | ||
cy.signinAsOwner(); | ||
['Get_Weather', 'Search_DB'].forEach((workflowName) => { | ||
workflowPage.actions.visit(); | ||
cy.createFixtureWorkflow(`Test_Subworkflow_${workflowName}.json`, workflowName); | ||
workflowPage.actions.saveWorkflowOnButtonClick(); | ||
}); | ||
workflowPage.actions.visit(); | ||
workflowPage.actions.addInitialNodeToCanvas(EXECUTE_WORKFLOW_NODE_NAME, { | ||
keepNdvOpen: true, | ||
action: 'Call Another Workflow', | ||
}); | ||
}); | ||
it('should render sub-workflows list', () => { | ||
ndv.getters.resourceLocator('workflowId').should('be.visible'); | ||
ndv.getters.resourceLocatorInput('workflowId').click(); | ||
|
||
getVisiblePopper() | ||
.should('have.length', 1) | ||
.findChildByTestId('rlc-item') | ||
.should('have.length', 2); | ||
}); | ||
|
||
it('should show required parameter warning', () => { | ||
ndv.getters.resourceLocator('workflowId').should('be.visible'); | ||
ndv.getters.resourceLocatorInput('workflowId').click(); | ||
ndv.getters.parameterInputIssues('workflowId').should('exist'); | ||
}); | ||
|
||
it('should filter sub-workflows list', () => { | ||
ndv.getters.resourceLocator('workflowId').should('be.visible'); | ||
ndv.getters.resourceLocatorInput('workflowId').click(); | ||
ndv.getters.resourceLocatorSearch('workflowId').type('Weather'); | ||
|
||
getVisiblePopper() | ||
.should('have.length', 1) | ||
.findChildByTestId('rlc-item') | ||
.should('have.length', 1) | ||
.click(); | ||
|
||
ndv.getters | ||
.resourceLocatorInput('workflowId') | ||
.find('input') | ||
.should('have.value', 'Get_Weather'); | ||
}); | ||
|
||
it('should render sub-workflow links correctly', () => { | ||
ndv.getters.resourceLocator('workflowId').should('be.visible'); | ||
ndv.getters.resourceLocatorInput('workflowId').click(); | ||
|
||
getVisiblePopper().findChildByTestId('rlc-item').first().click(); | ||
|
||
ndv.getters.resourceLocatorInput('workflowId').find('a').should('exist'); | ||
cy.getByTestId('radio-button-expression').eq(1).click(); | ||
ndv.getters.resourceLocatorInput('workflowId').find('a').should('not.exist'); | ||
}); | ||
|
||
it('should switch to ID mode on expression', () => { | ||
ndv.getters.resourceLocator('workflowId').should('be.visible'); | ||
ndv.getters.resourceLocatorInput('workflowId').click(); | ||
|
||
getVisiblePopper().findChildByTestId('rlc-item').first().click(); | ||
ndv.getters | ||
.resourceLocatorModeSelector('workflowId') | ||
.find('input') | ||
.should('have.value', 'From list'); | ||
cy.getByTestId('radio-button-expression').eq(1).click(); | ||
ndv.getters | ||
.resourceLocatorModeSelector('workflowId') | ||
.find('input') | ||
.should('have.value', 'By ID'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"name": "Get Weather", | ||
"nodes": [ | ||
{ | ||
"parameters": {}, | ||
"id": "82eed1ba-179b-4f8f-8a85-b45f0d4e5857", | ||
"name": "Execute Workflow Trigger", | ||
"type": "n8n-nodes-base.executeWorkflowTrigger", | ||
"typeVersion": 1, | ||
"position": [ | ||
560, | ||
340 | ||
] | ||
}, | ||
{ | ||
"parameters": { | ||
"assignments": { | ||
"assignments": [ | ||
{ | ||
"id": "6ad8dc55-20f3-45af-a724-c7ecac90d338", | ||
"name": "response", | ||
"value": "Weather is sunny", | ||
"type": "string" | ||
} | ||
] | ||
}, | ||
"options": {} | ||
}, | ||
"id": "8f3e00f6-fc92-4aba-817b-93d206158bda", | ||
"name": "Edit Fields", | ||
"type": "n8n-nodes-base.set", | ||
"typeVersion": 3.4, | ||
"position": [ | ||
780, | ||
340 | ||
] | ||
} | ||
], | ||
"pinData": {}, | ||
"connections": { | ||
"Execute Workflow Trigger": { | ||
"main": [ | ||
[ | ||
{ | ||
"node": "Edit Fields", | ||
"type": "main", | ||
"index": 0 | ||
} | ||
] | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "Search DB", | ||
"nodes": [ | ||
{ | ||
"parameters": {}, | ||
"id": "64465f9b-63de-43f9-8d90-b5b2eb7a2dc7", | ||
"name": "Execute Workflow Trigger", | ||
"type": "n8n-nodes-base.executeWorkflowTrigger", | ||
"typeVersion": 1, | ||
"position": [ | ||
640, | ||
380 | ||
] | ||
}, | ||
{ | ||
"parameters": { | ||
"assignments": { | ||
"assignments": [ | ||
{ | ||
"id": "6ad8dc55-20f3-45af-a724-c7ecac90d338", | ||
"name": "response", | ||
"value": "10 results found", | ||
"type": "string" | ||
} | ||
] | ||
}, | ||
"options": {} | ||
}, | ||
"id": "b580fd2b-00c8-4a52-8acb-024f204c0947", | ||
"name": "Edit Fields", | ||
"type": "n8n-nodes-base.set", | ||
"typeVersion": 3.4, | ||
"position": [ | ||
860, | ||
380 | ||
] | ||
} | ||
], | ||
"pinData": {}, | ||
"connections": { | ||
"Execute Workflow Trigger": { | ||
"main": [ | ||
[ | ||
{ | ||
"node": "Edit Fields", | ||
"type": "main", | ||
"index": 0 | ||
} | ||
] | ||
] | ||
} | ||
}, | ||
"active": false, | ||
"settings": { | ||
"executionOrder": "v1" | ||
}, | ||
"versionId": "6026f7a4-f5dc-4c27-9f83-3a02fc6e33ae", | ||
"meta": { | ||
"templateCredsSetupCompleted": true, | ||
"instanceId": "27cc9b56542ad45b38725555722c50a1c3fee1670bbb67980558314ee08517c4" | ||
}, | ||
"id": "BFFhCdBZmNSkx4qf", | ||
"tags": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.