chore: hide tracing calls from traces (#27096)

This commit is contained in:
Pavel Feldman 2023-09-15 12:55:49 -07:00 committed by GitHub
parent a34030be80
commit 527d260cbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 19 deletions

View File

@ -44,7 +44,7 @@ export class Tracing extends ChannelOwner<channels.TracingChannel> implements ap
});
const response = await this._channel.tracingStartChunk({ name: options.name, title: options.title });
return response.traceName;
});
}, true);
await this._startCollectingStacks(traceName);
}
@ -63,14 +63,16 @@ export class Tracing extends ChannelOwner<channels.TracingChannel> implements ap
}
async stopChunk(options: { path?: string } = {}) {
await this._doStopChunk(options.path);
await this._wrapApiCall(async () => {
await this._doStopChunk(options.path);
}, true);
}
async stop(options: { path?: string } = {}) {
await this._wrapApiCall(async () => {
await this._doStopChunk(options.path);
await this._channel.tracingStop();
});
}, true);
}
private async _doStopChunk(filePath: string | undefined) {

View File

@ -249,7 +249,7 @@ test('should reset tracing', async ({ reusedContext, trace }, testInfo) => {
await page.evaluate('2 + 2');
const error = await context.tracing.stopChunk({ path: testInfo.outputPath('trace.zip') }).catch(e => e);
expect(error.message).toContain('tracing.stopChunk: Must start tracing before stopping');
expect(error.message).toContain('Must start tracing before stopping');
});
test('should continue issuing events after closing the reused page', async ({ reusedContext, server }) => {

View File

@ -231,8 +231,6 @@ it.describe('pause', () => {
await recorderPage.waitForSelector('.source-line-paused:has-text("page.pause(); // 2")');
expect(await sanitizeLog(recorderPage)).toEqual([
'page.pause- XXms',
'tracing.start- XXms',
'tracing.stop- XXms',
'page.pause',
]);
await recorderPage.click('[title="Resume (F8)"]');

View File

@ -91,12 +91,10 @@ test('should record api trace', async ({ runInlineTest, server }, testInfo) => {
'Before Hooks',
' fixture: request',
' apiRequest.newContext',
' tracing.start',
' fixture: browser',
' browserType.launch',
' fixture: context',
' browser.newContext',
' tracing.start',
' fixture: page',
' browserContext.newPage',
'page.goto',
@ -105,14 +103,12 @@ test('should record api trace', async ({ runInlineTest, server }, testInfo) => {
' fixture: page',
' fixture: context',
' fixture: request',
' tracing.stopChunk',
' apiRequestContext.dispose',
]);
const trace2 = await parseTrace(testInfo.outputPath('test-results', 'a-api-pass', 'trace.zip'));
expect(trace2.actionTree).toEqual([
'Before Hooks',
'apiRequest.newContext',
'tracing.start',
'apiRequestContext.get',
'After Hooks',
]);
@ -121,10 +117,8 @@ test('should record api trace', async ({ runInlineTest, server }, testInfo) => {
'Before Hooks',
' fixture: request',
' apiRequest.newContext',
' tracing.start',
' fixture: context',
' browser.newContext',
' tracing.start',
' fixture: page',
' browserContext.newPage',
'page.goto',
@ -134,7 +128,6 @@ test('should record api trace', async ({ runInlineTest, server }, testInfo) => {
' fixture: page',
' fixture: context',
' fixture: request',
' tracing.stopChunk',
' apiRequestContext.dispose',
]);
});
@ -327,7 +320,6 @@ test('should not override trace file in afterAll', async ({ runInlineTest, serve
' browserType.launch',
' fixture: context',
' browser.newContext',
' tracing.start',
' fixture: page',
' browserContext.newPage',
'page.goto',
@ -339,10 +331,8 @@ test('should not override trace file in afterAll', async ({ runInlineTest, serve
' afterAll hook',
' fixture: request',
' apiRequest.newContext',
' tracing.start',
' apiRequestContext.get',
' fixture: request',
' tracing.stopChunk',
' apiRequestContext.dispose',
]);
@ -636,7 +626,6 @@ test('should expand expect.toPass', async ({ runInlineTest }, testInfo) => {
' browserType.launch',
' fixture: context',
' browser.newContext',
' tracing.start',
' fixture: page',
' browserContext.newPage',
'expect.toPass',
@ -676,7 +665,6 @@ test('should show non-expect error in trace', async ({ runInlineTest }, testInfo
' browserType.launch',
' fixture: context',
' browser.newContext',
' tracing.start',
' fixture: page',
' browserContext.newPage',
'expect.toBe',
@ -757,7 +745,6 @@ test('should use custom expect message in trace', async ({ runInlineTest }, test
' browserType.launch',
' fixture: context',
' browser.newContext',
' tracing.start',
' fixture: page',
' browserContext.newPage',
'expect to have text: find a hotel',