chore: Update NDV e2e tests for Canvas V2 (#12214)

This commit is contained in:
Charlie Kolb 2024-12-13 16:48:56 +01:00 committed by GitHub
parent 73a2aa0c00
commit d937e5abe8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 4 deletions

View file

@ -111,6 +111,7 @@ describe('NDV', () => {
cy.get('[class*=hasIssues]').should('have.length', 1);
});
// Correctly failing in V2 - node issues are only shows after execution
it('should show all validation errors when opening pasted node', () => {
cy.createFixtureWorkflow('Test_workflow_ndv_errors.json', 'Validation errors');
workflowPage.getters.canvasNodes().should('have.have.length', 1);
@ -213,9 +214,11 @@ describe('NDV', () => {
.should('not.be.visible');
});
});
it('should not display pagination for schema', () => {
setupSchemaWorkflow();
ndv.getters.backToCanvas().click();
workflowPage.actions.deselectAll();
workflowPage.getters.canvasNodeByName('Set').click();
workflowPage.actions.addNodeToCanvas(
'Customer Datastore (n8n training)',
@ -407,8 +410,18 @@ describe('NDV', () => {
return cy.get(`[data-node-placement=${position}]`);
}
// Correctly failing in V2 - due to floating navigation not updating the selected node
it('should traverse floating nodes with mouse', () => {
cy.createFixtureWorkflow('Floating_Nodes.json', 'Floating Nodes');
cy.ifCanvasVersion(
() => {},
() => {
// Needed in V2 as all nodes remain selected when clicking on a selected node
workflowPage.actions.deselectAll();
},
);
workflowPage.getters.canvasNodes().first().dblclick();
getFloatingNodeByPosition('inputMain').should('not.exist');
getFloatingNodeByPosition('outputMain').should('exist');
@ -419,6 +432,7 @@ describe('NDV', () => {
getFloatingNodeByPosition('inputMain').should('exist');
getFloatingNodeByPosition('outputMain').should('exist');
ndv.actions.close();
// These two lines are broken in V2
workflowPage.getters.selectedNodes().should('have.length', 1);
workflowPage.getters
.selectedNodes()
@ -426,10 +440,8 @@ describe('NDV', () => {
.should('contain', `Node ${i + 1}`);
workflowPage.getters.selectedNodes().first().dblclick();
});
getFloatingNodeByPosition('outputMain').click({ force: true });
ndv.getters.nodeNameContainer().should('contain', 'Chain');
// Traverse 4 connected node backwards
Array.from(Array(4).keys()).forEach((i) => {
getFloatingNodeByPosition('inputMain').click({ force: true });
@ -453,8 +465,17 @@ describe('NDV', () => {
.should('contain', MANUAL_TRIGGER_NODE_DISPLAY_NAME);
});
// Correctly failing in V2 - due to floating navigation not updating the selected node
it('should traverse floating nodes with keyboard', () => {
cy.createFixtureWorkflow('Floating_Nodes.json', 'Floating Nodes');
cy.ifCanvasVersion(
() => {},
() => {
// Needed in V2 as all nodes remain selected when clicking on a selected node
workflowPage.actions.deselectAll();
},
);
workflowPage.getters.canvasNodes().first().dblclick();
getFloatingNodeByPosition('inputMain').should('not.exist');
getFloatingNodeByPosition('outputMain').should('exist');
@ -465,6 +486,7 @@ describe('NDV', () => {
getFloatingNodeByPosition('inputMain').should('exist');
getFloatingNodeByPosition('outputMain').should('exist');
ndv.actions.close();
// These two lines are broken in V2
workflowPage.getters.selectedNodes().should('have.length', 1);
workflowPage.getters
.selectedNodes()
@ -492,6 +514,7 @@ describe('NDV', () => {
getFloatingNodeByPosition('inputSub').should('not.exist');
getFloatingNodeByPosition('outputSub').should('not.exist');
ndv.actions.close();
// These two lines are broken in V2
workflowPage.getters.selectedNodes().should('have.length', 1);
workflowPage.getters
.selectedNodes()
@ -717,6 +740,7 @@ describe('NDV', () => {
.should('have.value', 'Error fetching options from Notion');
});
// Correctly failing in V2 - NodeCreator is not opened after clicking on the link
it('Should open appropriate node creator after clicking on connection hint link', () => {
const nodeCreator = new NodeCreator();
const hintMapper = {
@ -734,6 +758,7 @@ describe('NDV', () => {
Object.entries(hintMapper).forEach(([node, group]) => {
workflowPage.actions.openNode(node);
// This fails to open the NodeCreator
cy.get('[data-action=openSelectiveNodeCreator]').contains('Insert one').click();
nodeCreator.getters.activeSubcategory().should('contain', group);
cy.realPress('Escape');

View file

@ -333,8 +333,14 @@ export class WorkflowPage extends BasePage {
this.actions.contextMenuAction('select_all');
},
deselectAll: () => {
this.actions.openContextMenu();
this.actions.contextMenuAction('deselect_all');
cy.ifCanvasVersion(
() => {
this.actions.openContextMenu();
this.actions.contextMenuAction('deselect_all');
},
// rightclick doesn't work with vueFlow canvas
() => this.getters.nodeViewBackground().click('topLeft'),
);
},
openExpressionEditorModal: () => {
cy.contains('Expression').invoke('show').click();