From 4e4735c49a273fd8fba25e3a9942d5ce9b330cfe Mon Sep 17 00:00:00 2001 From: Shahzad Date: Thu, 27 Feb 2025 10:48:17 +0100 Subject: [PATCH] add types in client --- packages/playwright-client/types/types.d.ts | 12 ++++++++++++ packages/playwright-core/types/types.d.ts | 1 - 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/playwright-client/types/types.d.ts b/packages/playwright-client/types/types.d.ts index 874f072035..7328793c2e 100644 --- a/packages/playwright-client/types/types.d.ts +++ b/packages/playwright-client/types/types.d.ts @@ -19,6 +19,7 @@ import { Readable } from 'stream'; import { ReadStream } from 'fs'; import { Protocol } from './protocol'; import { Serializable, EvaluationArgument, PageFunction, PageFunctionOn, SmartHandle, ElementHandleForTag, BindingSource } from './structs'; +import {APIRequestEvent, APIRequestFinishedEvent} from "playwright-core/lib/server/fetch"; type PageWaitForSelectorOptionsNotHidden = PageWaitForSelectorOptions & { state?: 'visible'|'attached'; @@ -18665,6 +18666,17 @@ export interface APIRequestContext { }>; [Symbol.asyncDispose](): Promise; + + /** + * Emitted when a request is issued from API request context. The event will be emitted after the request is issued + */ + on(event: 'apiRequest', listener: (request: APIRequestEvent) => any): this; + + /** + * Emitted when a request finishes successfully after downloading the response body. For a successful response, the + * sequence of events is `request`, `response` and `requestfinished`. + */ + on(event: 'apiRequestfinished', listener: (request: APIRequestFinishedEvent) => any): this; } /** diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts index 738bffd770..7328793c2e 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -18667,7 +18667,6 @@ export interface APIRequestContext { [Symbol.asyncDispose](): Promise; - /** * Emitted when a request is issued from API request context. The event will be emitted after the request is issued */