Skip to main content
Version: 1.x

Interface: ScreencastFixture

The screencast fixture API exposed to test bodies.

Remarks

All methods are safe to call even when page.screencast is not available in older Playwright versions — they degrade gracefully with a debug log.

Intent

Provide structured video recording with AI-first frame streaming

Capability

ui5.inspect

Example

test('purchase order', async ({ screencast }) => {
await screencast.showChapter('Login');
await screencast.showActions({ position: 'bottom' });
screencast.onFrame(async (frame) => {
await analyzeWithAI(frame.buffer);
});
});

Properties

onFrame

onFrame: (handler) => void

Registers a handler called for every raw video frame.

Parameters

handler

ScreencastFrameHandler

Async function or sync function receiving each frame.

Returns

void

Remarks

Handlers receive a ScreencastFrame with a JPEG buffer and a monotonic timestamp. Multiple handlers can be registered; they are called in registration order. Errors from handlers are caught and logged at debug level (non-fatal). Calling this method starts page.screencast.start({ onFrame }) if it has not been started yet.

Example

screencast.onFrame(async ({ buffer }) => {
const analysis = await aiVision.analyze(buffer);
if (analysis.anomaly) { throw new Error(analysis.reason); }
});

showActions

showActions: (options?) => Promise<void>

Enables DOM action annotations in the video.

Parameters

options?

ShowActionsOptions

Optional display configuration.

Returns

Promise<void>

Promise that resolves once actions are enabled.

Remarks

Playwright 1.59+ only. Annotates click, fill, and keyboard events on the video frames. Uses the Playwright showActions() options object.

Example

await screencast.showActions({ position: 'bottom', duration: 800 });
await page.getByRole('button', { name: 'Save' }).click();

showChapter

showChapter: (title) => Promise<void>

Marks a new chapter in the video at the current timestamp.

Parameters

title

string

Human-readable chapter title shown in the video overlay.

Returns

Promise<void>

Promise that resolves once the chapter marker is applied.

Remarks

Chapters create labelled overlays in the video. Call at the start of each logical test section. Requires Playwright 1.59+ — silently no-ops on older versions.

Example

await screencast.showChapter('Open purchase order form');
await page.goto('/fiori#PurchaseOrder-create');

showUI5ControlTree

showUI5ControlTree: (enabled?) => void

Enables or disables the UI5 control-tree overlay on video frames.

Parameters

enabled?

boolean

true to enable, false to disable (default).

Returns

void

Remarks

When enabled, records a flag that downstream frame handlers or a bridge extension can use to annotate each frame with the current UI5 control tree. Phase 1 implementation — overlay injection is handled by frame handlers.

Example

screencast.showUI5ControlTree(true);