playwright-performance-reporter
Version:
Measure and publish performance metrics from browser dev-tools when running playwright
60 lines (59 loc) • 1.85 kB
TypeScript
import { TimelineDataPresenter } from '../timeline-data-presenter/index.js';
/**
* Presenter that generates an HTML chart visualization using Chart.js
*/
export declare class ChartPresenter extends TimelineDataPresenter {
/**
* Generate the HTML with Chart.js visualization
*/
protected generate(): string;
/**
* Escape HTML special characters to prevent XSS
*/
private escapeHtml;
/**
* Extract metric value from a datapoint by metric name
*
* @param datapoint The chart datapoint to extract from
* @param metricName The name of the metric to extract
* @returns The metric value or undefined if not found
*/
private extractMetricValue;
/**
* Get available metrics for a specific test name
*
* @param testName The test name to filter metrics for
* @returns Array of metric names available for the test
*/
private getAvailableMetricsForTest;
/**
* Compute summary statistics for a specific test
*
* @param testName The test name to compute summary for
* @returns Map of metric names to their summary statistics
*/
private computeMetricsSummary;
/**
* Format metric value with appropriate units
*
* @param name The metric name
* @param value The metric value
* @returns Formatted string with units
*/
private formatMetricValue;
/**
* Generate HTML for metrics comparison section
*
* @param testName The test name to generate comparison for
* @returns HTML string for the metrics comparison grid
*/
private generateMetricsComparisonSection;
/**
* Extract all unique metric names from chart data
*/
private getUniqueMetrics;
/**
* Get all unique test names from chart data
*/
private getUniqueTestNames;
}