From 03afd3c7cf80e89f1195b1e54746b3335dc9f3d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milorad=20FIlipovi=C4=87?= Date: Mon, 6 Feb 2023 16:33:59 +0100 Subject: [PATCH] test(editor): Improve canvas e2e tests reliability (#5376) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✔️ Improving reliability of connection actions hover --- cypress/e2e/10-undo-redo.cy.ts | 11 ++++------- cypress/e2e/12-canvas.cy.ts | 6 ++---- cypress/pages/workflow.ts | 5 +++++ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cypress/e2e/10-undo-redo.cy.ts b/cypress/e2e/10-undo-redo.cy.ts index e76091b553..3222b533ab 100644 --- a/cypress/e2e/10-undo-redo.cy.ts +++ b/cypress/e2e/10-undo-redo.cy.ts @@ -38,17 +38,14 @@ describe('Undo/Redo', () => { it('should undo/redo adding node in the middle', () => { WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME); WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME); - WorkflowPage.actions.addNodeToCanvas(SET_NODE_NAME); - WorkflowPage.getters.nodeConnections().realHover(); - cy.get('.connection-actions .add').filter(':visible').click(); - WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME, false); + WorkflowPage.actions.addNodeBetweenFirstTwoNodes(CODE_NODE_NAME); WorkflowPage.actions.zoomToFit(); WorkflowPage.actions.hitUndo(); + WorkflowPage.getters.canvasNodes().should('have.have.length', 2); + WorkflowPage.getters.nodeConnections().should('have.length', 1); + WorkflowPage.actions.hitRedo(); WorkflowPage.getters.canvasNodes().should('have.have.length', 3); WorkflowPage.getters.nodeConnections().should('have.length', 2); - WorkflowPage.actions.hitRedo(); - WorkflowPage.getters.canvasNodes().should('have.have.length', 4); - WorkflowPage.getters.nodeConnections().should('have.length', 3); }); it('should undo/redo deleting node using delete button', () => { diff --git a/cypress/e2e/12-canvas.cy.ts b/cypress/e2e/12-canvas.cy.ts index 3651ce163a..113d054170 100644 --- a/cypress/e2e/12-canvas.cy.ts +++ b/cypress/e2e/12-canvas.cy.ts @@ -61,9 +61,7 @@ describe('Canvas Actions', () => { it('should add note between two connected nodes', () => { WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME); WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME); - WorkflowPage.getters.nodeConnections().first().realHover(); - cy.get('.connection-actions .add').filter(':visible').should('be.visible').click() - WorkflowPage.actions.addNodeToCanvas(SET_NODE_NAME, false); + WorkflowPage.actions.addNodeBetweenFirstTwoNodes(SET_NODE_NAME); WorkflowPage.getters.canvasNodes().should('have.length', 3); WorkflowPage.getters.nodeConnections().should('have.length', 2); // And last node should be pushed to the right @@ -218,7 +216,7 @@ describe('Canvas Actions', () => { WorkflowPage.actions.addNodeToCanvas(MANUAL_TRIGGER_NODE_NAME); WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME); WorkflowPage.getters.nodeConnections().first().realHover(); - cy.get('.connection-actions .delete').filter(':visible').should('be.visible').click(); + cy.get('.connection-actions .delete').first().click({ force: true }); WorkflowPage.getters.nodeConnections().should('have.length', 0); }); diff --git a/cypress/pages/workflow.ts b/cypress/pages/workflow.ts index 67a16c4421..f17ad0144c 100644 --- a/cypress/pages/workflow.ts +++ b/cypress/pages/workflow.ts @@ -170,5 +170,10 @@ export class WorkflowPage extends BasePage { executeWorkflow: () => { this.getters.executeWorkflowButton().click(); }, + addNodeBetweenFirstTwoNodes: (nodeName: string) => { + this.getters.nodeConnections().first().realHover(); + cy.get('.connection-actions .add').first().click({ force: true }); + this.actions.addNodeToCanvas(nodeName, false); + }, }; }