Skip to content

Commit

Permalink
fix: do not start tracing in default recorder (#32770)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelfeldman committed Sep 23, 2024
1 parent 0c8b2a7 commit c7a5278
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/playwright-core/src/server/recorder/contextRecorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ export class ContextRecorder extends EventEmitter {
private _throttledOutputFile: ThrottledFile | null = null;
private _orderedLanguages: LanguageGenerator[] = [];
private _listeners: RegisteredListener[] = [];
private _codegenMode: 'actions' | 'trace-events';

constructor(codegenMode: 'actions' | 'trace-events', context: BrowserContext, params: channels.BrowserContextEnableRecorderParams, delegate: ContextRecorderDelegate) {
super();
this._codegenMode = codegenMode;
this._context = context;
this._params = params;
this._delegate = delegate;
Expand Down Expand Up @@ -145,10 +147,12 @@ export class ContextRecorder extends EventEmitter {

setEnabled(enabled: boolean) {
this._collection.setEnabled(enabled);
if (enabled)
this._context.tracing.startChunk({ name: 'trace', title: 'trace' }).catch(() => {});
else
this._context.tracing.stopChunk({ mode: 'discard' }).catch(() => {});
if (this._codegenMode === 'trace-events') {
if (enabled)
this._context.tracing.startChunk({ name: 'trace', title: 'trace' }).catch(() => {});
else
this._context.tracing.stopChunk({ mode: 'discard' }).catch(() => {});
}
}

dispose() {
Expand Down

0 comments on commit c7a5278

Please sign in to comment.