2023-08-25 00:39:14 -07:00
|
|
|
import {
|
2023-09-01 04:29:31 -07:00
|
|
|
HTTP_REQUEST_NODE_NAME,
|
|
|
|
IF_NODE_NAME,
|
2023-08-25 00:39:14 -07:00
|
|
|
MANUAL_TRIGGER_NODE_NAME,
|
2023-09-19 03:16:35 -07:00
|
|
|
EDIT_FIELDS_SET_NODE_NAME,
|
2023-08-25 00:39:14 -07:00
|
|
|
} from '../constants';
|
|
|
|
import { WorkflowPage, NDV, WorkflowExecutionsTab } from '../pages';
|
|
|
|
|
|
|
|
const workflowPage = new WorkflowPage();
|
|
|
|
const ndv = new NDV();
|
|
|
|
const executionsTab = new WorkflowExecutionsTab();
|
|
|
|
|
|
|
|
describe('Debug', () => {
|
2023-11-08 05:04:02 -08:00
|
|
|
beforeEach(() => {
|
|
|
|
cy.enableFeature('debugInEditor');
|
|
|
|
});
|
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
it('should be able to debug executions', () => {
|
|
|
|
cy.intercept('GET', '/rest/executions?filter=*').as('getExecutions');
|
|
|
|
cy.intercept('GET', '/rest/executions/*').as('getExecution');
|
2024-05-17 01:53:15 -07:00
|
|
|
cy.intercept('POST', '/rest/workflows/**/run').as('postWorkflowRun');
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2024-06-11 05:45:15 -07:00
|
|
|
cy.signinAsOwner();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.actions.visit();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.actions.addInitialNodeToCanvas(MANUAL_TRIGGER_NODE_NAME);
|
|
|
|
workflowPage.actions.addNodeToCanvas(HTTP_REQUEST_NODE_NAME);
|
|
|
|
workflowPage.actions.openNode(HTTP_REQUEST_NODE_NAME);
|
|
|
|
ndv.actions.typeIntoParameterInput('url', 'https://foo.bar');
|
|
|
|
ndv.actions.close();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-19 03:16:35 -07:00
|
|
|
workflowPage.actions.addNodeToCanvas(EDIT_FIELDS_SET_NODE_NAME, true);
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.actions.saveWorkflowUsingKeyboardShortcut();
|
|
|
|
workflowPage.actions.executeWorkflow();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
cy.wait(['@postWorkflowRun']);
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2024-04-18 22:50:18 -07:00
|
|
|
cy.wait(['@getExecutions']);
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
executionsTab.getters.executionDebugButton().should('have.text', 'Debug in editor').click();
|
2023-11-08 05:04:02 -08:00
|
|
|
cy.url().should('include', '/debug');
|
2023-09-01 04:29:31 -07:00
|
|
|
cy.get('.el-notification').contains('Execution data imported').should('be.visible');
|
|
|
|
cy.get('.matching-pinned-nodes-confirmation').should('not.exist');
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.actions.openNode(HTTP_REQUEST_NODE_NAME);
|
|
|
|
ndv.actions.clearParameterInput('url');
|
|
|
|
ndv.actions.typeIntoParameterInput('url', 'https://postman-echo.com/get?foo1=bar1&foo2=bar2');
|
|
|
|
ndv.actions.close();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.actions.saveWorkflowUsingKeyboardShortcut();
|
2023-11-08 05:04:02 -08:00
|
|
|
cy.url().should('not.include', '/debug');
|
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.actions.executeWorkflow();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
cy.wait(['@postWorkflowRun']);
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.actions.openNode(HTTP_REQUEST_NODE_NAME);
|
|
|
|
ndv.actions.pinData();
|
|
|
|
ndv.actions.close();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2024-04-18 22:50:18 -07:00
|
|
|
cy.wait(['@getExecutions']);
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
executionsTab.getters.executionListItems().should('have.length', 2).first().click();
|
|
|
|
cy.wait(['@getExecution']);
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
executionsTab.getters.executionDebugButton().should('have.text', 'Copy to editor').click();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
let confirmDialog = cy.get('.matching-pinned-nodes-confirmation').filter(':visible');
|
|
|
|
confirmDialog.find('li').should('have.length', 2);
|
|
|
|
confirmDialog.get('.btn--cancel').click();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2024-04-18 22:50:18 -07:00
|
|
|
cy.wait(['@getExecutions']);
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
executionsTab.getters.executionListItems().should('have.length', 2).first().click();
|
|
|
|
cy.wait(['@getExecution']);
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
executionsTab.getters.executionDebugButton().should('have.text', 'Copy to editor').click();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
confirmDialog = cy.get('.matching-pinned-nodes-confirmation').filter(':visible');
|
|
|
|
confirmDialog.find('li').should('have.length', 2);
|
|
|
|
confirmDialog.get('.btn--confirm').click();
|
2023-11-08 05:04:02 -08:00
|
|
|
cy.url().should('include', '/debug');
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.getters.canvasNodes().first().should('have.descendants', '.node-pin-data-icon');
|
|
|
|
workflowPage.getters
|
|
|
|
.canvasNodes()
|
|
|
|
.not(':first')
|
|
|
|
.should('not.have.descendants', '.node-pin-data-icon');
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
cy.reload(true);
|
|
|
|
cy.wait(['@getExecution']);
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
confirmDialog = cy.get('.matching-pinned-nodes-confirmation').filter(':visible');
|
|
|
|
confirmDialog.find('li').should('have.length', 1);
|
|
|
|
confirmDialog.get('.btn--confirm').click();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-19 03:16:35 -07:00
|
|
|
workflowPage.getters.canvasNodePlusEndpointByName(EDIT_FIELDS_SET_NODE_NAME).click();
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.actions.addNodeToCanvas(IF_NODE_NAME, false);
|
|
|
|
workflowPage.actions.saveWorkflowUsingKeyboardShortcut();
|
2023-11-08 05:04:02 -08:00
|
|
|
cy.url().should('not.include', '/debug');
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
2024-04-18 22:50:18 -07:00
|
|
|
cy.wait(['@getExecutions']);
|
2023-09-01 04:29:31 -07:00
|
|
|
executionsTab.getters.executionDebugButton().should('have.text', 'Copy to editor').click();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
confirmDialog = cy.get('.matching-pinned-nodes-confirmation').filter(':visible');
|
|
|
|
confirmDialog.find('li').should('have.length', 1);
|
|
|
|
confirmDialog.get('.btn--confirm').click();
|
2023-11-08 05:04:02 -08:00
|
|
|
cy.url().should('include', '/debug');
|
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.getters.canvasNodes().last().find('.node-info-icon').should('be.empty');
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.getters.canvasNodes().first().dblclick();
|
|
|
|
ndv.getters.pinDataButton().click();
|
|
|
|
ndv.actions.close();
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.actions.saveWorkflowUsingKeyboardShortcut();
|
2023-11-08 05:04:02 -08:00
|
|
|
cy.url().should('not.include', '/debug');
|
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.actions.executeWorkflow();
|
2023-12-04 01:57:03 -08:00
|
|
|
workflowPage.actions.zoomToFit();
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.actions.deleteNode(IF_NODE_NAME);
|
2023-08-25 00:39:14 -07:00
|
|
|
|
2023-09-01 04:29:31 -07:00
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
2024-04-18 22:50:18 -07:00
|
|
|
cy.wait(['@getExecutions']);
|
2023-09-01 04:29:31 -07:00
|
|
|
executionsTab.getters.executionListItems().should('have.length', 3).first().click();
|
|
|
|
cy.wait(['@getExecution']);
|
|
|
|
executionsTab.getters.executionDebugButton().should('have.text', 'Copy to editor').click();
|
|
|
|
cy.get('.el-notification').contains("Some execution data wasn't imported").should('be.visible');
|
2023-11-08 05:04:02 -08:00
|
|
|
cy.url().should('include', '/debug');
|
2023-09-01 04:29:31 -07:00
|
|
|
});
|
2023-08-25 00:39:14 -07:00
|
|
|
});
|