From d3021b647544f1c73194541a4e8e90eac9074c95 Mon Sep 17 00:00:00 2001 From: Janka Uryga Date: Fri, 23 Aug 2024 14:04:15 +0200 Subject: [PATCH] update playwright interface partial cherry-pick from #64604, needed for #67734 --- test/lib/browsers/base.ts | 2 +- test/lib/browsers/playwright.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/lib/browsers/base.ts b/test/lib/browsers/base.ts index 1475b7eed5170..bfa8163cdecdd 100644 --- a/test/lib/browsers/base.ts +++ b/test/lib/browsers/base.ts @@ -1,4 +1,4 @@ -export type Event = 'request' +export type Event = 'request' | 'response' /** * This is the base Browser interface all browser diff --git a/test/lib/browsers/playwright.ts b/test/lib/browsers/playwright.ts index 0680fe5af552f..30b9d748b779a 100644 --- a/test/lib/browsers/playwright.ts +++ b/test/lib/browsers/playwright.ts @@ -49,6 +49,7 @@ export class Playwright extends BrowserInterface { private activeTrace?: string private eventCallbacks: Record void>> = { request: new Set(), + response: new Set(), } private async initContextTracing(url: string, context: BrowserContext) { if (!tracePlaywright) { @@ -233,6 +234,9 @@ export class Playwright extends BrowserInterface { page.on('request', (req) => { this.eventCallbacks.request.forEach((cb) => cb(req)) }) + page.on('response', (res) => { + this.eventCallbacks.response.forEach((cb) => cb(res)) + }) if (opts?.disableCache) { // TODO: this doesn't seem to work (dev tools does not check the box as expected)