UNPKG

playwright-performance-reporter

Version:

Measure and publish performance metrics from browser dev-tools when running playwright

60 lines (59 loc) 1.81 kB
import { type PresenterWriter, type ResultAccumulator, type TestPerformance } from '../../types/index.js'; import { type TimelineDataPoint, type ChartPresenterOptions } from './types.js'; /** * Base presenter that collects timeline data points and writes to file */ export declare class TimelineDataPresenter implements PresenterWriter { /** * Status whether writer is usable */ protected isClosed: boolean; /** * Timeline data collected from writes */ protected timelineData: TimelineDataPoint[]; /** * Locator where to store the output */ private readonly filePath; /** * File writer */ private readonly fileStream; /** * Maps unique test ids to the computed name */ private readonly testIdToParentNameMap; /** * Initialize writer * * @param options defines target output */ constructor(options: ChartPresenterOptions); /** * Finish data collection and generate output */ close(): Promise<boolean>; /** * Delete created file */ delete(): Promise<boolean>; /** * Create new entry by filtering numeric data for the timeline. * * @param content The result accumulator containing test performance data */ write(content: ResultAccumulator): Promise<boolean>; /** * Extract a TimelineDataPoint from TestPerformance data * * @param caseId The case identifier * @param testPerformance The test performance data * @returns TimelineDataPoint or undefined if no numeric data found */ protected extractDatapoint(caseId: string, testPerformance: TestPerformance): TimelineDataPoint | undefined; /** * Generate output from collected timeline data */ protected generate(): string; }