fix(tracing): do not double-zip entries in remote mode (#21579)

Fixes #21435.
This commit is contained in:
Dmitry Gozman 2023-03-10 14:54:32 -08:00 committed by GitHub
parent 6d27d2c029
commit 46f9fa005e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 9 deletions

View File

@ -87,7 +87,7 @@ export class Tracing extends ChannelOwner<channels.TracingChannel> implements ap
await artifact.delete(); await artifact.delete();
// Add local sources to the remote trace if necessary. // Add local sources to the remote trace if necessary.
if (result.entries?.length) if (metadata.length)
await this._connection.localUtils()._channel.zip({ zipFile: filePath, entries: result.entries!, metadata, mode: 'append', includeSources: this._includeSources }); await this._connection.localUtils()._channel.zip({ zipFile: filePath, entries: [], metadata, mode: 'append', includeSources: this._includeSources });
} }
} }

View File

@ -218,7 +218,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps
await this._writeChain; await 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) if (this._isStopping)
throw new Error(`Tracing is already stopping`); throw new Error(`Tracing is already stopping`);
this._isStopping = true; this._isStopping = true;
@ -227,7 +227,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps
this._isStopping = false; this._isStopping = false;
if (params.mode !== 'discard') if (params.mode !== 'discard')
throw new Error(`Must start tracing before stopping`); throw new Error(`Must start tracing before stopping`);
return { sourceEntries: [] }; return {};
} }
const state = this._state!; const state = this._state!;
@ -270,7 +270,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps
if (params.mode === 'entries') if (params.mode === 'entries')
return { entries }; return { entries };
const artifact = await this._exportZip(entries, state).catch(() => undefined); const artifact = await this._exportZip(entries, state).catch(() => undefined);
return { artifact, entries }; return { artifact };
}).finally(() => { }).finally(() => {
// Only reset trace sha1s, network resources are preserved between chunks. // Only reset trace sha1s, network resources are preserved between chunks.
state.traceSha1s = new Set(); state.traceSha1s = new Set();

View File

@ -25,8 +25,6 @@ const test = playwrightTest.extend<TraceViewerFixtures>(traceViewerFixtures);
test.skip(({ trace }) => trace === 'on'); test.skip(({ trace }) => trace === 'on');
test.slow(); test.slow();
test.fixme(({ mode }) => mode === 'service' || mode === 'driver', 'https://github.com/microsoft/playwright/issues/21435');
let traceFile: string; let traceFile: string;
test.beforeAll(async function recordTrace({ browser, browserName, browserType, server }, workerInfo) { test.beforeAll(async function recordTrace({ browser, browserName, browserType, server }, workerInfo) {

View File

@ -263,7 +263,7 @@ for (const bundle of bundles) {
for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer']) { for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer']) {
steps.push({ steps.push({
command: 'npx', command: 'npx',
args: ['vite', 'build', ...(watchMode ? ['--watch', '--sourcemap'] : [])], args: ['vite', 'build', ...(watchMode ? ['--watch', '--sourcemap', '--minify=false'] : [])],
shell: true, shell: true,
cwd: path.join(__dirname, '..', '..', 'packages', webPackage), cwd: path.join(__dirname, '..', '..', 'packages', webPackage),
concurrent: true, concurrent: true,
@ -272,7 +272,7 @@ for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer']) {
// Build/watch trace viewer service worker. // Build/watch trace viewer service worker.
steps.push({ steps.push({
command: 'npx', 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, shell: true,
cwd: path.join(__dirname, '..', '..', 'packages', 'trace-viewer'), cwd: path.join(__dirname, '..', '..', 'packages', 'trace-viewer'),
concurrent: true, concurrent: true,