test(editor): Improve canvas e2e tests reliability (#5376)

✔️ Improving reliability of connection actions hover
This commit is contained in:
Milorad FIlipović 2023-02-06 16:33:59 +01:00 committed by GitHub
parent 31130d5257
commit 03afd3c7cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View file

@ -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', () => {

View file

@ -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);
});

View file

@ -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);
},
};
}