From dbb093978ef1b6ce8e364c6995f218f2b32d0391 Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Fri, 15 Nov 2024 09:11:19 +0100 Subject: [PATCH] fix(test): hide response.* calls from reports --- packages/playwright-core/src/client/network.ts | 1 + tests/library/trace-viewer.spec.ts | 15 +++++++++++++++ tests/playwright-test/test-step.spec.ts | 2 -- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/playwright-core/src/client/network.ts b/packages/playwright-core/src/client/network.ts index 74b8df9367..6ef9189f55 100644 --- a/packages/playwright-core/src/client/network.ts +++ b/packages/playwright-core/src/client/network.ts @@ -645,6 +645,7 @@ export class Response extends ChannelOwner implements constructor(parent: ChannelOwner, type: string, guid: string, initializer: channels.ResponseInitializer) { super(parent, type, guid, initializer); + this.markAsInternalType(); this._provisionalHeaders = new RawHeaders(initializer.headers); this._request = Request.from(this._initializer.request); Object.assign(this._request._timing, this._initializer.timing); diff --git a/tests/library/trace-viewer.spec.ts b/tests/library/trace-viewer.spec.ts index 0daf06298a..e05db78bce 100644 --- a/tests/library/trace-viewer.spec.ts +++ b/tests/library/trace-viewer.spec.ts @@ -1444,6 +1444,21 @@ test('should not record route actions', { ]); }); +test('should not record response actions', { + annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/33558' }, +}, async ({ page, runAndTrace, server }) => { + const traceViewer = await runAndTrace(async () => { + page.on('response', async response => { + await response.text(); + }); + await page.goto(server.EMPTY_PAGE); + }); + + await expect(traceViewer.actionTitles).toHaveText([ + /page.goto.*empty.html/, + ]); +}); + test('should show baseURL in metadata pane', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/31847' }, }, async ({ showTraceViewer }) => { diff --git a/tests/playwright-test/test-step.spec.ts b/tests/playwright-test/test-step.spec.ts index f0e3099540..8caa9b17f5 100644 --- a/tests/playwright-test/test-step.spec.ts +++ b/tests/playwright-test/test-step.spec.ts @@ -1406,9 +1406,7 @@ pw:api |page.setContent @ a.test.ts:5 test.step |custom step @ a.test.ts:6 pw:api | page.waitForResponse @ a.test.ts:7 pw:api | page.click(div) @ a.test.ts:13 -pw:api | response.text @ a.test.ts:8 expect | expect.toBeTruthy @ a.test.ts:9 -pw:api | response.text @ a.test.ts:15 expect |expect.toBe @ a.test.ts:17 hook |After Hooks fixture | fixture: page