2023-02-16 02:41:25 -08:00
|
|
|
import { v4 as uuid } from 'uuid';
|
2023-11-30 03:12:26 -08:00
|
|
|
import { NDV, WorkflowExecutionsTab, WorkflowPage as WorkflowPageClass } from '../pages';
|
2023-02-16 02:41:25 -08:00
|
|
|
|
|
|
|
const workflowPage = new WorkflowPageClass();
|
2023-11-30 03:12:26 -08:00
|
|
|
const executionsTab = new WorkflowExecutionsTab();
|
2023-02-16 02:41:25 -08:00
|
|
|
const ndv = new NDV();
|
|
|
|
|
2023-02-24 09:07:35 -08:00
|
|
|
describe('Execution', () => {
|
2023-05-26 08:15:06 -07:00
|
|
|
beforeEach(() => {
|
|
|
|
workflowPage.actions.visit();
|
|
|
|
});
|
|
|
|
|
2023-02-16 02:41:25 -08:00
|
|
|
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
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Manual')
|
|
|
|
.within(() => cy.get('.fa-check'))
|
2023-03-02 07:50:21 -08:00
|
|
|
.should('exist');
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Wait')
|
|
|
|
.within(() => cy.get('.fa-check').should('not.exist'));
|
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Wait')
|
|
|
|
.within(() => cy.get('.fa-sync-alt'))
|
2023-03-02 07:50:21 -08:00
|
|
|
.should('exist');
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Set')
|
|
|
|
.within(() => cy.get('.fa-check').should('not.exist'));
|
2023-02-16 02:41:25 -08:00
|
|
|
|
|
|
|
cy.wait(2000);
|
|
|
|
|
|
|
|
// Check canvas nodes after 2nd step (waiting node finished its execution and the http request node is about to start)
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Manual')
|
|
|
|
.within(() => cy.get('.fa-check'))
|
2023-03-02 07:50:21 -08:00
|
|
|
.should('exist');
|
2023-11-28 07:47:28 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Wait')
|
|
|
|
.within(() => cy.get('.fa-check'))
|
|
|
|
.should('exist');
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Set')
|
|
|
|
.within(() => cy.get('.fa-check'))
|
2023-03-02 07:50:21 -08:00
|
|
|
.should('exist');
|
2023-02-16 02:41:25 -08:00
|
|
|
|
|
|
|
// 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
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Manual')
|
|
|
|
.within(() => cy.get('.fa-check'))
|
2023-03-02 07:50:21 -08:00
|
|
|
.should('exist');
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Wait')
|
|
|
|
.within(() => cy.get('.fa-check').should('not.exist'));
|
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Wait')
|
|
|
|
.within(() => cy.get('.fa-sync-alt'))
|
2023-03-02 07:50:21 -08:00
|
|
|
.should('exist');
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Set')
|
|
|
|
.within(() => cy.get('.fa-check').should('not.exist'));
|
2023-02-16 02:41:25 -08:00
|
|
|
|
2023-08-09 02:12:27 -07:00
|
|
|
workflowPage.getters.stopExecutionButton().should('exist');
|
2023-02-16 02:41:25 -08:00
|
|
|
workflowPage.getters.stopExecutionButton().click();
|
|
|
|
|
|
|
|
// Check canvas nodes after workflow stopped
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Manual')
|
|
|
|
.within(() => cy.get('.fa-check'))
|
2023-03-02 07:50:21 -08:00
|
|
|
.should('exist');
|
2023-02-24 09:07:35 -08:00
|
|
|
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'));
|
2023-02-16 02:41:25 -08:00
|
|
|
|
|
|
|
// Clear execution data
|
|
|
|
workflowPage.getters.clearExecutionDataButton().should('be.visible');
|
|
|
|
workflowPage.getters.clearExecutionDataButton().click();
|
|
|
|
workflowPage.getters.clearExecutionDataButton().should('not.exist');
|
|
|
|
|
2023-11-28 07:47:28 -08:00
|
|
|
// 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');
|
2023-02-16 02:41:25 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
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
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Webhook')
|
|
|
|
.within(() => cy.get('.fa-check'))
|
2023-03-02 07:50:21 -08:00
|
|
|
.should('exist');
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Wait')
|
|
|
|
.within(() => cy.get('.fa-check').should('not.exist'));
|
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Wait')
|
|
|
|
.within(() => cy.get('.fa-sync-alt'))
|
2023-03-02 07:50:21 -08:00
|
|
|
.should('exist');
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Set')
|
|
|
|
.within(() => cy.get('.fa-check').should('not.exist'));
|
2023-02-16 02:41:25 -08:00
|
|
|
|
|
|
|
cy.wait(2000);
|
|
|
|
|
|
|
|
// Check canvas nodes after 2nd step (waiting node finished its execution and the http request node is about to start)
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Webhook')
|
|
|
|
.within(() => cy.get('.fa-check'))
|
2023-03-02 07:50:21 -08:00
|
|
|
.should('exist');
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Set')
|
|
|
|
.within(() => cy.get('.fa-check'))
|
2023-03-02 07:50:21 -08:00
|
|
|
.should('exist');
|
2023-02-16 02:41:25 -08:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2023-03-02 07:50:21 -08:00
|
|
|
workflowPage.getters.stopExecutionButton().click();
|
2023-02-16 02:41:25 -08:00
|
|
|
// Check canvas nodes after 1st step (workflow passed the manual trigger node
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Webhook')
|
|
|
|
.within(() => cy.get('.fa-check'))
|
2023-03-02 07:50:21 -08:00
|
|
|
.should('exist');
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Wait')
|
|
|
|
.within(() => cy.get('.fa-check').should('not.exist'));
|
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Wait')
|
|
|
|
.within(() => cy.get('.fa-sync-alt'))
|
2023-03-02 07:50:21 -08:00
|
|
|
.should('exist');
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Set')
|
|
|
|
.within(() => cy.get('.fa-check').should('not.exist'));
|
2023-02-16 02:41:25 -08:00
|
|
|
|
|
|
|
// Check canvas nodes after workflow stopped
|
2023-02-24 09:07:35 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodeByName('Webhook')
|
|
|
|
.within(() => cy.get('.fa-check'))
|
2023-03-02 07:50:21 -08:00
|
|
|
.should('exist');
|
2023-02-24 09:07:35 -08:00
|
|
|
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'));
|
2023-02-16 02:41:25 -08:00
|
|
|
|
|
|
|
// Clear execution data
|
|
|
|
workflowPage.getters.clearExecutionDataButton().should('be.visible');
|
|
|
|
workflowPage.getters.clearExecutionDataButton().click();
|
|
|
|
workflowPage.getters.clearExecutionDataButton().should('not.exist');
|
|
|
|
|
2023-11-28 07:47:28 -08:00
|
|
|
// 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');
|
2023-02-16 02:41:25 -08:00
|
|
|
});
|
2023-11-30 03:12:26 -08:00
|
|
|
|
|
|
|
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');
|
|
|
|
});
|
|
|
|
});
|
2023-02-16 02:41:25 -08:00
|
|
|
});
|