UNPKG

playwright-performance-reporter

Version:

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

26 lines (25 loc) 714 B
import { sanitizeStringInput } from './index.js'; /** * Create generic `TestPerformance` object to fill during measurements * * @param name identifier for the performance metrics */ export function buildTestPerformance(name) { return { name, startMetrics: [], stopMetrics: [], samplingMetrics: [], startMeasurement: Date.now(), endMeasurement: Date.now(), }; } /** * Get id and name from test hierarchy * * @param testCase case from test suite */ export function buildTestCaseIdentifier(testCase) { const customName = testCase.titlePath().join(' > '); return { id: sanitizeStringInput(testCase.id), name: sanitizeStringInput(customName) }; }