-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(editor): Debug executions in the editor (#6834)
- Loading branch information
Showing
20 changed files
with
665 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import { | ||
HTTP_REQUEST_NODE_NAME, IF_NODE_NAME, | ||
INSTANCE_OWNER, | ||
MANUAL_TRIGGER_NODE_NAME, | ||
SET_NODE_NAME, | ||
} from '../constants'; | ||
import { WorkflowPage, NDV, WorkflowExecutionsTab } from '../pages'; | ||
|
||
const workflowPage = new WorkflowPage(); | ||
const ndv = new NDV(); | ||
const executionsTab = new WorkflowExecutionsTab(); | ||
|
||
describe('Debug', () => { | ||
it('should be able to debug executions', () => { | ||
cy.intercept('GET', '/rest/settings', (req) => { | ||
req.on('response', (res) => { | ||
res.send({ | ||
data: { ...res.body.data, enterprise: { debugInEditor: true } }, | ||
}); | ||
}); | ||
}).as('loadSettings'); | ||
cy.intercept('GET', '/rest/executions?filter=*').as('getExecutions'); | ||
cy.intercept('GET', '/rest/executions/*').as('getExecution'); | ||
cy.intercept('GET', '/rest/executions-current?filter=*').as('getCurrentExecutions'); | ||
cy.intercept('POST', '/rest/workflows/run').as('postWorkflowRun'); | ||
|
||
cy.signin({ email: INSTANCE_OWNER.email, password: INSTANCE_OWNER.password }); | ||
|
||
workflowPage.actions.visit(); | ||
|
||
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(); | ||
|
||
workflowPage.actions.addNodeToCanvas(SET_NODE_NAME, true); | ||
|
||
workflowPage.actions.saveWorkflowUsingKeyboardShortcut(); | ||
workflowPage.actions.executeWorkflow(); | ||
|
||
cy.wait(['@postWorkflowRun']); | ||
|
||
executionsTab.actions.switchToExecutionsTab(); | ||
|
||
cy.wait(['@getExecutions', '@getCurrentExecutions']); | ||
|
||
executionsTab.getters.executionDebugButton().should('have.text', 'Debug in editor').click(); | ||
cy.get('.el-notification').contains('Execution data imported').should('be.visible'); | ||
cy.get('.matching-pinned-nodes-confirmation').should('not.exist'); | ||
|
||
|
||
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(); | ||
|
||
workflowPage.actions.saveWorkflowUsingKeyboardShortcut(); | ||
workflowPage.actions.executeWorkflow(); | ||
|
||
cy.wait(['@postWorkflowRun']); | ||
|
||
workflowPage.actions.openNode(HTTP_REQUEST_NODE_NAME); | ||
ndv.actions.pinData(); | ||
ndv.actions.close(); | ||
|
||
executionsTab.actions.switchToExecutionsTab(); | ||
|
||
cy.wait(['@getExecutions', '@getCurrentExecutions']); | ||
|
||
executionsTab.getters.executionListItems().should('have.length', 2).first().click(); | ||
cy.wait(['@getExecution']); | ||
|
||
executionsTab.getters.executionDebugButton().should('have.text', 'Copy to editor').click(); | ||
|
||
let confirmDialog = cy.get('.matching-pinned-nodes-confirmation').filter(':visible'); | ||
confirmDialog.find('li').should('have.length', 2); | ||
confirmDialog.get('.btn--cancel').click(); | ||
|
||
cy.wait(['@getExecutions', '@getCurrentExecutions']); | ||
|
||
executionsTab.getters.executionListItems().should('have.length', 2).first().click(); | ||
cy.wait(['@getExecution']); | ||
|
||
executionsTab.getters.executionDebugButton().should('have.text', 'Copy to editor').click(); | ||
|
||
confirmDialog = cy.get('.matching-pinned-nodes-confirmation').filter(':visible'); | ||
confirmDialog.find('li').should('have.length', 2); | ||
confirmDialog.get('.btn--confirm').click(); | ||
|
||
workflowPage.getters.canvasNodes().first().should('have.descendants', '.node-pin-data-icon'); | ||
workflowPage.getters.canvasNodes().not(':first').should('not.have.descendants', '.node-pin-data-icon'); | ||
|
||
cy.reload(true); | ||
cy.wait(['@getExecution']); | ||
|
||
confirmDialog = cy.get('.matching-pinned-nodes-confirmation').filter(':visible'); | ||
confirmDialog.find('li').should('have.length', 1); | ||
confirmDialog.get('.btn--confirm').click(); | ||
|
||
workflowPage.getters.canvasNodePlusEndpointByName(SET_NODE_NAME).click(); | ||
workflowPage.actions.addNodeToCanvas(IF_NODE_NAME, false); | ||
workflowPage.actions.saveWorkflowUsingKeyboardShortcut(); | ||
|
||
executionsTab.actions.switchToExecutionsTab(); | ||
cy.wait(['@getExecutions', '@getCurrentExecutions']); | ||
executionsTab.getters.executionDebugButton().should('have.text', 'Copy to editor').click(); | ||
|
||
confirmDialog = cy.get('.matching-pinned-nodes-confirmation').filter(':visible'); | ||
confirmDialog.find('li').should('have.length', 1); | ||
confirmDialog.get('.btn--confirm').click(); | ||
workflowPage.getters.canvasNodes().last().find('.node-info-icon').should('be.empty'); | ||
|
||
workflowPage.getters.canvasNodes().first().dblclick(); | ||
ndv.getters.pinDataButton().click(); | ||
ndv.actions.close(); | ||
|
||
workflowPage.actions.saveWorkflowUsingKeyboardShortcut(); | ||
workflowPage.actions.executeWorkflow(); | ||
workflowPage.actions.deleteNode(IF_NODE_NAME); | ||
|
||
executionsTab.actions.switchToExecutionsTab(); | ||
cy.wait(['@getExecutions', '@getCurrentExecutions']); | ||
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'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { createPinia, setActivePinia } from 'pinia'; | ||
import { createComponentRenderer } from '@/__tests__/render'; | ||
import router from '@/router'; | ||
import { VIEWS } from '@/constants'; | ||
|
||
const App = { | ||
template: '<div />', | ||
}; | ||
const renderComponent = createComponentRenderer(App); | ||
|
||
describe('router', () => { | ||
beforeAll(() => { | ||
const pinia = createPinia(); | ||
setActivePinia(pinia); | ||
renderComponent({ pinia }); | ||
}); | ||
|
||
test.each([ | ||
['/', VIEWS.WORKFLOWS], | ||
['/workflow', VIEWS.NEW_WORKFLOW], | ||
['/workflow/new', VIEWS.NEW_WORKFLOW], | ||
['/workflow/R9JFXwkUCL1jZBuw', VIEWS.WORKFLOW], | ||
['/workflow/R9JFXwkUCL1jZBuw/executions/29021', VIEWS.EXECUTION_PREVIEW], | ||
['/workflow/R9JFXwkUCL1jZBuw/debug/29021', VIEWS.EXECUTION_DEBUG], | ||
['/workflows/templates/R9JFXwkUCL1jZBuw', VIEWS.TEMPLATE_IMPORT], | ||
['/workflows/demo', VIEWS.DEMO], | ||
])('should resolve %s to %s', async (path, name) => { | ||
await router.push(path); | ||
expect(router.currentRoute.value.name).toBe(name); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<script lang="ts" setup> | ||
import { useI18n } from '@/composables'; | ||
import Modal from '@/components/Modal.vue'; | ||
const props = defineProps<{ | ||
modalName: string; | ||
data: { title: string; footerButtonAction: () => void }; | ||
}>(); | ||
const i18n = useI18n(); | ||
</script> | ||
|
||
<template> | ||
<Modal width="500px" :title="props.data.title" :name="props.modalName"> | ||
<template #content> | ||
<n8n-text> | ||
{{ i18n.baseText('executionsList.debug.paywall.content') }} | ||
<br /> | ||
<n8n-link :to="i18n.baseText('executionsList.debug.paywall.link.url')"> | ||
{{ i18n.baseText('executionsList.debug.paywall.link.text') }} | ||
</n8n-link> | ||
</n8n-text> | ||
</template> | ||
<template #footer> | ||
<div :class="$style.footer"> | ||
<n8n-button @click="props.data.footerButtonAction"> | ||
{{ i18n.baseText('generic.seePlans') }} | ||
</n8n-button> | ||
</div> | ||
</template> | ||
</Modal> | ||
</template> | ||
|
||
<style module lang="scss"> | ||
.footer { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: flex-end; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.