use playwright.local
This commit is contained in:
parent
481a9f65a8
commit
b43436ddf4
|
|
@ -529,6 +529,11 @@ An array of client certificates to be used. Each certificate object must have `c
|
||||||
Using Client Certificates in combination with Proxy Servers is not supported.
|
Using Client Certificates in combination with Proxy Servers is not supported.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
:::note
|
||||||
|
When using WebKit on macOS, accessing `localhost` might not work as expected.
|
||||||
|
Instead, use `playwright.local` as the hostname.
|
||||||
|
:::
|
||||||
|
|
||||||
## context-option-useragent
|
## context-option-useragent
|
||||||
- `userAgent` <[string]>
|
- `userAgent` <[string]>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import fs from 'fs';
|
||||||
import tls from 'tls';
|
import tls from 'tls';
|
||||||
import stream from 'stream';
|
import stream from 'stream';
|
||||||
import { createSocket } from '../utils/happy-eyeballs';
|
import { createSocket } from '../utils/happy-eyeballs';
|
||||||
import { globToRegex, isUnderTest } from '../utils';
|
import { globToRegex } from '../utils';
|
||||||
import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../common/socksProxy';
|
import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '../common/socksProxy';
|
||||||
import { SocksProxy } from '../common/socksProxy';
|
import { SocksProxy } from '../common/socksProxy';
|
||||||
import type * as channels from '@protocol/channels';
|
import type * as channels from '@protocol/channels';
|
||||||
|
|
@ -30,7 +30,7 @@ class SocksConnectionDuplex extends stream.Duplex {
|
||||||
constructor(private readonly writeCallback: (data: Buffer) => void) {
|
constructor(private readonly writeCallback: (data: Buffer) => void) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
override _read(): void {}
|
override _read(): void { }
|
||||||
override _write(chunk: Buffer, encoding: BufferEncoding, callback: (error?: Error | null | undefined) => void): void {
|
override _write(chunk: Buffer, encoding: BufferEncoding, callback: (error?: Error | null | undefined) => void): void {
|
||||||
this.writeCallback(chunk);
|
this.writeCallback(chunk);
|
||||||
callback();
|
callback();
|
||||||
|
|
@ -56,7 +56,7 @@ class SocksProxyConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect() {
|
async connect() {
|
||||||
this.target = await createSocket(isUnderTest() ? 'localhost' : this.host, this.port);
|
this.target = await createSocket(this.host === 'local.playwright' ? 'localhost' : this.host, this.port);
|
||||||
this.target.on('close', () => this.socksProxy._socksProxy.sendSocketEnd({ uid: this.uid }));
|
this.target.on('close', () => this.socksProxy._socksProxy.sendSocketEnd({ uid: this.uid }));
|
||||||
this.target.on('error', error => this.socksProxy._socksProxy.sendSocketError({ uid: this.uid, error: error.message }));
|
this.target.on('error', error => this.socksProxy._socksProxy.sendSocketError({ uid: this.uid, error: error.message }));
|
||||||
this.socksProxy._socksProxy.socketConnected({
|
this.socksProxy._socksProxy.socketConnected({
|
||||||
|
|
|
||||||
12
packages/playwright-core/types/types.d.ts
vendored
12
packages/playwright-core/types/types.d.ts
vendored
|
|
@ -13229,6 +13229,9 @@ export interface BrowserType<Unused = {}> {
|
||||||
* URLs that the certificate is valid for.
|
* URLs that the certificate is valid for.
|
||||||
*
|
*
|
||||||
* **NOTE** Using Client Certificates in combination with Proxy Servers is not supported.
|
* **NOTE** Using Client Certificates in combination with Proxy Servers is not supported.
|
||||||
|
*
|
||||||
|
* **NOTE** When using WebKit on macOS, accessing `localhost` might not work as expected. Instead, use
|
||||||
|
* `playwright.local` as the hostname.
|
||||||
*/
|
*/
|
||||||
clientCertificates?: Array<{
|
clientCertificates?: Array<{
|
||||||
/**
|
/**
|
||||||
|
|
@ -15639,6 +15642,9 @@ export interface APIRequest {
|
||||||
* URLs that the certificate is valid for.
|
* URLs that the certificate is valid for.
|
||||||
*
|
*
|
||||||
* **NOTE** Using Client Certificates in combination with Proxy Servers is not supported.
|
* **NOTE** Using Client Certificates in combination with Proxy Servers is not supported.
|
||||||
|
*
|
||||||
|
* **NOTE** When using WebKit on macOS, accessing `localhost` might not work as expected. Instead, use
|
||||||
|
* `playwright.local` as the hostname.
|
||||||
*/
|
*/
|
||||||
clientCertificates?: Array<{
|
clientCertificates?: Array<{
|
||||||
/**
|
/**
|
||||||
|
|
@ -16831,6 +16837,9 @@ export interface Browser extends EventEmitter {
|
||||||
* URLs that the certificate is valid for.
|
* URLs that the certificate is valid for.
|
||||||
*
|
*
|
||||||
* **NOTE** Using Client Certificates in combination with Proxy Servers is not supported.
|
* **NOTE** Using Client Certificates in combination with Proxy Servers is not supported.
|
||||||
|
*
|
||||||
|
* **NOTE** When using WebKit on macOS, accessing `localhost` might not work as expected. Instead, use
|
||||||
|
* `playwright.local` as the hostname.
|
||||||
*/
|
*/
|
||||||
clientCertificates?: Array<{
|
clientCertificates?: Array<{
|
||||||
/**
|
/**
|
||||||
|
|
@ -20304,6 +20313,9 @@ export interface BrowserContextOptions {
|
||||||
* URLs that the certificate is valid for.
|
* URLs that the certificate is valid for.
|
||||||
*
|
*
|
||||||
* **NOTE** Using Client Certificates in combination with Proxy Servers is not supported.
|
* **NOTE** Using Client Certificates in combination with Proxy Servers is not supported.
|
||||||
|
*
|
||||||
|
* **NOTE** When using WebKit on macOS, accessing `localhost` might not work as expected. Instead, use
|
||||||
|
* `playwright.local` as the hostname.
|
||||||
*/
|
*/
|
||||||
clientCertificates?: Array<{
|
clientCertificates?: Array<{
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
3
packages/playwright/types/test.d.ts
vendored
3
packages/playwright/types/test.d.ts
vendored
|
|
@ -5210,6 +5210,9 @@ export interface PlaywrightTestOptions {
|
||||||
*
|
*
|
||||||
* **NOTE** Using Client Certificates in combination with Proxy Servers is not supported.
|
* **NOTE** Using Client Certificates in combination with Proxy Servers is not supported.
|
||||||
*
|
*
|
||||||
|
* **NOTE** When using WebKit on macOS, accessing `localhost` might not work as expected. Instead, use
|
||||||
|
* `playwright.local` as the hostname.
|
||||||
|
*
|
||||||
* **Usage**
|
* **Usage**
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ const test = base.extend<{ serverURL: string, serverURLRewrittenToLocalhost: str
|
||||||
},
|
},
|
||||||
serverURLRewrittenToLocalhost: async ({ serverURL, browserName }, use) => {
|
serverURLRewrittenToLocalhost: async ({ serverURL, browserName }, use) => {
|
||||||
const parsed = new URL(serverURL);
|
const parsed = new URL(serverURL);
|
||||||
parsed.hostname = 'i-get-rewritten-to-localhost-on-the-server-side';
|
parsed.hostname = 'local.playwright';
|
||||||
const shouldRewriteToLocalhost = browserName === 'webkit' && process.platform === 'darwin';
|
const shouldRewriteToLocalhost = browserName === 'webkit' && process.platform === 'darwin';
|
||||||
await use(shouldRewriteToLocalhost ? parsed.toString() : serverURL);
|
await use(shouldRewriteToLocalhost ? parsed.toString() : serverURL);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue