Skip to content

Commit

Permalink
update playwright interface
Browse files Browse the repository at this point in the history
partial cherry-pick from #64604, needed for #67734
  • Loading branch information
lubieowoce authored and ztanner committed Aug 26, 2024
1 parent 5e6f511 commit d3021b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/lib/browsers/base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type Event = 'request'
export type Event = 'request' | 'response'

/**
* This is the base Browser interface all browser
Expand Down
4 changes: 4 additions & 0 deletions test/lib/browsers/playwright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class Playwright extends BrowserInterface {
private activeTrace?: string
private eventCallbacks: Record<Event, Set<(...args: any[]) => void>> = {
request: new Set(),
response: new Set(),
}
private async initContextTracing(url: string, context: BrowserContext) {
if (!tracePlaywright) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d3021b6

Please sign in to comment.