mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 09:36:44 +00:00
feat(editor): Supress validation errors for freshly added nodes (#5149)
* feat(editor): Supress validation errors when node is added from node creator * Supress initial errors also for resource locator inputs * Use nodeMetadata prop to store node's `pristine` state * Revert `setNodeParameters` check for `nodeMetadata` * Rename getIsNodePristine to isNodePristine
This commit is contained in:
@@ -53,4 +53,41 @@ describe('NDV', () => {
|
||||
ndv.getters.dataContainer().should('contain', 'start');
|
||||
});
|
||||
});
|
||||
|
||||
it('should show correct validation state for resource locator params', () => {
|
||||
workflowPage.actions.addNodeToCanvas('Typeform', true);
|
||||
ndv.getters.container().should('be.visible');
|
||||
cy.get('.has-issues').should('have.length', 0);
|
||||
cy.get('[class*=hasIssues]').should('have.length', 0);
|
||||
ndv.getters.backToCanvas().click();
|
||||
// Both credentials and resource locator errors should be visible
|
||||
workflowPage.actions.openNodeNdv('Typeform');
|
||||
cy.get('.has-issues').should('have.length', 1);
|
||||
cy.get('[class*=hasIssues]').should('have.length', 1);
|
||||
});
|
||||
|
||||
it('should show validation errors only after blur or re-opening of NDV', () => {
|
||||
workflowPage.actions.addNodeToCanvas('Manual Trigger');
|
||||
workflowPage.actions.addNodeToCanvas('Airtable', true);
|
||||
ndv.getters.container().should('be.visible');
|
||||
cy.get('.has-issues').should('have.length', 0);
|
||||
workflowPage.getters.ndvParameterInput('table').find('input').eq(1).focus().blur()
|
||||
workflowPage.getters.ndvParameterInput('application').find('input').eq(1).focus().blur()
|
||||
cy.get('.has-issues').should('have.length', 2);
|
||||
ndv.getters.backToCanvas().click();
|
||||
workflowPage.actions.openNodeNdv('Airtable');
|
||||
cy.get('.has-issues').should('have.length', 3);
|
||||
cy.get('[class*=hasIssues]').should('have.length', 1);
|
||||
});
|
||||
|
||||
it('should show all validation errors when opening pasted node', () => {
|
||||
cy.fixture('Test_workflow_ndv_errors.json').then((data) => {
|
||||
cy.get('body').paste(JSON.stringify(data));
|
||||
workflowPage.getters.canvasNodes().should('have.have.length', 1);
|
||||
workflowPage.actions.openNodeNdv('Airtable');
|
||||
cy.get('.has-issues').should('have.length', 3);
|
||||
cy.get('[class*=hasIssues]').should('have.length', 1);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
32
cypress/fixtures/Test_workflow_ndv_errors.json
Normal file
32
cypress/fixtures/Test_workflow_ndv_errors.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "3204fc455f5cbeb4e71fdbd3b1dfaf0b088088dea3e639de49e61462b80ffc1d"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"application": {
|
||||
"__rl": true,
|
||||
"mode": "url",
|
||||
"value": "",
|
||||
"__regex": "https://airtable.com/([a-zA-Z0-9]{2,})"
|
||||
},
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"mode": "url",
|
||||
"value": "",
|
||||
"__regex": "https://airtable.com/[a-zA-Z0-9]{2,}/([a-zA-Z0-9]{2,})"
|
||||
}
|
||||
},
|
||||
"id": "e0c0cf7e-aa98-4b72-9645-6e64e2902bd1",
|
||||
"name": "Airtable",
|
||||
"type": "n8n-nodes-base.airtable",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
380,
|
||||
180
|
||||
]
|
||||
}
|
||||
],
|
||||
"connections": {}
|
||||
}
|
||||
@@ -93,11 +93,12 @@ export class WorkflowPage extends BasePage {
|
||||
this.getters.nodeCreatorSearchBar().type('{enter}');
|
||||
cy.get('body').type('{esc}');
|
||||
},
|
||||
addNodeToCanvas: (nodeDisplayName: string) => {
|
||||
addNodeToCanvas: (nodeDisplayName: string, preventNdvClose?: boolean) => {
|
||||
this.getters.nodeCreatorPlusButton().click();
|
||||
this.getters.nodeCreatorSearchBar().type(nodeDisplayName);
|
||||
this.getters.nodeCreatorSearchBar().type('{enter}');
|
||||
cy.get('body').type('{esc}');
|
||||
|
||||
if (!preventNdvClose) cy.get('body').type('{esc}');
|
||||
},
|
||||
openNodeNdv: (nodeTypeName: string) => {
|
||||
this.getters.canvasNodeByName(nodeTypeName).dblclick();
|
||||
|
||||
Reference in New Issue
Block a user