From 2df6e4210a8c4f557c6e32fa6d77b5812831ef61 Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Thu, 11 Jan 2024 13:44:10 +0100 Subject: [PATCH] test: Add back E2E tests --- cypress/e2e/19-execution.cy.ts | 556 ++++++++++++++++----------------- 1 file changed, 278 insertions(+), 278 deletions(-) diff --git a/cypress/e2e/19-execution.cy.ts b/cypress/e2e/19-execution.cy.ts index bc6d1366f3388..2598b3f0f9a92 100644 --- a/cypress/e2e/19-execution.cy.ts +++ b/cypress/e2e/19-execution.cy.ts @@ -10,284 +10,284 @@ describe('Execution', () => { workflowPage.actions.visit(); }); - // it('should test manual workflow', () => { - // cy.createFixtureWorkflow('Manual_wait_set.json', `Manual wait set ${uuid()}`); - - // // Check workflow buttons - // workflowPage.getters.executeWorkflowButton().should('be.visible'); - // workflowPage.getters.clearExecutionDataButton().should('not.exist'); - // workflowPage.getters.stopExecutionButton().should('not.exist'); - // workflowPage.getters.stopExecutionWaitingForWebhookButton().should('not.exist'); - - // // Execute the workflow - // workflowPage.getters.zoomToFitButton().click(); - // workflowPage.getters.executeWorkflowButton().click(); - - // // Check workflow buttons - // workflowPage.getters.executeWorkflowButton().get('.n8n-spinner').should('be.visible'); - // workflowPage.getters.clearExecutionDataButton().should('not.exist'); - // workflowPage.getters.stopExecutionButton().should('be.visible'); - // workflowPage.getters.stopExecutionWaitingForWebhookButton().should('not.exist'); - - // // Check canvas nodes after 1st step (workflow passed the manual trigger node - // workflowPage.getters - // .canvasNodeByName('Manual') - // .within(() => cy.get('.fa-check')) - // .should('exist'); - // workflowPage.getters - // .canvasNodeByName('Wait') - // .within(() => cy.get('.fa-check').should('not.exist')); - // workflowPage.getters - // .canvasNodeByName('Wait') - // .within(() => cy.get('.fa-sync-alt')) - // .should('exist'); - // workflowPage.getters - // .canvasNodeByName('Set') - // .within(() => cy.get('.fa-check').should('not.exist')); - - // cy.wait(2000); - - // // Check canvas nodes after 2nd step (waiting node finished its execution and the http request node is about to start) - // workflowPage.getters - // .canvasNodeByName('Manual') - // .within(() => cy.get('.fa-check')) - // .should('exist'); - // workflowPage.getters - // .canvasNodeByName('Wait') - // .within(() => cy.get('.fa-check')) - // .should('exist'); - // workflowPage.getters - // .canvasNodeByName('Set') - // .within(() => cy.get('.fa-check')) - // .should('exist'); - - // // Clear execution data - // workflowPage.getters.clearExecutionDataButton().should('be.visible'); - // workflowPage.getters.clearExecutionDataButton().click(); - // workflowPage.getters.clearExecutionDataButton().should('not.exist'); - - // // Check success toast (works because Cypress waits enough for the element to show after the http request node has finished) - // workflowPage.getters.successToast().should('be.visible'); - // }); - - // it('should test manual workflow stop', () => { - // cy.createFixtureWorkflow('Manual_wait_set.json', `Manual wait set ${uuid()}`); - - // // Check workflow buttons - // workflowPage.getters.executeWorkflowButton().should('be.visible'); - // workflowPage.getters.clearExecutionDataButton().should('not.exist'); - // workflowPage.getters.stopExecutionButton().should('not.exist'); - // workflowPage.getters.stopExecutionWaitingForWebhookButton().should('not.exist'); - - // // Execute the workflow - // workflowPage.getters.zoomToFitButton().click(); - // workflowPage.getters.executeWorkflowButton().click(); - - // // Check workflow buttons - // workflowPage.getters.executeWorkflowButton().get('.n8n-spinner').should('be.visible'); - // workflowPage.getters.clearExecutionDataButton().should('not.exist'); - // workflowPage.getters.stopExecutionButton().should('be.visible'); - // workflowPage.getters.stopExecutionWaitingForWebhookButton().should('not.exist'); - - // // Check canvas nodes after 1st step (workflow passed the manual trigger node - // workflowPage.getters - // .canvasNodeByName('Manual') - // .within(() => cy.get('.fa-check')) - // .should('exist'); - // workflowPage.getters - // .canvasNodeByName('Wait') - // .within(() => cy.get('.fa-check').should('not.exist')); - // workflowPage.getters - // .canvasNodeByName('Wait') - // .within(() => cy.get('.fa-sync-alt')) - // .should('exist'); - // workflowPage.getters - // .canvasNodeByName('Set') - // .within(() => cy.get('.fa-check').should('not.exist')); - - // workflowPage.getters.stopExecutionButton().should('exist'); - // workflowPage.getters.stopExecutionButton().click(); - - // // Check canvas nodes after workflow stopped - // workflowPage.getters - // .canvasNodeByName('Manual') - // .within(() => cy.get('.fa-check')) - // .should('exist'); - // workflowPage.getters - // .canvasNodeByName('Wait') - // .within(() => cy.get('.fa-sync-alt').should('not.visible')); - // workflowPage.getters - // .canvasNodeByName('Set') - // .within(() => cy.get('.fa-check').should('not.exist')); - - // // Clear execution data - // workflowPage.getters.clearExecutionDataButton().should('be.visible'); - // workflowPage.getters.clearExecutionDataButton().click(); - // workflowPage.getters.clearExecutionDataButton().should('not.exist'); - - // // Check success toast (works because Cypress waits enough for the element to show after the http request node has finished) - // workflowPage.getters.successToast().should('be.visible'); - // }); - - // it('should test webhook workflow', () => { - // cy.createFixtureWorkflow('Webhook_wait_set.json', `Webhook wait set ${uuid()}`); - - // // Check workflow buttons - // workflowPage.getters.executeWorkflowButton().should('be.visible'); - // workflowPage.getters.clearExecutionDataButton().should('not.exist'); - // workflowPage.getters.stopExecutionButton().should('not.exist'); - // workflowPage.getters.stopExecutionWaitingForWebhookButton().should('not.exist'); - - // // Execute the workflow - // workflowPage.getters.zoomToFitButton().click(); - // workflowPage.getters.executeWorkflowButton().click(); - - // // Check workflow buttons - // workflowPage.getters.executeWorkflowButton().get('.n8n-spinner').should('be.visible'); - // workflowPage.getters.clearExecutionDataButton().should('not.exist'); - // workflowPage.getters.stopExecutionButton().should('not.exist'); - // workflowPage.getters.stopExecutionWaitingForWebhookButton().should('be.visible'); - - // workflowPage.getters.canvasNodes().first().dblclick(); - - // ndv.getters.copyInput().click(); - - // cy.grantBrowserPermissions('clipboardReadWrite', 'clipboardSanitizedWrite'); - - // ndv.getters.backToCanvas().click(); - - // cy.readClipboard().then((url) => { - // cy.request({ - // method: 'GET', - // url, - // }).then((resp) => { - // expect(resp.status).to.eq(200); - // }); - // }); - - // // Check canvas nodes after 1st step (workflow passed the manual trigger node - // workflowPage.getters - // .canvasNodeByName('Webhook') - // .within(() => cy.get('.fa-check')) - // .should('exist'); - // workflowPage.getters - // .canvasNodeByName('Wait') - // .within(() => cy.get('.fa-check').should('not.exist')); - // workflowPage.getters - // .canvasNodeByName('Wait') - // .within(() => cy.get('.fa-sync-alt')) - // .should('exist'); - // workflowPage.getters - // .canvasNodeByName('Set') - // .within(() => cy.get('.fa-check').should('not.exist')); - - // cy.wait(2000); - - // // Check canvas nodes after 2nd step (waiting node finished its execution and the http request node is about to start) - // workflowPage.getters - // .canvasNodeByName('Webhook') - // .within(() => cy.get('.fa-check')) - // .should('exist'); - // workflowPage.getters - // .canvasNodeByName('Set') - // .within(() => cy.get('.fa-check')) - // .should('exist'); - - // // Clear execution data - // workflowPage.getters.clearExecutionDataButton().should('be.visible'); - // workflowPage.getters.clearExecutionDataButton().click(); - // workflowPage.getters.clearExecutionDataButton().should('not.exist'); - - // // Check success toast (works because Cypress waits enough for the element to show after the http request node has finished) - // workflowPage.getters.successToast().should('be.visible'); - // }); - - // it('should test webhook workflow stop', () => { - // cy.createFixtureWorkflow('Webhook_wait_set.json', `Webhook wait set ${uuid()}`); - - // // Check workflow buttons - // workflowPage.getters.executeWorkflowButton().should('be.visible'); - // workflowPage.getters.clearExecutionDataButton().should('not.exist'); - // workflowPage.getters.stopExecutionButton().should('not.exist'); - // workflowPage.getters.stopExecutionWaitingForWebhookButton().should('not.exist'); - - // // Execute the workflow - // workflowPage.getters.zoomToFitButton().click(); - // workflowPage.getters.executeWorkflowButton().click(); - - // // Check workflow buttons - // workflowPage.getters.executeWorkflowButton().get('.n8n-spinner').should('be.visible'); - // workflowPage.getters.clearExecutionDataButton().should('not.exist'); - // workflowPage.getters.stopExecutionButton().should('not.exist'); - // workflowPage.getters.stopExecutionWaitingForWebhookButton().should('be.visible'); - - // workflowPage.getters.canvasNodes().first().dblclick(); - - // ndv.getters.copyInput().click(); - - // cy.grantBrowserPermissions('clipboardReadWrite', 'clipboardSanitizedWrite'); - - // ndv.getters.backToCanvas().click(); - - // cy.readClipboard().then((url) => { - // cy.request({ - // method: 'GET', - // url, - // }).then((resp) => { - // expect(resp.status).to.eq(200); - // }); - // }); - - // workflowPage.getters.stopExecutionButton().click(); - // // Check canvas nodes after 1st step (workflow passed the manual trigger node - // workflowPage.getters - // .canvasNodeByName('Webhook') - // .within(() => cy.get('.fa-check')) - // .should('exist'); - // workflowPage.getters - // .canvasNodeByName('Wait') - // .within(() => cy.get('.fa-check').should('not.exist')); - // workflowPage.getters - // .canvasNodeByName('Wait') - // .within(() => cy.get('.fa-sync-alt')) - // .should('exist'); - // workflowPage.getters - // .canvasNodeByName('Set') - // .within(() => cy.get('.fa-check').should('not.exist')); - - // // Check canvas nodes after workflow stopped - // workflowPage.getters - // .canvasNodeByName('Webhook') - // .within(() => cy.get('.fa-check')) - // .should('exist'); - // workflowPage.getters - // .canvasNodeByName('Wait') - // .within(() => cy.get('.fa-sync-alt').should('not.visible')); - // workflowPage.getters - // .canvasNodeByName('Set') - // .within(() => cy.get('.fa-check').should('not.exist')); - - // // Clear execution data - // workflowPage.getters.clearExecutionDataButton().should('be.visible'); - // workflowPage.getters.clearExecutionDataButton().click(); - // workflowPage.getters.clearExecutionDataButton().should('not.exist'); - - // // Check success toast (works because Cypress waits enough for the element to show after the http request node has finished) - // workflowPage.getters.successToast().should('be.visible'); - // }); - - // describe('execution preview', () => { - // it('when deleting the last execution, it should show empty state', () => { - // workflowPage.actions.addInitialNodeToCanvas('Manual Trigger'); - // workflowPage.actions.executeWorkflow(); - // executionsTab.actions.switchToExecutionsTab(); - - // executionsTab.actions.deleteExecutionInPreview(); - - // executionsTab.getters.successfulExecutionListItems().should('have.length', 0); - // workflowPage.getters.successToast().contains('Execution deleted'); - // }); - // }); + it('should test manual workflow', () => { + cy.createFixtureWorkflow('Manual_wait_set.json', `Manual wait set ${uuid()}`); + + // Check workflow buttons + workflowPage.getters.executeWorkflowButton().should('be.visible'); + workflowPage.getters.clearExecutionDataButton().should('not.exist'); + workflowPage.getters.stopExecutionButton().should('not.exist'); + workflowPage.getters.stopExecutionWaitingForWebhookButton().should('not.exist'); + + // Execute the workflow + workflowPage.getters.zoomToFitButton().click(); + workflowPage.getters.executeWorkflowButton().click(); + + // Check workflow buttons + workflowPage.getters.executeWorkflowButton().get('.n8n-spinner').should('be.visible'); + workflowPage.getters.clearExecutionDataButton().should('not.exist'); + workflowPage.getters.stopExecutionButton().should('be.visible'); + workflowPage.getters.stopExecutionWaitingForWebhookButton().should('not.exist'); + + // Check canvas nodes after 1st step (workflow passed the manual trigger node + workflowPage.getters + .canvasNodeByName('Manual') + .within(() => cy.get('.fa-check')) + .should('exist'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-check').should('not.exist')); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-sync-alt')) + .should('exist'); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check').should('not.exist')); + + cy.wait(2000); + + // Check canvas nodes after 2nd step (waiting node finished its execution and the http request node is about to start) + workflowPage.getters + .canvasNodeByName('Manual') + .within(() => cy.get('.fa-check')) + .should('exist'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-check')) + .should('exist'); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check')) + .should('exist'); + + // Clear execution data + workflowPage.getters.clearExecutionDataButton().should('be.visible'); + workflowPage.getters.clearExecutionDataButton().click(); + workflowPage.getters.clearExecutionDataButton().should('not.exist'); + + // Check success toast (works because Cypress waits enough for the element to show after the http request node has finished) + workflowPage.getters.successToast().should('be.visible'); + }); + + it('should test manual workflow stop', () => { + cy.createFixtureWorkflow('Manual_wait_set.json', `Manual wait set ${uuid()}`); + + // Check workflow buttons + workflowPage.getters.executeWorkflowButton().should('be.visible'); + workflowPage.getters.clearExecutionDataButton().should('not.exist'); + workflowPage.getters.stopExecutionButton().should('not.exist'); + workflowPage.getters.stopExecutionWaitingForWebhookButton().should('not.exist'); + + // Execute the workflow + workflowPage.getters.zoomToFitButton().click(); + workflowPage.getters.executeWorkflowButton().click(); + + // Check workflow buttons + workflowPage.getters.executeWorkflowButton().get('.n8n-spinner').should('be.visible'); + workflowPage.getters.clearExecutionDataButton().should('not.exist'); + workflowPage.getters.stopExecutionButton().should('be.visible'); + workflowPage.getters.stopExecutionWaitingForWebhookButton().should('not.exist'); + + // Check canvas nodes after 1st step (workflow passed the manual trigger node + workflowPage.getters + .canvasNodeByName('Manual') + .within(() => cy.get('.fa-check')) + .should('exist'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-check').should('not.exist')); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-sync-alt')) + .should('exist'); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check').should('not.exist')); + + workflowPage.getters.stopExecutionButton().should('exist'); + workflowPage.getters.stopExecutionButton().click(); + + // Check canvas nodes after workflow stopped + workflowPage.getters + .canvasNodeByName('Manual') + .within(() => cy.get('.fa-check')) + .should('exist'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-sync-alt').should('not.visible')); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check').should('not.exist')); + + // Clear execution data + workflowPage.getters.clearExecutionDataButton().should('be.visible'); + workflowPage.getters.clearExecutionDataButton().click(); + workflowPage.getters.clearExecutionDataButton().should('not.exist'); + + // Check success toast (works because Cypress waits enough for the element to show after the http request node has finished) + workflowPage.getters.successToast().should('be.visible'); + }); + + it('should test webhook workflow', () => { + cy.createFixtureWorkflow('Webhook_wait_set.json', `Webhook wait set ${uuid()}`); + + // Check workflow buttons + workflowPage.getters.executeWorkflowButton().should('be.visible'); + workflowPage.getters.clearExecutionDataButton().should('not.exist'); + workflowPage.getters.stopExecutionButton().should('not.exist'); + workflowPage.getters.stopExecutionWaitingForWebhookButton().should('not.exist'); + + // Execute the workflow + workflowPage.getters.zoomToFitButton().click(); + workflowPage.getters.executeWorkflowButton().click(); + + // Check workflow buttons + workflowPage.getters.executeWorkflowButton().get('.n8n-spinner').should('be.visible'); + workflowPage.getters.clearExecutionDataButton().should('not.exist'); + workflowPage.getters.stopExecutionButton().should('not.exist'); + workflowPage.getters.stopExecutionWaitingForWebhookButton().should('be.visible'); + + workflowPage.getters.canvasNodes().first().dblclick(); + + ndv.getters.copyInput().click(); + + cy.grantBrowserPermissions('clipboardReadWrite', 'clipboardSanitizedWrite'); + + ndv.getters.backToCanvas().click(); + + cy.readClipboard().then((url) => { + cy.request({ + method: 'GET', + url, + }).then((resp) => { + expect(resp.status).to.eq(200); + }); + }); + + // Check canvas nodes after 1st step (workflow passed the manual trigger node + workflowPage.getters + .canvasNodeByName('Webhook') + .within(() => cy.get('.fa-check')) + .should('exist'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-check').should('not.exist')); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-sync-alt')) + .should('exist'); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check').should('not.exist')); + + cy.wait(2000); + + // Check canvas nodes after 2nd step (waiting node finished its execution and the http request node is about to start) + workflowPage.getters + .canvasNodeByName('Webhook') + .within(() => cy.get('.fa-check')) + .should('exist'); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check')) + .should('exist'); + + // Clear execution data + workflowPage.getters.clearExecutionDataButton().should('be.visible'); + workflowPage.getters.clearExecutionDataButton().click(); + workflowPage.getters.clearExecutionDataButton().should('not.exist'); + + // Check success toast (works because Cypress waits enough for the element to show after the http request node has finished) + workflowPage.getters.successToast().should('be.visible'); + }); + + it('should test webhook workflow stop', () => { + cy.createFixtureWorkflow('Webhook_wait_set.json', `Webhook wait set ${uuid()}`); + + // Check workflow buttons + workflowPage.getters.executeWorkflowButton().should('be.visible'); + workflowPage.getters.clearExecutionDataButton().should('not.exist'); + workflowPage.getters.stopExecutionButton().should('not.exist'); + workflowPage.getters.stopExecutionWaitingForWebhookButton().should('not.exist'); + + // Execute the workflow + workflowPage.getters.zoomToFitButton().click(); + workflowPage.getters.executeWorkflowButton().click(); + + // Check workflow buttons + workflowPage.getters.executeWorkflowButton().get('.n8n-spinner').should('be.visible'); + workflowPage.getters.clearExecutionDataButton().should('not.exist'); + workflowPage.getters.stopExecutionButton().should('not.exist'); + workflowPage.getters.stopExecutionWaitingForWebhookButton().should('be.visible'); + + workflowPage.getters.canvasNodes().first().dblclick(); + + ndv.getters.copyInput().click(); + + cy.grantBrowserPermissions('clipboardReadWrite', 'clipboardSanitizedWrite'); + + ndv.getters.backToCanvas().click(); + + cy.readClipboard().then((url) => { + cy.request({ + method: 'GET', + url, + }).then((resp) => { + expect(resp.status).to.eq(200); + }); + }); + + workflowPage.getters.stopExecutionButton().click(); + // Check canvas nodes after 1st step (workflow passed the manual trigger node + workflowPage.getters + .canvasNodeByName('Webhook') + .within(() => cy.get('.fa-check')) + .should('exist'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-check').should('not.exist')); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-sync-alt')) + .should('exist'); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check').should('not.exist')); + + // Check canvas nodes after workflow stopped + workflowPage.getters + .canvasNodeByName('Webhook') + .within(() => cy.get('.fa-check')) + .should('exist'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-sync-alt').should('not.visible')); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check').should('not.exist')); + + // Clear execution data + workflowPage.getters.clearExecutionDataButton().should('be.visible'); + workflowPage.getters.clearExecutionDataButton().click(); + workflowPage.getters.clearExecutionDataButton().should('not.exist'); + + // Check success toast (works because Cypress waits enough for the element to show after the http request node has finished) + workflowPage.getters.successToast().should('be.visible'); + }); + + describe('execution preview', () => { + it('when deleting the last execution, it should show empty state', () => { + workflowPage.actions.addInitialNodeToCanvas('Manual Trigger'); + workflowPage.actions.executeWorkflow(); + executionsTab.actions.switchToExecutionsTab(); + + executionsTab.actions.deleteExecutionInPreview(); + + executionsTab.getters.successfulExecutionListItems().should('have.length', 0); + workflowPage.getters.successToast().contains('Execution deleted'); + }); + }); describe('connections should be colored differently for pinned data', () => { beforeEach(() => {