Skip to content

Commit

Permalink
fix: Don't show pinned data tooltip for pinned nodes (#11249)
Browse files Browse the repository at this point in the history
Co-authored-by: Iván Ovejero <[email protected]>
  • Loading branch information
mutdmour and ivov authored Oct 15, 2024
1 parent 1affc27 commit c2ad156
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 4 deletions.
40 changes: 40 additions & 0 deletions cypress/e2e/13-pinning.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { nanoid } from 'nanoid';

import { simpleWebhookCall, waitForWebhook } from './16-webhook-node.cy';
import {
HTTP_REQUEST_NODE_NAME,
MANUAL_TRIGGER_NODE_NAME,
Expand All @@ -7,6 +10,7 @@ import {
} from '../constants';
import { WorkflowPage, NDV } from '../pages';
import { errorToast } from '../pages/notifications';
import { getVisiblePopper } from '../utils';

const workflowPage = new WorkflowPage();
const ndv = new NDV();
Expand Down Expand Up @@ -212,6 +216,42 @@ describe('Data pinning', () => {
},
);
});

it('should show pinned data tooltip', () => {
const { callEndpoint } = simpleWebhookCall({
method: 'GET',
webhookPath: nanoid(),
executeNow: false,
});

ndv.actions.close();
workflowPage.actions.executeWorkflow();
cy.wait(waitForWebhook);

// hide other visible popper on workflow execute button
workflowPage.getters.canvasNodes().eq(0).click();

callEndpoint((response) => {
expect(response.status).to.eq(200);
getVisiblePopper().should('have.length', 1);
getVisiblePopper()
.eq(0)
.should(
'have.text',
'You can pin this output instead of waiting for a test event. Open node to do so.',
);
});
});

it('should not show pinned data tooltip', () => {
cy.createFixtureWorkflow('Pinned_webhook_node.json', 'Test');
workflowPage.actions.executeWorkflow();

// hide other visible popper on workflow execute button
workflowPage.getters.canvasNodes().eq(0).click();

getVisiblePopper().should('have.length', 0);
});
});

function setExpressionOnStringValueInSet(expression: string) {
Expand Down
14 changes: 11 additions & 3 deletions cypress/e2e/16-webhook-node.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const workflowPage = new WorkflowPage();
const ndv = new NDV();
const credentialsModal = new CredentialsModal();

const waitForWebhook = 500;
export const waitForWebhook = 500;

interface SimpleWebhookCallOptions {
method: string;
Expand All @@ -21,7 +21,7 @@ interface SimpleWebhookCallOptions {
authentication?: string;
}

const simpleWebhookCall = (options: SimpleWebhookCallOptions) => {
export const simpleWebhookCall = (options: SimpleWebhookCallOptions) => {
const {
authentication,
method,
Expand Down Expand Up @@ -65,15 +65,23 @@ const simpleWebhookCall = (options: SimpleWebhookCallOptions) => {
getVisibleSelect().find('.option-headline').contains(responseData).click();
}

const callEndpoint = (cb: (response: Cypress.Response<unknown>) => void) => {
cy.request(method, `${BACKEND_BASE_URL}/webhook-test/${webhookPath}`).then(cb);
};

if (executeNow) {
ndv.actions.execute();
cy.wait(waitForWebhook);

cy.request(method, `${BACKEND_BASE_URL}/webhook-test/${webhookPath}`).then((response) => {
callEndpoint((response) => {
expect(response.status).to.eq(200);
ndv.getters.outputPanel().contains('headers');
});
}

return {
callEndpoint,
};
};

describe('Webhook Trigger node', () => {
Expand Down
39 changes: 39 additions & 0 deletions cypress/fixtures/Pinned_webhook_node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"nodes": [
{
"parameters": {
"path": "FwrbSiaua2Xmvn6-Z-7CQ",
"options": {}
},
"id": "8fcc7e5f-2cef-4938-9564-eea504c20aa0",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
360,
220
],
"webhookId": "9c778f2a-e882-46ed-a0e4-c8e2f76ccd65"
}
],
"connections": {},
"pinData": {
"Webhook": [
{
"headers": {
"connection": "keep-alive",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
"accept": "*/*",
"cookie": "n8n-auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjNiM2FhOTE5LWRhZDgtNDE5MS1hZWZiLTlhZDIwZTZkMjJjNiIsImhhc2giOiJ1ZVAxR1F3U2paIiwiaWF0IjoxNzI4OTE1NTQyLCJleHAiOjE3Mjk1MjAzNDJ9.fV02gpUnSiUoMxHwfB0npBjcjct7Mv9vGfj-jRTT3-I",
"host": "localhost:5678",
"accept-encoding": "gzip, deflate"
},
"params": {},
"query": {},
"body": {},
"webhookUrl": "http://localhost:5678/webhook-test/FwrbSiaua2Xmvn6-Z-7CQ",
"executionMode": "test"
}
]
}
}
3 changes: 2 additions & 1 deletion packages/editor-ui/src/components/Node.vue
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,8 @@ function showPinDataDiscoveryTooltip(dataItemsCount: number): void {
isManualTypeNode.value ||
isScheduledGroup.value ||
uiStore.isAnyModalOpen ||
dataItemsCount === 0
dataItemsCount === 0 ||
pinnedData.hasData.value
)
return;
Expand Down

0 comments on commit c2ad156

Please sign in to comment.