From 2a392c18472485debc5c6be60a4059da1ae166e8 Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Thu, 29 Aug 2024 14:23:09 +0200 Subject: [PATCH 1/2] fix(editor): Add pinned data only to manual executions in execution view --- packages/editor-ui/src/views/NodeView.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 266b4c1fda084..a527bb7579071 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -998,7 +998,7 @@ export default defineComponent({ }); this.workflowsStore.setWorkflowId(PLACEHOLDER_EMPTY_WORKFLOW_ID); this.workflowsStore.setWorkflowExecutionData(data); - if (data.workflowData.pinData) { + if (data.workflowData.pinData && data.mode === 'manual') { this.workflowsStore.setWorkflowPinData(data.workflowData.pinData); } From c45d1d00af1370da163287e9b1c76df1f3df7945 Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Thu, 29 Aug 2024 21:26:34 +0200 Subject: [PATCH 2/2] test: Add E2E test to verify pinned data is not used in production execution view --- cypress/e2e/19-execution.cy.ts | 41 ++++++ .../fixtures/Execution-pinned-data-check.json | 133 ++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 cypress/fixtures/Execution-pinned-data-check.json diff --git a/cypress/e2e/19-execution.cy.ts b/cypress/e2e/19-execution.cy.ts index 1f7d5c332eb50..d2c463f1bb153 100644 --- a/cypress/e2e/19-execution.cy.ts +++ b/cypress/e2e/19-execution.cy.ts @@ -616,4 +616,45 @@ describe('Execution', () => { errorToast().should('contain', 'Problem in node ‘Telegram‘'); }); + + it('should not show pinned data in production execution', () => { + cy.createFixtureWorkflow('Execution-pinned-data-check.json'); + + workflowPage.getters.zoomToFitButton().click(); + cy.intercept('PATCH', '/rest/workflows/*').as('workflowActivate'); + workflowPage.getters.activatorSwitch().click(); + + cy.wait('@workflowActivate'); + cy.get('body').type('{esc}'); + workflowPage.actions.openNode('Webhook'); + + cy.contains('label', 'Production URL').should('be.visible').click(); + cy.grantBrowserPermissions('clipboardReadWrite', 'clipboardSanitizedWrite'); + cy.get('.webhook-url').click(); + ndv.getters.backToCanvas().click(); + + cy.readClipboard().then((url) => { + cy.request({ + method: 'GET', + url, + }).then((resp) => { + expect(resp.status).to.eq(200); + }); + }); + + cy.intercept('GET', '/rest/executions/*').as('getExecution'); + executionsTab.actions.switchToExecutionsTab(); + + cy.wait('@getExecution'); + executionsTab.getters + .workflowExecutionPreviewIframe() + .should('be.visible') + .its('0.contentDocument.body') + .should('not.be.empty') + + .then(cy.wrap) + .find('.connection-run-items-label') + .filter(':contains("5 items")') + .should('have.length', 2); + }); }); diff --git a/cypress/fixtures/Execution-pinned-data-check.json b/cypress/fixtures/Execution-pinned-data-check.json new file mode 100644 index 0000000000000..20041af117418 --- /dev/null +++ b/cypress/fixtures/Execution-pinned-data-check.json @@ -0,0 +1,133 @@ +{ + "name": "PAY-1707", + "nodes": [ + { + "parameters": { + "options": {} + }, + "id": "eaa428a8-eb9d-478a-b997-aed6ed298507", + "name": "Edit Fields", + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 920, + 380 + ] + }, + { + "parameters": { + "options": {} + }, + "id": "6b285c91-e7ea-4943-8ba3-59ce01a35d20", + "name": "Edit Fields1", + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 920, + 540 + ] + }, + { + "parameters": { + "jsCode": "return Array.from({length: 5}, _ => ({}))" + }, + "id": "70e682aa-dfef-4db7-a158-971ec7976d49", + "name": "Code", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 700, + 380 + ] + }, + { + "parameters": { + "jsCode": "return Array.from({length: 5}, _ => ({}))" + }, + "id": "d5ee979e-9f53-4e62-8eb2-cdb92be8ea6e", + "name": "Code1", + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 700, + 540 + ] + }, + { + "parameters": { + "path": "dd660366-ca4a-4736-8b1f-454560e87bfb", + "options": {} + }, + "id": "20c33c8a-ab2f-4dd4-990f-6390feeb840c", + "name": "Webhook", + "type": "n8n-nodes-base.webhook", + "typeVersion": 2, + "position": [ + 480, + 440 + ], + "webhookId": "dd660366-ca4a-4736-8b1f-454560e87bfb" + } + ], + "pinData": { + "Code1": [ + { + "json": {} + }, + { + "json": {} + } + ] + }, + "connections": { + "Code1": { + "main": [ + [ + { + "node": "Edit Fields1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code": { + "main": [ + [ + { + "node": "Edit Fields", + "type": "main", + "index": 0 + } + ] + ] + }, + "Webhook": { + "main": [ + [ + { + "node": "Code", + "type": "main", + "index": 0 + }, + { + "node": "Code1", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "active": true, + "settings": { + "executionOrder": "v1" + }, + "versionId": "01e6693e-54f3-432d-9b1f-922ef92b4ab6", + "meta": { + "templateCredsSetupCompleted": true, + "instanceId": "8a47b83b4479b11330fdf21ccc96d4a8117035a968612e452b4c87bfd09c16c7" + }, + "id": "hU0gp19G29ehWktc", + "tags": [] +} \ No newline at end of file