first commit
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
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
This commit is contained in:
+89
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* E2E tests for log streaming to VictoriaLogs via syslog.
|
||||
*
|
||||
* These tests verify that n8n log streaming events are correctly
|
||||
* sent to VictoriaLogs and can be queried using LogsQL.
|
||||
*
|
||||
* Prerequisites:
|
||||
* - Log streaming feature enabled (enterprise license)
|
||||
* - @capability:observability tag to bring up VictoriaLogs
|
||||
*/
|
||||
|
||||
import { test, expect } from '../../../../fixtures/base';
|
||||
|
||||
// Worker-scoped fixtures must be at top level
|
||||
test.use({ capability: 'observability' });
|
||||
|
||||
test.describe('Log Streaming to VictoriaLogs @capability:observability', {
|
||||
annotation: [
|
||||
{ type: 'owner', description: 'Lifecycle & Governance' },
|
||||
],
|
||||
}, () => {
|
||||
test.beforeEach(async ({ n8n }) => {
|
||||
// Enable log streaming feature for the test
|
||||
await n8n.api.enableFeature('logStreaming');
|
||||
});
|
||||
|
||||
test('should configure syslog destination and send test message', async ({ api, services }) => {
|
||||
const obs = services.observability;
|
||||
|
||||
// Configure syslog destination pointing to VictoriaLogs
|
||||
// syslog contains: host, port, protocol, facility, appName
|
||||
const destination = await api.createSyslogDestination({
|
||||
host: obs.syslog.host,
|
||||
port: obs.syslog.port,
|
||||
protocol: obs.syslog.protocol,
|
||||
facility: obs.syslog.facility,
|
||||
app_name: obs.syslog.appName,
|
||||
label: 'VictoriaLogs Test Destination',
|
||||
});
|
||||
|
||||
expect(destination.id).toBeDefined();
|
||||
console.log(`Created syslog destination with ID: ${destination.id}`);
|
||||
|
||||
// Send test message to the destination
|
||||
const testResult = await api.testLogStreamingDestination(destination.id);
|
||||
expect(testResult).toBe(true);
|
||||
|
||||
// Wait for the test message to appear in VictoriaLogs
|
||||
// Use wildcard - LogsQL interprets dots as word separators
|
||||
const logEntry = await obs.logs.waitForLog('*destination.test*', {
|
||||
timeoutMs: 30000,
|
||||
start: '-1m',
|
||||
});
|
||||
|
||||
expect(logEntry).toBeTruthy();
|
||||
|
||||
// Clean up - delete the destination
|
||||
await api.deleteLogStreamingDestination(destination.id);
|
||||
});
|
||||
|
||||
test('should query metrics from VictoriaMetrics', async ({ api, services }) => {
|
||||
const obs = services.observability;
|
||||
|
||||
// Import and activate a webhook workflow to generate metrics
|
||||
const { webhookPath, workflowId } = await api.workflows.importWorkflowFromFile(
|
||||
'simple-webhook-test.json',
|
||||
);
|
||||
|
||||
// Trigger the workflow via webhook to generate metrics
|
||||
const webhookResponse = await api.webhooks.trigger(`/webhook/${webhookPath}`, {
|
||||
method: 'POST',
|
||||
data: { test: 'metrics' },
|
||||
});
|
||||
expect(webhookResponse.ok()).toBe(true);
|
||||
|
||||
// Wait for workflow execution to complete
|
||||
const execution = await api.workflows.waitForExecution(workflowId, 10000);
|
||||
expect(execution.status).toBe('success');
|
||||
|
||||
// Wait for metrics to be scraped (VictoriaMetrics scrapes every 5s)
|
||||
// Query for n8n version info metric (always present)
|
||||
const versionMetric = await obs.metrics.waitForMetric('n8n_version_info', {
|
||||
timeoutMs: 30000,
|
||||
});
|
||||
|
||||
expect(versionMetric).toBeTruthy();
|
||||
console.log('n8n version metric:', versionMetric?.labels);
|
||||
});
|
||||
});
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* End-to-end UI test for log streaming feature.
|
||||
*
|
||||
* This test verifies:
|
||||
* 1. Log streaming can be configured via the UI
|
||||
* 2. Test events are streamed to VictoriaLogs via syslog
|
||||
* 3. Events can be queried from VictoriaLogs
|
||||
*/
|
||||
|
||||
import { test, expect } from '../../../../fixtures/base';
|
||||
|
||||
test.use({ capability: 'observability' });
|
||||
|
||||
test.describe('Log Streaming UI E2E @capability:observability', {
|
||||
annotation: [
|
||||
{ type: 'owner', description: 'Lifecycle & Governance' },
|
||||
],
|
||||
}, () => {
|
||||
test.beforeEach(async ({ n8n }) => {
|
||||
await n8n.api.enableFeature('logStreaming');
|
||||
});
|
||||
|
||||
test('should configure syslog destination via UI and send test event', async ({
|
||||
n8n,
|
||||
services,
|
||||
}) => {
|
||||
const obs = services.observability;
|
||||
|
||||
// ========== STEP 1: Configure Log Streaming via UI ==========
|
||||
await n8n.navigate.toLogStreaming();
|
||||
await expect(n8n.settingsLogStreaming.getActionBoxLicensed()).toBeVisible();
|
||||
|
||||
// Create syslog destination pointing to VictoriaLogs
|
||||
await n8n.settingsLogStreaming.createSyslogDestination({
|
||||
name: 'VictoriaLogs E2E Test',
|
||||
host: obs.syslog.host,
|
||||
port: obs.syslog.port,
|
||||
});
|
||||
// Send test event
|
||||
await n8n.settingsLogStreaming.sendTestEvent();
|
||||
|
||||
// ========== STEP 3: Verify Event in VictoriaLogs ==========
|
||||
// Use wildcard search - LogsQL interprets dots as word separators
|
||||
const testEvent = await obs.logs.waitForLog('*destination.test*', {
|
||||
timeoutMs: 30000,
|
||||
start: '-2m',
|
||||
});
|
||||
|
||||
expect(testEvent).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,91 @@
|
||||
import { test, expect } from '../../../../fixtures/base';
|
||||
|
||||
const DESTINATION_NAMES = {
|
||||
FIRST: 'Destination 0',
|
||||
SECOND: 'Destination 1',
|
||||
} as const;
|
||||
|
||||
const MODAL_MAX_WIDTH = 500;
|
||||
|
||||
test.describe('Log Streaming Settings', {
|
||||
annotation: [
|
||||
{ type: 'owner', description: 'Lifecycle & Governance' },
|
||||
],
|
||||
}, () => {
|
||||
test.describe.configure({ mode: 'serial' });
|
||||
test.describe('unlicensed', () => {
|
||||
test.beforeEach(async ({ n8n }) => {
|
||||
await n8n.api.disableFeature('logStreaming');
|
||||
});
|
||||
|
||||
test('should show the unlicensed view when the feature is disabled', async ({ n8n }) => {
|
||||
await n8n.navigate.toLogStreaming();
|
||||
await expect(n8n.settingsLogStreaming.getActionBoxUnlicensed()).toBeVisible();
|
||||
await expect(n8n.settingsLogStreaming.getContactUsButton()).toBeVisible();
|
||||
await expect(n8n.settingsLogStreaming.getActionBoxLicensed()).not.toBeAttached();
|
||||
});
|
||||
});
|
||||
|
||||
// @licensed - requires enterprise license (module routes only exist with license at startup)
|
||||
test.describe('licensed @licensed', () => {
|
||||
test.beforeEach(async ({ n8n }) => {
|
||||
await n8n.api.enableFeature('logStreaming');
|
||||
await n8n.api.deleteAllLogStreamingDestinations();
|
||||
await n8n.navigate.toLogStreaming();
|
||||
});
|
||||
|
||||
test('should show the licensed view when the feature is enabled', async ({ n8n }) => {
|
||||
await expect(n8n.settingsLogStreaming.getActionBoxLicensed()).toBeVisible();
|
||||
await expect(n8n.settingsLogStreaming.getAddFirstDestinationButton()).toBeVisible();
|
||||
await expect(n8n.settingsLogStreaming.getActionBoxUnlicensed()).not.toBeAttached();
|
||||
});
|
||||
|
||||
test('should show the add destination modal', async ({ n8n }) => {
|
||||
await n8n.settingsLogStreaming.addDestination();
|
||||
await expect(n8n.settingsLogStreaming.getDestinationModal()).toBeVisible();
|
||||
await expect(n8n.settingsLogStreaming.getSelectDestinationType()).toBeVisible();
|
||||
await expect(n8n.settingsLogStreaming.getSelectDestinationButton()).toBeVisible();
|
||||
await expect(n8n.settingsLogStreaming.getSelectDestinationButton()).toBeDisabled();
|
||||
|
||||
const modal = n8n.settingsLogStreaming.getDestinationModal();
|
||||
const width = await modal.evaluate((element) => {
|
||||
return parseInt(window.getComputedStyle(element).width.replace('px', ''));
|
||||
});
|
||||
expect(width).toBeLessThan(MODAL_MAX_WIDTH);
|
||||
|
||||
await n8n.settingsLogStreaming.clickSelectDestinationType();
|
||||
await n8n.settingsLogStreaming.selectDestinationType(0);
|
||||
await expect(n8n.settingsLogStreaming.getSelectDestinationButton()).toBeEnabled();
|
||||
await n8n.settingsLogStreaming.closeModalByClickingOverlay();
|
||||
await expect(n8n.settingsLogStreaming.getDestinationModal()).not.toBeAttached();
|
||||
});
|
||||
|
||||
test('should create a destination and delete it', async ({ n8n }) => {
|
||||
await n8n.settingsLogStreaming.createDestination(DESTINATION_NAMES.FIRST);
|
||||
await n8n.page.reload();
|
||||
await n8n.settingsLogStreaming.clickDestinationCard(0);
|
||||
await expect(n8n.settingsLogStreaming.getDestinationDeleteButton()).toBeVisible();
|
||||
await n8n.settingsLogStreaming.deleteDestination();
|
||||
await expect(n8n.settingsLogStreaming.getConfirmationDialog()).toBeVisible();
|
||||
await n8n.settingsLogStreaming.cancelDialog();
|
||||
await n8n.settingsLogStreaming.deleteDestination();
|
||||
await expect(n8n.settingsLogStreaming.getConfirmationDialog()).toBeVisible();
|
||||
await n8n.settingsLogStreaming.confirmDialog();
|
||||
});
|
||||
|
||||
test('should create a destination and delete it via card actions', async ({ n8n }) => {
|
||||
await n8n.settingsLogStreaming.createDestination(DESTINATION_NAMES.SECOND);
|
||||
await n8n.page.reload();
|
||||
|
||||
await n8n.settingsLogStreaming.clickDestinationCardDropdown(0);
|
||||
await n8n.settingsLogStreaming.clickDropdownMenuItem(0);
|
||||
await expect(n8n.settingsLogStreaming.getDestinationSaveButton()).not.toBeAttached();
|
||||
await n8n.settingsLogStreaming.closeModalByClickingOverlay();
|
||||
|
||||
await n8n.settingsLogStreaming.clickDestinationCardDropdown(0);
|
||||
await n8n.settingsLogStreaming.clickDropdownMenuItem(1);
|
||||
await expect(n8n.settingsLogStreaming.getConfirmationDialog()).toBeVisible();
|
||||
await n8n.settingsLogStreaming.confirmDialog();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user