Files
n8n/packages/testing/playwright/tests/e2e/api/webhook-external.spec.ts
alighasami 3d5eaf9445
Some checks failed
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

42 lines
1.3 KiB
TypeScript

import { test, expect } from '../../../fixtures/base';
test.describe('External Webhook Triggering', {
annotation: [
{ type: 'owner', description: 'Catalysts' },
],
}, () => {
test('should create workflow via API, activate it, trigger webhook externally, and verify execution', async ({
api,
}) => {
const { webhookPath, workflowId } = await api.workflows.importWorkflowFromFile(
'simple-webhook-test.json',
);
const testPayload = { message: 'Hello from Playwright test' };
const webhookResponse = await api.webhooks.trigger(`/webhook/${webhookPath}`, {
method: 'POST',
data: testPayload,
});
expect(webhookResponse.ok()).toBe(true);
const execution = await api.workflows.waitForExecution(workflowId, 5000);
expect(execution.status).toBe('success');
const executionDetails = await api.workflows.getExecution(execution.id);
expect(executionDetails.data).toContain('Hello from Playwright test');
});
test('should surface workflow configuration errors to the caller', async ({ api }) => {
const { webhookPath } = await api.workflows.importWorkflowFromFile(
'webhook-misconfiguration-test.json',
);
const webhookResponse = await api.webhooks.trigger(`/webhook/${webhookPath}`);
expect(webhookResponse.ok()).toBe(false);
expect(await webhookResponse.text()).toContain('Unused Respond to Webhook node');
});
});