Skip to content

Commit d3021b6

Browse files

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
 

‎test/lib/browsers/base.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export type Event = 'request'
1+
export type Event = 'request' | 'response'
22

33
/**
44
* This is the base Browser interface all browser

‎test/lib/browsers/playwright.ts

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export class Playwright extends BrowserInterface {
4949
private activeTrace?: string
5050
private eventCallbacks: Record<Event, Set<(...args: any[]) => void>> = {
5151
request: new Set(),
52+
response: new Set(),
5253
}
5354
private async initContextTracing(url: string, context: BrowserContext) {
5455
if (!tracePlaywright) {
@@ -233,6 +234,9 @@ export class Playwright extends BrowserInterface {
233234
page.on('request', (req) => {
234235
this.eventCallbacks.request.forEach((cb) => cb(req))
235236
})
237+
page.on('response', (res) => {
238+
this.eventCallbacks.response.forEach((cb) => cb(res))
239+
})
236240

237241
if (opts?.disableCache) {
238242
// TODO: this doesn't seem to work (dev tools does not check the box as expected)

0 commit comments

Comments
 (0)
Please sign in to comment.