← Back to microsoft/playwright
microsoft / playwright · Issue No. 42081
Add an optional params?: Record<string, unknown> field to tracing.group() so library users can attach small, structured, machine-readable metadata to a logical trace group.
Today tracing.group() accepts a name and optional location, while the corresponding BeforeActionTraceEvent.params is always recorded as {}. The trace event already supports a params map, and Trace Viewer's Call tab already renders action parameters. Passing optional group params through the existing channel and recorder would therefore make structured group annotations visible without requiring a new trace format or custom viewer behavior.
The proposed change is additive:
tracingGroup protocol command;tracing.group() options;BeforeActionTraceEvent.params;Existing callers and traces remain unchanged, and older viewers can ignore populated params.
await context.tracing.start({ screenshots: true, snapshots: true });
using group = await context.tracing.group('checkout decision', {
params: {
actor: 'shopper-42',
step: 7,
decision: 'continue',
confidence: 0.91,
},
});
await page.getByRole('button', { name: 'Continue' }).click();
Selecting the group in Trace Viewer would show these values in the existing Parameters section. Callers would remain responsible for keeping metadata small and excluding sensitive values, as they are for trace titles and attachments today.
String titles are useful for people but brittle for tools. Structured group metadata would support generic use cases such as:
The underlying event and viewer rendering paths already exist, so this provides a small public seam instead of requiring consumers to overload titles or maintain viewer forks.
Relay reads this issue against the repository's contribution signals: the files it is likely to touch, how the maintainers triage work this size, and what the first contribution would exercise.
The full analysis for this issue is still being assembled. Until then, the description above and the thread on GitHub are the most reliable context.