playwright-performance-reporter
Version:
Measure and publish performance metrics from browser dev-tools when running playwright
42 lines (41 loc) • 1.06 kB
JavaScript
/**
* Supported hooks to run measurements on
*/
export const hooks = ['onTest', 'onTestStep'];
export const hookOrder = ['onStart', 'onSampling', 'onStop'];
/**
* All metrics implemented in the reporter
*/
export const metrics = [
'usedJsHeapSize',
'totalJsHeapSize',
'jsHeapSizeLimit',
'powerInWatts',
'allPerformanceMetrics',
'heapDump',
];
/**
* Browsers that have been tested to work with performance metric extraction
*/
export const supportedBrowsers = ['chromium', 'webkit', 'firefox'];
/**
* Restrict metrics to browsers as some don't expose APIs or
* don't support extraction at all
*/
export const browsersSupportingMetrics = {
chromium: ['usedJsHeapSize', 'totalJsHeapSize', 'allPerformanceMetrics', 'heapDump'],
firefox: [],
webkit: [],
};
export const defaultOptions = {
outputDir: './',
outputFile: 'performance-report.json',
deleteOnFailure: false,
browsers: {
chromium: {
onTest: {
metrics: ['usedJsHeapSize'],
},
},
},
};