Implementation:Microsoft Playwright TraceV3
Overview
TraceV3 defines the type schema for version 3 of the Playwright trace file format, used for recording and replaying test execution data in the trace viewer.
Description
This module defines the TypeScript types for trace version 3, the earliest versioned trace format. It includes types for:
SerializedValue-- serialized JavaScript values (numbers, booleans, strings, dates, RegExp, arrays, objects, handles)StackFrame-- source location with file, line, column, and function namePoint-- x/y coordinates for mouse eventsResourceSnapshot-- HTTP Archive (HAR) entry for network requests- Various trace event types for actions, navigation, and page state
This is the foundation schema that later versions (V4-V8) extend with additional fields and event types.
Usage
Used by the trace viewer to parse and display trace files from older Playwright versions.
Code Reference
Source Location
packages/playwright-core/src/utils/isomorphic/trace/versions/traceV3.ts (164 lines)
Key Types
type SerializedValue = {
n?: number; b?: boolean; s?: string;
v?: 'null' | 'undefined' | 'NaN' | 'Infinity' | '-Infinity' | '-0';
d?: string; u?: string;
r?: { p: string; f: string };
a?: SerializedValue[];
o?: { k: string; v: SerializedValue }[];
h?: number; id?: number; ref?: number;
};
type StackFrame = { file: string; line: number; column: number; function?: string };
type Point = { x: number; y: number };
Import
import type * as traceV3 from '../utils/isomorphic/trace/versions/traceV3';
I/O Contract
Data Format
- Trace files are ZIP archives containing JSON-lines files with typed events
- Each event has a
typediscriminator field - Resource snapshots follow the HAR (HTTP Archive) specification
Related Pages
- Microsoft_Playwright_TraceV4 -- Next version with extended types
- Microsoft_Playwright_TraceV5 -- Version 5 trace format