From 9c80cbdf9e8bd9b0e5ff64e7706f6007204bd7f5 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Mon, 2 Nov 2020 12:48:05 -0800 Subject: [PATCH] fix(docs): small docs changes for new apis (#4305) --- docs/api.md | 14 +++++++------- src/server/browserContext.ts | 2 +- test/browsercontext-proxy.spec.ts | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/api.md b/docs/api.md index 841fbb3724..c6b496963e 100644 --- a/docs/api.md +++ b/docs/api.md @@ -223,7 +223,7 @@ Indicates that the browser is connected. - `password` <[string]> - `colorScheme` <"light"|"dark"|"no-preference"> Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See [page.emulateMedia(options)](#pageemulatemediaoptions) for more details. Defaults to '`light`'. - `logger` <[Logger]> Logger sink for Playwright logging. - - `proxy` <[Object]> Network proxy settings to use with this context. Note that browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: { server: 'per-proxy' } })`. + - `proxy` <[Object]> Network proxy settings to use with this context. Note that browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: { server: 'per-context' } })`. - `server` <[string]> Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy. - `bypass` <[string]> Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`. - `username` <[string]> Optional username to use if HTTP proxy requires authentication. @@ -234,7 +234,7 @@ Indicates that the browser is connected. - `height` <[number]> Video frame height. - `recordHar` <[Object]> Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `har.path` file. If not specified, the HAR is not recorded. Make sure to await [`browserContext.close`](#browsercontextclose) for the HAR to be saved. - `omitContent` <[boolean]> Optional setting to control whether to omit request content from the HAR. Defaults to `false`. - - `path` <[string]> path on the filesystem to write the HAR file to. + - `path` <[string]> Path on the filesystem to write the HAR file to. - returns: <[Promise]<[BrowserContext]>> Creates a new browser context. It won't share cookies/cache with other browser contexts. @@ -277,7 +277,7 @@ Creates a new browser context. It won't share cookies/cache with other browser c - `password` <[string]> - `colorScheme` <"light"|"dark"|"no-preference"> Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See [page.emulateMedia(options)](#pageemulatemediaoptions) for more details. Defaults to '`light`'. - `logger` <[Logger]> Logger sink for Playwright logging. - - `proxy` <[Object]> Network proxy settings to use with this context. Note that browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: { server: 'per-proxy' } })`. + - `proxy` <[Object]> Network proxy settings to use with this context. Note that browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: { server: 'per-context' } })`. - `server` <[string]> Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy. - `bypass` <[string]> Optional coma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`. - `username` <[string]> Optional username to use if HTTP proxy requires authentication. @@ -288,7 +288,7 @@ Creates a new browser context. It won't share cookies/cache with other browser c - `height` <[number]> Video frame height. - `recordHar` <[Object]> Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `har.path` file. If not specified, the HAR is not recorded. Make sure to await [`page.close`](#pagecontext) for the HAR to be saved. - `omitContent` <[boolean]> Optional setting to control whether to omit request content from the HAR. Defaults to `false`. - - `path` <[string]> path on the filesystem to write the HAR file to + - `path` <[string]> Path on the filesystem to write the HAR file to. - returns: <[Promise]<[Page]>> Creates a new page in a new browser context. Closing this page will close the context as well. @@ -3921,10 +3921,10 @@ ResourceType will be one of the following: `document`, `stylesheet`, `image`, `m - `domainLookupStart` <[number]> Time immediately before the browser starts the domain name lookup for the resource. The value is given in milliseconds relative to `startTime`, -1 if not available. - `domainLookupEnd` <[number]> Time immediately after the browser starts the domain name lookup for the resource. The value is given in milliseconds relative to `startTime`, -1 if not available. - `connectStart` <[number]> Time immediately before the user agent starts establishing the connection to the server to retrieve the resource. The value is given in milliseconds relative to `startTime`, -1 if not available. - - `secureConnectionStart` <[number]> immediately before the browser starts the handshake process to secure the current connection. The value is given in milliseconds relative to `startTime`, -1 if not available. + - `secureConnectionStart` <[number]> Time immediately before the browser starts the handshake process to secure the current connection. The value is given in milliseconds relative to `startTime`, -1 if not available. - `connectEnd` <[number]> Time immediately before the user agent starts establishing the connection to the server to retrieve the resource. The value is given in milliseconds relative to `startTime`, -1 if not available. - `requestStart` <[number]> Time immediately before the browser starts requesting the resource from the server, cache, or local resource. The value is given in milliseconds relative to `startTime`, -1 if not available. - - `responseStart` <[number]> immediately after the browser starts requesting the resource from the server, cache, or local resource. The value is given in milliseconds relative to `startTime`, -1 if not available. + - `responseStart` <[number]> Time immediately after the browser starts requesting the resource from the server, cache, or local resource. The value is given in milliseconds relative to `startTime`, -1 if not available. - `responseEnd` <[number]> Time immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. The value is given in milliseconds relative to `startTime`, -1 if not available. }; @@ -4483,7 +4483,7 @@ const browser = await chromium.launch({ // Or 'firefox' or 'webkit'. - `height` <[number]> Video frame height. - `recordHar` <[Object]> Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all the pages into `har.path` file. If not specified, HAR is not recorded. Make sure to await [`page.close`](#pagecontext) for HAR to be saved. - `omitContent` <[boolean]> Optional setting to control whether to omit request content from the HAR. Defaults to false. - - `path` <[string]> path on the filesystem to write the HAR file to + - `path` <[string]> Path on the filesystem to write the HAR file to. - returns: <[Promise]<[BrowserContext]>> Promise that resolves to the persistent browser context instance. Launches browser that uses persistent storage located at `userDataDir` and returns the only context. Closing this context will automatically close the browser. diff --git a/src/server/browserContext.ts b/src/server/browserContext.ts index 1ce17d6d60..b14bf5c08a 100644 --- a/src/server/browserContext.ts +++ b/src/server/browserContext.ts @@ -324,7 +324,7 @@ export function validateBrowserContextOptions(options: types.BrowserContextOptio options.viewport = { width: 1280, height: 720 }; if (options.proxy) { if (!browserOptions.proxy) - throw new Error(`Browser needs to be launched with the global proxy. If all contexts override the proxy, global proxy will be never used and can be any string, for example "launch({ proxy: { server: 'per-proxy' } })"`); + throw new Error(`Browser needs to be launched with the global proxy. If all contexts override the proxy, global proxy will be never used and can be any string, for example "launch({ proxy: { server: 'per-context' } })"`); options.proxy = normalizeProxySettings(options.proxy); } verifyGeolocation(options.geolocation); diff --git a/test/browsercontext-proxy.spec.ts b/test/browsercontext-proxy.spec.ts index e81b13a995..82d2605733 100644 --- a/test/browsercontext-proxy.spec.ts +++ b/test/browsercontext-proxy.spec.ts @@ -18,7 +18,7 @@ import { folio as baseFolio } from './fixtures'; const fixtures = baseFolio.extend(); fixtures.browserOptions.override(async ({ browserOptions }, run) => { - await run({ ...browserOptions, proxy: { server: 'per-proxy' } }); + await run({ ...browserOptions, proxy: { server: 'per-context' } }); }); const { it, expect } = fixtures.build();