Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Microsoft Playwright TraceV3

From Leeroopedia

Template:Implementation Page

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 name
  • Point -- x/y coordinates for mouse events
  • ResourceSnapshot -- 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 type discriminator field
  • Resource snapshots follow the HAR (HTTP Archive) specification

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment