Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(tracing): do not double-zip entries in remote mode (#21579)
Dmitry Gozman46f9fa005e7b
diff --git a/packages/playwright-core/src/client/tracing.ts b/packages/playwright-core/src/client/tracing.tsindex 2a5507987a..231c5e8d3c 100644--- a/packages/playwright-core/src/client/tracing.ts+++ b/packages/playwright-core/src/client/tracing.ts@@ -87,7 +87,7 @@ export class Tracing extends ChannelOwner<channels.TracingChannel> implements apawait artifact.delete();// Add local sources to the remote trace if necessary.- if (result.entries?.length)- await this._connection.localUtils()._channel.zip({ zipFile: filePath, entries: result.entries!, metadata, mode: 'append', includeSources: this._includeSources });+ if (metadata.length)+ await this._connection.localUtils()._channel.zip({ zipFile: filePath, entries: [], metadata, mode: 'append', includeSources: this._includeSources });}}diff --git a/packages/playwright-core/src/server/trace/recorder/tracing.ts b/packages/playwright-core/src/server/trace/recorder/tracing.tsindex 5d7195bb24..f4281378c7 100644--- a/packages/playwright-core/src/server/trace/recorder/tracing.ts+++ b/packages/playwright-core/src/server/trace/recorder/tracing.ts@@ -218,7 +218,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snapsawait this._writeChain;}- async stopChunk(params: TracingTracingStopChunkParams): Promise<{ artifact?: Artifact, entries?: NameValue[], sourceEntries?: NameValue[] }> {+ async stopChunk(params: TracingTracingStopChunkParams): Promise<{ artifact?: Artifact, entries?: NameValue[] }> {if (this._isStopping)throw new Error(`Tracing is already stopping`);this._isStopping = true;@@ -227,7 +227,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snapsthis._isStopping = false;if (params.mode !== 'discard')throw new Error(`Must start tracing before stopping`);- return { sourceEntries: [] };+ return {};}const state = this._state!;@@ -270,7 +270,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snapsif (params.mode === 'entries')return { entries };const artifact = await this._exportZip(entries, state).catch(() => undefined);- return { artifact, entries };+ return { artifact };}).finally(() => {// Only reset trace sha1s, network resources are preserved between chunks.state.traceSha1s = new Set();diff --git a/tests/library/trace-viewer.spec.ts b/tests/library/trace-viewer.spec.tsindex d75764c5b6..ff8b7123ee 100644--- a/tests/library/trace-viewer.spec.ts+++ b/tests/library/trace-viewer.spec.ts@@ -25,8 +25,6 @@ const test = playwrightTest.extend<TraceViewerFixtures>(traceViewerFixtures);test.skip(({ trace }) => trace === 'on');test.slow();-test.fixme(({ mode }) => mode === 'service' || mode === 'driver', 'https://github.com/microsoft/playwright/issues/21435');-let traceFile: string;test.beforeAll(async function recordTrace({ browser, browserName, browserType, server }, workerInfo) {diff --git a/utils/build/build.js b/utils/build/build.jsindex c2e5382014..b0079079f1 100644--- a/utils/build/build.js+++ b/utils/build/build.js@@ -263,7 +263,7 @@ for (const bundle of bundles) {for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer']) {steps.push({command: 'npx',- args: ['vite', 'build', ...(watchMode ? ['--watch', '--sourcemap'] : [])],+ args: ['vite', 'build', ...(watchMode ? ['--watch', '--sourcemap', '--minify=false'] : [])],shell: true,cwd: path.join(__dirname, '..', '..', 'packages', webPackage),concurrent: true,@@ -272,7 +272,7 @@ for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer']) {// Build/watch trace viewer service worker.steps.push({command: 'npx',- args: ['vite', '--config', 'vite.sw.config.ts', 'build', ...(watchMode ? ['--watch', '--sourcemap'] : [])],+ args: ['vite', '--config', 'vite.sw.config.ts', 'build', ...(watchMode ? ['--watch', '--sourcemap', '--minify=false'] : [])],shell: true,cwd: path.join(__dirname, '..', '..', 'packages', 'trace-viewer'),concurrent: true,