Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(tracing): store relative video path in the trace (#4710)

Dmitry Gozmanab63063c033b
diff --git a/src/trace/tracer.ts b/src/trace/tracer.ts
index 03561b9a18..54d818aeae 100644
--- a/src/trace/tracer.ts
+++ b/src/trace/tracer.ts
@@ -77,10 +77,12 @@ class ContextTracer implements SnapshotterDelegate, ActionListener {
private _eventListeners: RegisteredListener[];
private _disposed = false;
private _pageToId = new Map<Page, string>();
+ private _traceFile: string;
constructor(context: BrowserContext, traceStorageDir: string, traceFile: string) {
this._context = context;
this._contextId = 'context@' + createGuid();
+ this._traceFile = traceFile;
this._traceStoragePromise = mkdirIfNeeded(path.join(traceStorageDir, 'sha1')).then(() => traceStorageDir);
this._appendEventChain = mkdirIfNeeded(traceFile).then(() => traceFile);
this._writeArtifactChain = Promise.resolve();
@@ -162,7 +164,7 @@ class ContextTracer implements SnapshotterDelegate, ActionListener {
type: 'page-video',
contextId: this._contextId,
pageId,
- fileName: path.basename(video._path),
+ fileName: path.relative(path.dirname(this._traceFile), video._path),
};
this._appendTraceEvent(event);
});