chore: update routeFromHAR options for release (#21764)
This commit is contained in:
parent
98befd8a16
commit
3a80d119e0
|
|
@ -1124,17 +1124,17 @@ If specified, updates the given HAR with the actual network information instead
|
|||
|
||||
A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern will be served from the HAR file. If not specified, all requests are served from the HAR file.
|
||||
|
||||
### option: BrowserContext.routeFromHAR.mode
|
||||
### option: BrowserContext.routeFromHAR.updateMode
|
||||
* since: v1.32
|
||||
- `mode` <[HarMode]<"full"|"minimal">>
|
||||
- `updateMode` <[HarMode]<"full"|"minimal">>
|
||||
|
||||
When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to `minimal`.
|
||||
|
||||
### option: BrowserContext.routeFromHAR.content
|
||||
### option: BrowserContext.routeFromHAR.updateContent
|
||||
* since: v1.32
|
||||
- `content` <[HarContentPolicy]<"omit"|"embed"|"attach">>
|
||||
- `updateContent` <[RouteFromHarUpdateContentPolicy]<"embed"|"attach">>
|
||||
|
||||
Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach` is specified, resources are persisted as separate files or entries in the ZIP archive. If `embed` is specified, content is stored inline the HAR file
|
||||
Optional setting to control resource content management. If `attach` is specified, resources are persisted as separate files or entries in the ZIP archive. If `embed` is specified, content is stored inline the HAR file.
|
||||
|
||||
## method: BrowserContext.serviceWorkers
|
||||
* since: v1.11
|
||||
|
|
|
|||
|
|
@ -3335,15 +3335,17 @@ If specified, updates the given HAR with the actual network information instead
|
|||
|
||||
A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern will be served from the HAR file. If not specified, all requests are served from the HAR file.
|
||||
|
||||
### option: Page.routeFromHAR.mode
|
||||
### option: Page.routeFromHAR.updateMode
|
||||
* since: v1.32
|
||||
- `mode` <[HarMode]<"full"|"minimal">>
|
||||
- `updateMode` <[HarMode]<"full"|"minimal">>
|
||||
|
||||
When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to `full`.
|
||||
|
||||
### option: Page.routeFromHAR.url
|
||||
### option: Page.routeFromHAR.updateContent
|
||||
* since: v1.32
|
||||
- `content` <[HarContentPolicy]<"omit"|"embed"|"attach">>
|
||||
Optional setting to control resource content management. If `omit` is specified, content is not persisted. If `attach` is specified, resources are persisted as separate files or entries in the ZIP archive. If `embed` is specified, content is stored inline the HAR file
|
||||
- `updateContent` <[RouteFromHarUpdateContentPolicy]<"embed"|"attach">>
|
||||
|
||||
Optional setting to control resource content management. If `attach` is specified, resources are persisted as separate files or entries in the ZIP archive. If `embed` is specified, content is stored inline the HAR file.
|
||||
|
||||
## async method: Page.screenshot
|
||||
* since: v1.8
|
||||
|
|
|
|||
|
|
@ -266,20 +266,20 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel>
|
|||
await this._updateInterceptionPatterns();
|
||||
}
|
||||
|
||||
async _recordIntoHAR(har: string, page: Page | null, options: { url?: string | RegExp, notFound?: 'abort' | 'fallback', update?: boolean, content?: 'omit' | 'attach' | 'embed' | undefined, mode?: 'minimal' | 'full'} = {}): Promise<void> {
|
||||
async _recordIntoHAR(har: string, page: Page | null, options: { url?: string | RegExp, notFound?: 'abort' | 'fallback', update?: boolean, updateContent?: 'attach' | 'embed', updateMode?: 'minimal' | 'full'} = {}): Promise<void> {
|
||||
const { harId } = await this._channel.harStart({
|
||||
page: page?._channel,
|
||||
options: prepareRecordHarOptions({
|
||||
path: har,
|
||||
content: options.content ?? 'attach',
|
||||
mode: options.mode ?? 'minimal',
|
||||
content: options.updateContent ?? 'attach',
|
||||
mode: options.updateMode ?? 'minimal',
|
||||
urlFilter: options.url
|
||||
})!
|
||||
});
|
||||
this._harRecorders.set(harId, { path: har, content: options.content ?? 'attach' });
|
||||
this._harRecorders.set(harId, { path: har, content: options.updateContent ?? 'attach' });
|
||||
}
|
||||
|
||||
async routeFromHAR(har: string, options: { url?: string | RegExp, notFound?: 'abort' | 'fallback', update?: boolean, content?: 'omit' | 'attach' | 'embed' | undefined, mode?: 'minimal' | 'full' } = {}): Promise<void> {
|
||||
async routeFromHAR(har: string, options: { url?: string | RegExp, notFound?: 'abort' | 'fallback', update?: boolean, updateContent?: 'attach' | 'embed', updateMode?: 'minimal' | 'full' } = {}): Promise<void> {
|
||||
if (options.update) {
|
||||
await this._recordIntoHAR(har, null, options);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -458,7 +458,7 @@ export class Page extends ChannelOwner<channels.PageChannel> implements api.Page
|
|||
await this._updateInterceptionPatterns();
|
||||
}
|
||||
|
||||
async routeFromHAR(har: string, options: { url?: string | RegExp, notFound?: 'abort' | 'fallback', update?: boolean, content?: 'omit' | 'attach' | 'embed' | undefined, mode?: 'minimal' | 'full'} = {}): Promise<void> {
|
||||
async routeFromHAR(har: string, options: { url?: string | RegExp, notFound?: 'abort' | 'fallback', update?: boolean, updateContent?: 'attach' | 'embed', updateMode?: 'minimal' | 'full'} = {}): Promise<void> {
|
||||
if (options.update) {
|
||||
await this._browserContext._recordIntoHAR(har, this, options);
|
||||
return;
|
||||
|
|
|
|||
43
packages/playwright-core/types/types.d.ts
vendored
43
packages/playwright-core/types/types.d.ts
vendored
|
|
@ -3556,10 +3556,6 @@ export interface Page {
|
|||
* @param options
|
||||
*/
|
||||
routeFromHAR(har: string, options?: {
|
||||
content?: "omit"|"embed"|"attach";
|
||||
|
||||
mode?: "full"|"minimal";
|
||||
|
||||
/**
|
||||
* - If set to 'abort' any request not found in the HAR file will be aborted.
|
||||
* - If set to 'fallback' missing requests will be sent to the network.
|
||||
|
|
@ -3575,6 +3571,18 @@ export interface Page {
|
|||
*/
|
||||
update?: boolean;
|
||||
|
||||
/**
|
||||
* Optional setting to control resource content management. If `attach` is specified, resources are persisted as
|
||||
* separate files or entries in the ZIP archive. If `embed` is specified, content is stored inline the HAR file.
|
||||
*/
|
||||
updateContent?: "embed"|"attach";
|
||||
|
||||
/**
|
||||
* When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page,
|
||||
* cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to `full`.
|
||||
*/
|
||||
updateMode?: "full"|"minimal";
|
||||
|
||||
/**
|
||||
* A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the
|
||||
* pattern will be served from the HAR file. If not specified, all requests are served from the HAR file.
|
||||
|
|
@ -8063,20 +8071,6 @@ export interface BrowserContext {
|
|||
* @param options
|
||||
*/
|
||||
routeFromHAR(har: string, options?: {
|
||||
/**
|
||||
* Optional setting to control resource content management. If `omit` is specified, content is not persisted. If
|
||||
* `attach` is specified, resources are persisted as separate files or entries in the ZIP archive. If `embed` is
|
||||
* specified, content is stored inline the HAR file
|
||||
*/
|
||||
content?: "omit"|"embed"|"attach";
|
||||
|
||||
/**
|
||||
* When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page,
|
||||
* cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to
|
||||
* `minimal`.
|
||||
*/
|
||||
mode?: "full"|"minimal";
|
||||
|
||||
/**
|
||||
* - If set to 'abort' any request not found in the HAR file will be aborted.
|
||||
* - If set to 'fallback' falls through to the next route handler in the handler chain.
|
||||
|
|
@ -8092,6 +8086,19 @@ export interface BrowserContext {
|
|||
*/
|
||||
update?: boolean;
|
||||
|
||||
/**
|
||||
* Optional setting to control resource content management. If `attach` is specified, resources are persisted as
|
||||
* separate files or entries in the ZIP archive. If `embed` is specified, content is stored inline the HAR file.
|
||||
*/
|
||||
updateContent?: "embed"|"attach";
|
||||
|
||||
/**
|
||||
* When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page,
|
||||
* cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to
|
||||
* `minimal`.
|
||||
*/
|
||||
updateMode?: "full"|"minimal";
|
||||
|
||||
/**
|
||||
* A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the
|
||||
* pattern will be served from the HAR file. If not specified, all requests are served from the HAR file.
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ it('should update har.zip for page with different options', async ({ contextFact
|
|||
const harPath = testInfo.outputPath('har.zip');
|
||||
const context1 = await contextFactory();
|
||||
const page1 = await context1.newPage();
|
||||
await page1.routeFromHAR(harPath, { 'update': true, 'content': 'embed', 'mode': 'full' });
|
||||
await page1.routeFromHAR(harPath, { update: true, updateContent: 'embed', updateMode: 'full' });
|
||||
await page1.goto(server.PREFIX + '/one-style.html');
|
||||
await context1.close();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue