diff --git a/docs/src/api/class-playwright.md b/docs/src/api/class-playwright.md index d4147b7c97..e0579eabc8 100644 --- a/docs/src/api/class-playwright.md +++ b/docs/src/api/class-playwright.md @@ -243,10 +243,6 @@ Selectors can be used to install custom selector engines. See This object can be used to launch or connect to WebKit, returning instances of [Browser]. -## property: Playwright.mockingProxy -* since: v1.51 -- type: <[MockingProxyFactory]> - ## method: Playwright.close * since: v1.9 * langs: java diff --git a/docs/src/test-api/class-fixtures.md b/docs/src/test-api/class-fixtures.md index cda74b4346..0c08b19da3 100644 --- a/docs/src/test-api/class-fixtures.md +++ b/docs/src/test-api/class-fixtures.md @@ -112,9 +112,3 @@ test('basic test', async ({ request }) => { // ... }); ``` - -## property: Fixtures.server -* since: v1.51 -- type: <[MockingProxy]> - -Instance of [MockingProxy] that can be used to intercept network requests from your application server. diff --git a/packages/playwright-core/src/client/events.ts b/packages/playwright-core/src/client/events.ts index 4cf21d78cd..a074b26f3d 100644 --- a/packages/playwright-core/src/client/events.ts +++ b/packages/playwright-core/src/client/events.ts @@ -94,11 +94,4 @@ export const Events = { Console: 'console', Window: 'window', }, - - MockingProxy: { - Request: 'request', - RequestFailed: 'requestfailed', - Response: 'response', - RequestFinished: 'requestfinished', - } }; diff --git a/packages/playwright-core/src/client/page.ts b/packages/playwright-core/src/client/page.ts index 9521478406..000bdac311 100644 --- a/packages/playwright-core/src/client/page.ts +++ b/packages/playwright-core/src/client/page.ts @@ -855,7 +855,7 @@ export class BindingCall extends ChannelOwner { } } -export function trimUrl(param: any): string | undefined { +function trimUrl(param: any): string | undefined { if (isRegExp(param)) return `/${trimStringWithEllipsis(param.source, 50)}/${param.flags}`; if (isString(param)) diff --git a/packages/playwright-core/src/client/playwright.ts b/packages/playwright-core/src/client/playwright.ts index fe10f07219..9933ce15de 100644 --- a/packages/playwright-core/src/client/playwright.ts +++ b/packages/playwright-core/src/client/playwright.ts @@ -22,7 +22,6 @@ import { ChannelOwner } from './channelOwner'; import { Electron } from './electron'; import { APIRequest } from './fetch'; import { Selectors, SelectorsOwner } from './selectors'; -import { MockingProxyFactory } from './mockingProxy'; export class Playwright extends ChannelOwner { readonly _android: Android; @@ -35,13 +34,11 @@ export class Playwright extends ChannelOwner { readonly devices: any; selectors: Selectors; readonly request: APIRequest; - readonly mockingProxy: MockingProxyFactory; readonly errors: { TimeoutError: typeof TimeoutError }; constructor(parent: ChannelOwner, type: string, guid: string, initializer: channels.PlaywrightInitializer) { super(parent, type, guid, initializer); this.request = new APIRequest(this); - this.mockingProxy = new MockingProxyFactory(this._connection.localUtils()); this.chromium = BrowserType.from(initializer.chromium); this.chromium._playwright = this; this.firefox = BrowserType.from(initializer.firefox); diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts index 6bd075a633..d35137fbe2 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -20172,8 +20172,6 @@ export const chromium: BrowserType; */ export const firefox: BrowserType; -export const mockingProxy: MockingProxyFactory; - /** * Exposes API that can be used for the Web API testing. */ diff --git a/packages/playwright/src/index.ts b/packages/playwright/src/index.ts index 0d765cc649..1ad07a7f32 100644 --- a/packages/playwright/src/index.ts +++ b/packages/playwright/src/index.ts @@ -238,7 +238,7 @@ const playwrightFixtures: Fixtures = ({ if (serviceWorkers !== undefined) options.serviceWorkers = serviceWorkers; if (_mockingProxy) - options.extraHTTPHeaders = { ...options.extraHTTPHeaders, 'x-pw-proxy-port': String(_mockingProxy.port()) }; + options.extraHTTPHeaders = { ...options.extraHTTPHeaders, 'x-playwright-proxy-port': String(_mockingProxy.port()) }; await use({ ...contextOptions, ...options, diff --git a/packages/playwright/src/util.ts b/packages/playwright/src/util.ts index cd12895f91..f7f91d3198 100644 --- a/packages/playwright/src/util.ts +++ b/packages/playwright/src/util.ts @@ -19,9 +19,8 @@ import type { StackFrame } from '@protocol/channels'; import util from 'util'; import path from 'path'; import url from 'url'; -import net, { AddressInfo } from 'net'; import { debug, mime, minimatch, parseStackTraceLine } from 'playwright-core/lib/utilsBundle'; -import { formatCallLog, ManualPromise } from 'playwright-core/lib/utils'; +import { formatCallLog } from 'playwright-core/lib/utils'; import type { Location } from './../types/testReporter'; import { calculateSha1, isRegExp, isString, sanitizeForFilePath, stringifyStackFrames } from 'playwright-core/lib/utils'; import type { RawStack } from 'playwright-core/lib/utils'; diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index a63cd2fe92..30712d7631 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import type { APIRequestContext, Browser, BrowserContext, BrowserContextOptions, Page, LaunchOptions, ViewportSize, Geolocation, HTTPCredentials, Locator, APIResponse, PageScreenshotOptions, MockingProxy } from 'playwright-core'; +import type { APIRequestContext, Browser, BrowserContext, BrowserContextOptions, Page, LaunchOptions, ViewportSize, Geolocation, HTTPCredentials, Locator, APIResponse, PageScreenshotOptions } from 'playwright-core'; export * from 'playwright-core'; export type ReporterDescription = Readonly< @@ -6913,10 +6913,6 @@ export interface PlaywrightTestArgs { * */ request: APIRequestContext; - /** - * Instance of [MockingProxy] that can be used to intercept network requests from your application server. - */ - server: MockingProxy; } type ExcludeProps = { diff --git a/utils/generate_types/overrides-test.d.ts b/utils/generate_types/overrides-test.d.ts index ff19d6b350..1cf650c15b 100644 --- a/utils/generate_types/overrides-test.d.ts +++ b/utils/generate_types/overrides-test.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { APIRequestContext, Browser, BrowserContext, BrowserContextOptions, Page, LaunchOptions, ViewportSize, Geolocation, HTTPCredentials, Locator, APIResponse, PageScreenshotOptions, MockingProxy } from 'playwright-core'; +import type { APIRequestContext, Browser, BrowserContext, BrowserContextOptions, Page, LaunchOptions, ViewportSize, Geolocation, HTTPCredentials, Locator, APIResponse, PageScreenshotOptions } from 'playwright-core'; export * from 'playwright-core'; export type ReporterDescription = Readonly< @@ -288,7 +288,6 @@ export interface PlaywrightTestArgs { context: BrowserContext; page: Page; request: APIRequestContext; - server: MockingProxy; } type ExcludeProps = {