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 committed Aug 23, 2024
1 parent 8677a3a commit 6047cda
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 6047cda

Please sign in to comment.