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)