Pipeline Stages

Parse

Extract structured data from Playwright trace.zip files.

The .parse() stage reads a Playwright trace archive and extracts all the data needed for video generation.

Basic usage

import { Recast } from 'playwright-recast'

const pipeline = Recast
  .from('./test-results/trace.zip')
  .parse()

You can also point to a directory containing trace files:

const pipeline = Recast
  .from('./test-results/')
  .parse()

What gets extracted

The parser reads the trace.zip and produces a structured representation containing:

DataSourceUsed by
ActionsUser interactions (click, fill, type, navigation)Speed processing, click effects, auto-zoom
ScreenshotsFrame-by-frame page capturesVideo frames
Network eventsAPI calls, resource loadingSpeed classification (network wait)
Cursor positionsMouse coordinates at each actionCursor overlay, click effects, auto-zoom
BDD step titlesplaywright-bdd Gherkin step namesSubtitle generation via .subtitlesFromTrace()

CLI equivalent

# Parse is implicit in CLI mode — it always runs
npx playwright-recast -i ./test-results/trace.zip -o demo.mp4

Source video resolution

The renderer needs a source .mp4/.webm to apply speed, zoom, overlays, and subtitles against. Two layouts are supported:

  • Sibling .webm (preferred) — when your Playwright config enables recordVideo (e.g. use: { video: 'on' }), the trace's sibling .webm is auto-discovered. Native frame rate, best quality.
  • Standalone trace.zip — when no sibling .webm exists (trace downloaded from the trace viewer, or test run without recordVideo), the pipeline assembles a CFR 25fps .mp4 from the screencast JPEG frames stored inside the trace. Variable capture cadence — .webm is preferred when available.

Tips

  • The trace file must be generated with Playwright's tracing enabled (--trace on or via playwright.config.ts).
  • .parse() should always be the first stage after .from(). Other stages depend on the parsed trace data.
  • Parsing is fast — the trace is read once and the structured data is passed through the pipeline.

On this page