mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 11:49:59 +00:00
test: Add custom reporter for test metrics (#18960)
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
import { test, expect } from '../../fixtures/cloud';
|
||||
import type { n8nPage } from '../../pages/n8nPage';
|
||||
import { measurePerformance } from '../../utils/performance-helper';
|
||||
import { measurePerformance, attachMetric } from '../../utils/performance-helper';
|
||||
|
||||
async function setupPerformanceTest(n8n: n8nPage, size: number) {
|
||||
await n8n.goHome();
|
||||
@@ -25,7 +25,7 @@ async function setupPerformanceTest(n8n: n8nPage, size: number) {
|
||||
}
|
||||
|
||||
test.describe('Large Node Performance - Cloud Resources', () => {
|
||||
test('Large workflow with starter plan resources @cloud:starter', async ({ n8n }) => {
|
||||
test('Large workflow with starter plan resources @cloud:starter', async ({ n8n }, testInfo) => {
|
||||
await setupPerformanceTest(n8n, 30000);
|
||||
const loopSize = 20;
|
||||
const stats = [];
|
||||
@@ -49,6 +49,10 @@ test.describe('Large Node Performance - Cloud Resources', () => {
|
||||
}
|
||||
const average = stats.reduce((a, b) => a + b, 0) / stats.length;
|
||||
console.log(`Average open node duration: ${average.toFixed(1)}ms`);
|
||||
|
||||
// Attach performance metric using helper method
|
||||
await attachMetric(testInfo, 'open-node-30000', average, 'ms');
|
||||
|
||||
expect(average).toBeLessThan(5000);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { test, expect } from '../../fixtures/base';
|
||||
import type { n8nPage } from '../../pages/n8nPage';
|
||||
import { getAllPerformanceMetrics, measurePerformance } from '../../utils/performance-helper';
|
||||
import {
|
||||
getAllPerformanceMetrics,
|
||||
measurePerformance,
|
||||
attachMetric,
|
||||
} from '../../utils/performance-helper';
|
||||
|
||||
async function setupPerformanceTest(n8n: n8nPage, size: number) {
|
||||
await n8n.goHome();
|
||||
await n8n.workflows.clickNewWorkflowCard();
|
||||
await n8n.start.fromNewProject();
|
||||
await n8n.canvas.importWorkflow('large.json', 'Large Workflow');
|
||||
await n8n.notifications.closeNotificationByText('Successful');
|
||||
|
||||
@@ -51,6 +54,8 @@ test.describe('Performance Example: Multiple sets}', () => {
|
||||
});
|
||||
});
|
||||
|
||||
await attachMetric(test.info(), `trigger-workflow-${size}`, triggerDuration, 'ms');
|
||||
|
||||
// Assert trigger performance
|
||||
expect(triggerDuration).toBeLessThan(budgets.triggerWorkflow);
|
||||
console.log(
|
||||
@@ -62,6 +67,9 @@ test.describe('Performance Example: Multiple sets}', () => {
|
||||
await n8n.canvas.openNode('Code');
|
||||
});
|
||||
|
||||
// Attach performance metric using helper method
|
||||
await attachMetric(test.info(), `open-large-node-${size}`, openNodeDuration, 'ms');
|
||||
|
||||
// Assert node opening performance
|
||||
expect(openNodeDuration).toBeLessThan(budgets.openLargeNode);
|
||||
console.log(
|
||||
|
||||
Reference in New Issue
Block a user