ReadonlystartStarts tracing.
ReadonlystartStarts a new tracing chunk.
ReadonlystartStarts a new tracing chunk and stops it when the current Scope closes.
Tracing must already be started. Pass stopOptions.path to save the
chunk; a failure while stopping is logged instead of failing the scope.
Optionaloptions: { name?: string; title?: string }
Options passed to Tracing.startChunk.
Optionalname?: stringIf specified, intermediate trace files are going to be saved into the files with the given name prefix inside the
tracesDir directory
specified in
browserType.launch([options]). To specify
the final trace zip file name, you need to pass path option to
tracing.stopChunk([options]) instead.
Optionaltitle?: stringTrace name to be shown in the Trace Viewer.
OptionalstopOptions: { path?: string }
Options passed to Tracing.stopChunk when the scope closes.
Optionalpath?: stringExport trace collected since the last tracing.startChunk([options]) call into the file with the given path.
ReadonlystartStarts HAR recording.
ReadonlystartStarts tracing and stops it when the current Scope closes.
When to use
Use instead of pairing Tracing.start with Tracing.stop, so the trace is stopped even when the workflow fails or is interrupted.
Gotchas
Pass stopOptions.path to save the trace; without it Playwright discards
the recording. A failure while stopping is logged instead of failing the
scope.
Optionaloptions: {Options passed to Tracing.start.
Optionallive?: booleanWhen enabled, the trace is written to an unarchived file that is updated in real time as actions occur, instead of caching changes and archiving them into a zip file at the end. This is useful for live trace viewing during test execution.
Optionalname?: stringIf specified, intermediate trace files are going to be saved into the files with the given name prefix inside the
tracesDir directory
specified in
browserType.launch([options]). To specify
the final trace zip file name, you need to pass path option to
tracing.stop([options]) instead.
Optionalscreenshots?: booleanWhether to capture screenshots during tracing. Screenshots are used to build a timeline preview.
Optionalsnapshots?: boolean | { aria?: boolean; dom?: boolean; screen?: boolean }Which snapshots to capture on every action. Passing true is a shortcut for { dom: true }.
Optionalsources?: booleanWhether to include source files for trace actions.
Optionaltitle?: stringTrace name to be shown in the Trace Viewer.
OptionalstopOptions: { path?: string }
Options passed to Tracing.stop when the scope closes.
Optionalpath?: stringExport trace into the file with the given path.
import { Effect } from "effect";
import { Playwright } from "effect-playwright";
import { chromium } from "playwright-core";
const program = Effect.gen(function* () {
const playwright = yield* Playwright.Playwright;
const browser = yield* playwright.launchScoped(chromium);
const context = yield* browser.newContext();
yield* context.tracing.startScoped(
{ screenshots: true, snapshots: true },
{ path: "trace.zip" },
);
const page = yield* context.newPage;
yield* page.goto("https://example.com");
}).pipe(Effect.scoped, Effect.provide(Playwright.layer));
ReadonlystopStops tracing.
ReadonlystopStops a tracing chunk.
ReadonlystopStops HAR recording.
Since
0.5.0