mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
test: Add custom reporter for test metrics (#18960)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
import type { Page, TestInfo } from '@playwright/test';
|
||||
|
||||
export async function measurePerformance(
|
||||
page: Page,
|
||||
@@ -28,3 +28,21 @@ export async function getAllPerformanceMetrics(page: Page) {
|
||||
return metrics;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a performance metric for collection by the metrics reporter
|
||||
* @param testInfo - The Playwright TestInfo object
|
||||
* @param metricName - Name of the metric (will be prefixed with 'metric:')
|
||||
* @param value - The numeric value to track
|
||||
* @param unit - The unit of measurement (e.g., 'ms', 'bytes', 'count')
|
||||
*/
|
||||
export async function attachMetric(
|
||||
testInfo: TestInfo,
|
||||
metricName: string,
|
||||
value: number,
|
||||
unit?: string,
|
||||
): Promise<void> {
|
||||
await testInfo.attach(`metric:${metricName}`, {
|
||||
body: JSON.stringify({ value, unit }),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user