chore: improve client-side options plumbing (#21697)
This commit is contained in:
parent
c45d8749b0
commit
ea85242941
|
|
@ -19,7 +19,7 @@ import { BrowserContext, prepareBrowserContextParams } from './browserContext';
|
||||||
import type { Page } from './page';
|
import type { Page } from './page';
|
||||||
import { ChannelOwner } from './channelOwner';
|
import { ChannelOwner } from './channelOwner';
|
||||||
import { Events } from './events';
|
import { Events } from './events';
|
||||||
import type { BrowserContextOptions } from './types';
|
import type { LaunchOptions, BrowserContextOptions } from './types';
|
||||||
import { isSafeCloseError, kBrowserClosedError } from '../common/errors';
|
import { isSafeCloseError, kBrowserClosedError } from '../common/errors';
|
||||||
import type * as api from '../../types/types';
|
import type * as api from '../../types/types';
|
||||||
import { CDPSession } from './cdpSession';
|
import { CDPSession } from './cdpSession';
|
||||||
|
|
@ -30,17 +30,14 @@ export class Browser extends ChannelOwner<channels.BrowserChannel> implements ap
|
||||||
private _isConnected = true;
|
private _isConnected = true;
|
||||||
private _closedPromise: Promise<void>;
|
private _closedPromise: Promise<void>;
|
||||||
_shouldCloseConnectionOnClose = false;
|
_shouldCloseConnectionOnClose = false;
|
||||||
private _browserType!: BrowserType;
|
_browserType!: BrowserType;
|
||||||
|
_options: LaunchOptions = {};
|
||||||
readonly _name: string;
|
readonly _name: string;
|
||||||
|
|
||||||
static from(browser: channels.BrowserChannel): Browser {
|
static from(browser: channels.BrowserChannel): Browser {
|
||||||
return (browser as any)._object;
|
return (browser as any)._object;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromNullable(browser: channels.BrowserChannel | null): Browser | null {
|
|
||||||
return browser ? Browser.from(browser) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(parent: ChannelOwner, type: string, guid: string, initializer: channels.BrowserInitializer) {
|
constructor(parent: ChannelOwner, type: string, guid: string, initializer: channels.BrowserInitializer) {
|
||||||
super(parent, type, guid, initializer);
|
super(parent, type, guid, initializer);
|
||||||
this._name = initializer.name;
|
this._name = initializer.name;
|
||||||
|
|
@ -48,12 +45,6 @@ export class Browser extends ChannelOwner<channels.BrowserChannel> implements ap
|
||||||
this._closedPromise = new Promise(f => this.once(Events.Browser.Disconnected, f));
|
this._closedPromise = new Promise(f => this.once(Events.Browser.Disconnected, f));
|
||||||
}
|
}
|
||||||
|
|
||||||
_setBrowserType(browserType: BrowserType) {
|
|
||||||
this._browserType = browserType;
|
|
||||||
for (const context of this._contexts)
|
|
||||||
context._setBrowserType(browserType);
|
|
||||||
}
|
|
||||||
|
|
||||||
browserType(): BrowserType {
|
browserType(): BrowserType {
|
||||||
return this._browserType;
|
return this._browserType;
|
||||||
}
|
}
|
||||||
|
|
@ -65,13 +56,12 @@ export class Browser extends ChannelOwner<channels.BrowserChannel> implements ap
|
||||||
async _newContextForReuse(options: BrowserContextOptions = {}): Promise<BrowserContext> {
|
async _newContextForReuse(options: BrowserContextOptions = {}): Promise<BrowserContext> {
|
||||||
for (const context of this._contexts) {
|
for (const context of this._contexts) {
|
||||||
await this._wrapApiCall(async () => {
|
await this._wrapApiCall(async () => {
|
||||||
await this._browserType._onWillCloseContext?.(context);
|
await this._browserType._willCloseContext(context);
|
||||||
}, true);
|
}, true);
|
||||||
for (const page of context.pages())
|
for (const page of context.pages())
|
||||||
page._onClose();
|
page._onClose();
|
||||||
context._onClose();
|
context._onClose();
|
||||||
}
|
}
|
||||||
this._contexts.clear();
|
|
||||||
return await this._innerNewContext(options, true);
|
return await this._innerNewContext(options, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,11 +70,7 @@ export class Browser extends ChannelOwner<channels.BrowserChannel> implements ap
|
||||||
const contextOptions = await prepareBrowserContextParams(options);
|
const contextOptions = await prepareBrowserContextParams(options);
|
||||||
const response = forReuse ? await this._channel.newContextForReuse(contextOptions) : await this._channel.newContext(contextOptions);
|
const response = forReuse ? await this._channel.newContextForReuse(contextOptions) : await this._channel.newContext(contextOptions);
|
||||||
const context = BrowserContext.from(response.context);
|
const context = BrowserContext.from(response.context);
|
||||||
context._options = contextOptions;
|
await this._browserType._didCreateContext(context, contextOptions, this._options, options.logger || this._logger);
|
||||||
this._contexts.add(context);
|
|
||||||
context._logger = options.logger || this._logger;
|
|
||||||
context._setBrowserType(this._browserType);
|
|
||||||
await this._browserType._onDidCreateContext?.(context);
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel>
|
||||||
_pages = new Set<Page>();
|
_pages = new Set<Page>();
|
||||||
private _routes: network.RouteHandler[] = [];
|
private _routes: network.RouteHandler[] = [];
|
||||||
readonly _browser: Browser | null = null;
|
readonly _browser: Browser | null = null;
|
||||||
private _browserType: BrowserType | undefined;
|
_browserType: BrowserType | undefined;
|
||||||
readonly _bindings = new Map<string, (source: structs.BindingSource, ...args: any[]) => any>();
|
readonly _bindings = new Map<string, (source: structs.BindingSource, ...args: any[]) => any>();
|
||||||
_timeoutSettings = new TimeoutSettings();
|
_timeoutSettings = new TimeoutSettings();
|
||||||
_ownerPage: Page | undefined;
|
_ownerPage: Page | undefined;
|
||||||
|
|
@ -72,6 +72,7 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel>
|
||||||
super(parent, type, guid, initializer, createInstrumentation());
|
super(parent, type, guid, initializer, createInstrumentation());
|
||||||
if (parent instanceof Browser)
|
if (parent instanceof Browser)
|
||||||
this._browser = parent;
|
this._browser = parent;
|
||||||
|
this._browser?._contexts.add(this);
|
||||||
this._isChromium = this._browser?._name === 'chromium';
|
this._isChromium = this._browser?._name === 'chromium';
|
||||||
this.tracing = Tracing.from(initializer.tracing);
|
this.tracing = Tracing.from(initializer.tracing);
|
||||||
this.request = APIRequestContext.from(initializer.requestContext);
|
this.request = APIRequestContext.from(initializer.requestContext);
|
||||||
|
|
@ -105,11 +106,11 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel>
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
_setBrowserType(browserType: BrowserType) {
|
_setOptions(contextOptions: channels.BrowserNewContextParams, browserOptions: LaunchOptions) {
|
||||||
this._browserType = browserType;
|
this._options = contextOptions;
|
||||||
browserType._contexts.add(this);
|
|
||||||
if (this._options.recordHar)
|
if (this._options.recordHar)
|
||||||
this._harRecorders.set('', { path: this._options.recordHar.path, content: this._options.recordHar.content });
|
this._harRecorders.set('', { path: this._options.recordHar.path, content: this._options.recordHar.content });
|
||||||
|
this.tracing._tracesDir = browserOptions.tracesDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _onPage(page: Page): void {
|
private _onPage(page: Page): void {
|
||||||
|
|
@ -348,7 +349,7 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel>
|
||||||
return;
|
return;
|
||||||
this._closeWasCalled = true;
|
this._closeWasCalled = true;
|
||||||
await this._wrapApiCall(async () => {
|
await this._wrapApiCall(async () => {
|
||||||
await this._browserType?._onWillCloseContext?.(this);
|
await this._browserType?._willCloseContext(this);
|
||||||
for (const [harId, harParams] of this._harRecorders) {
|
for (const [harId, harParams] of this._harRecorders) {
|
||||||
const har = await this._channel.harExport({ harId });
|
const har = await this._channel.harExport({ harId });
|
||||||
const artifact = Artifact.from(har.artifact);
|
const artifact = Artifact.from(har.artifact);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import type * as channels from '@protocol/channels';
|
||||||
import { Browser } from './browser';
|
import { Browser } from './browser';
|
||||||
import { BrowserContext, prepareBrowserContextParams } from './browserContext';
|
import { BrowserContext, prepareBrowserContextParams } from './browserContext';
|
||||||
import { ChannelOwner } from './channelOwner';
|
import { ChannelOwner } from './channelOwner';
|
||||||
import type { LaunchOptions, LaunchServerOptions, ConnectOptions, LaunchPersistentContextOptions, BrowserContextOptions } from './types';
|
import type { LaunchOptions, LaunchServerOptions, ConnectOptions, LaunchPersistentContextOptions, BrowserContextOptions, Logger } from './types';
|
||||||
import { Connection } from './connection';
|
import { Connection } from './connection';
|
||||||
import { Events } from './events';
|
import { Events } from './events';
|
||||||
import type { ChildProcess } from 'child_process';
|
import type { ChildProcess } from 'child_process';
|
||||||
|
|
@ -48,10 +48,10 @@ export class BrowserType extends ChannelOwner<channels.BrowserTypeChannel> imple
|
||||||
|
|
||||||
// Instrumentation.
|
// Instrumentation.
|
||||||
_defaultContextOptions?: BrowserContextOptions;
|
_defaultContextOptions?: BrowserContextOptions;
|
||||||
_defaultLaunchOptions?: LaunchOptions;
|
private _defaultLaunchOptions?: LaunchOptions;
|
||||||
_defaultConnectOptions?: ConnectOptions;
|
private _defaultConnectOptions?: ConnectOptions;
|
||||||
_onDidCreateContext?: (context: BrowserContext) => Promise<void>;
|
private _onDidCreateContext?: (context: BrowserContext) => Promise<void>;
|
||||||
_onWillCloseContext?: (context: BrowserContext) => Promise<void>;
|
private _onWillCloseContext?: (context: BrowserContext) => Promise<void>;
|
||||||
|
|
||||||
static from(browserType: channels.BrowserTypeChannel): BrowserType {
|
static from(browserType: channels.BrowserTypeChannel): BrowserType {
|
||||||
return (browserType as any)._object;
|
return (browserType as any)._object;
|
||||||
|
|
@ -84,8 +84,7 @@ export class BrowserType extends ChannelOwner<channels.BrowserTypeChannel> imple
|
||||||
};
|
};
|
||||||
return await this._wrapApiCall(async () => {
|
return await this._wrapApiCall(async () => {
|
||||||
const browser = Browser.from((await this._channel.launch(launchOptions)).browser);
|
const browser = Browser.from((await this._channel.launch(launchOptions)).browser);
|
||||||
browser._logger = logger;
|
this._didLaunchBrowser(browser, options, logger);
|
||||||
browser._setBrowserType(this);
|
|
||||||
return browser;
|
return browser;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -126,10 +125,7 @@ export class BrowserType extends ChannelOwner<channels.BrowserTypeChannel> imple
|
||||||
return await this._wrapApiCall(async () => {
|
return await this._wrapApiCall(async () => {
|
||||||
const result = await this._channel.launchPersistentContext(persistentParams);
|
const result = await this._channel.launchPersistentContext(persistentParams);
|
||||||
const context = BrowserContext.from(result.context);
|
const context = BrowserContext.from(result.context);
|
||||||
context._options = contextParams;
|
await this._didCreateContext(context, contextParams, options, logger);
|
||||||
context._logger = logger;
|
|
||||||
context._setBrowserType(this);
|
|
||||||
await this._onDidCreateContext?.(context);
|
|
||||||
return context;
|
return context;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -200,9 +196,8 @@ export class BrowserType extends ChannelOwner<channels.BrowserTypeChannel> imple
|
||||||
}
|
}
|
||||||
playwright._setSelectors(this._playwright.selectors);
|
playwright._setSelectors(this._playwright.selectors);
|
||||||
browser = Browser.from(playwright._initializer.preLaunchedBrowser!);
|
browser = Browser.from(playwright._initializer.preLaunchedBrowser!);
|
||||||
browser._logger = logger;
|
this._didLaunchBrowser(browser, {}, logger);
|
||||||
browser._shouldCloseConnectionOnClose = true;
|
browser._shouldCloseConnectionOnClose = true;
|
||||||
browser._setBrowserType(this);
|
|
||||||
browser.on(Events.Browser.Disconnected, closePipe);
|
browser.on(Events.Browser.Disconnected, closePipe);
|
||||||
return browser;
|
return browser;
|
||||||
}, deadline ? deadline - monotonicTime() : 0);
|
}, deadline ? deadline - monotonicTime() : 0);
|
||||||
|
|
@ -236,10 +231,28 @@ export class BrowserType extends ChannelOwner<channels.BrowserTypeChannel> imple
|
||||||
timeout: params.timeout
|
timeout: params.timeout
|
||||||
});
|
});
|
||||||
const browser = Browser.from(result.browser);
|
const browser = Browser.from(result.browser);
|
||||||
|
this._didLaunchBrowser(browser, {}, params.logger);
|
||||||
if (result.defaultContext)
|
if (result.defaultContext)
|
||||||
browser._contexts.add(BrowserContext.from(result.defaultContext));
|
await this._didCreateContext(BrowserContext.from(result.defaultContext), {}, {}, undefined);
|
||||||
browser._logger = params.logger;
|
|
||||||
browser._setBrowserType(this);
|
|
||||||
return browser;
|
return browser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_didLaunchBrowser(browser: Browser, browserOptions: LaunchOptions, logger: Logger | undefined) {
|
||||||
|
browser._browserType = this;
|
||||||
|
browser._options = browserOptions;
|
||||||
|
browser._logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
async _didCreateContext(context: BrowserContext, contextOptions: channels.BrowserNewContextParams, browserOptions: LaunchOptions, logger: Logger | undefined) {
|
||||||
|
context._logger = logger;
|
||||||
|
context._browserType = this;
|
||||||
|
this._contexts.add(context);
|
||||||
|
context._setOptions(contextOptions, browserOptions);
|
||||||
|
await this._onDidCreateContext?.(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
async _willCloseContext(context: BrowserContext) {
|
||||||
|
this._contexts.delete(context);
|
||||||
|
await this._onWillCloseContext?.(context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ export type FetchOptions = {
|
||||||
maxRedirects?: number,
|
maxRedirects?: number,
|
||||||
};
|
};
|
||||||
|
|
||||||
type NewContextOptions = Omit<channels.PlaywrightNewRequestOptions, 'extraHTTPHeaders' | 'storageState'> & {
|
type NewContextOptions = Omit<channels.PlaywrightNewRequestOptions, 'extraHTTPHeaders' | 'storageState' | 'tracesDir'> & {
|
||||||
extraHTTPHeaders?: Headers,
|
extraHTTPHeaders?: Headers,
|
||||||
storageState?: string | StorageState,
|
storageState?: string | StorageState,
|
||||||
};
|
};
|
||||||
|
|
@ -56,6 +56,7 @@ export class APIRequest implements api.APIRequest {
|
||||||
readonly _contexts = new Set<APIRequestContext>();
|
readonly _contexts = new Set<APIRequestContext>();
|
||||||
|
|
||||||
// Instrumentation.
|
// Instrumentation.
|
||||||
|
_defaultContextOptions?: NewContextOptions & { tracesDir?: string };
|
||||||
_onDidCreateContext?: (context: APIRequestContext) => Promise<void>;
|
_onDidCreateContext?: (context: APIRequestContext) => Promise<void>;
|
||||||
_onWillCloseContext?: (context: APIRequestContext) => Promise<void>;
|
_onWillCloseContext?: (context: APIRequestContext) => Promise<void>;
|
||||||
|
|
||||||
|
|
@ -64,16 +65,21 @@ export class APIRequest implements api.APIRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
async newContext(options: NewContextOptions = {}): Promise<APIRequestContext> {
|
async newContext(options: NewContextOptions = {}): Promise<APIRequestContext> {
|
||||||
|
options = { ...this._defaultContextOptions, ...options };
|
||||||
const storageState = typeof options.storageState === 'string' ?
|
const storageState = typeof options.storageState === 'string' ?
|
||||||
JSON.parse(await fs.promises.readFile(options.storageState, 'utf8')) :
|
JSON.parse(await fs.promises.readFile(options.storageState, 'utf8')) :
|
||||||
options.storageState;
|
options.storageState;
|
||||||
|
// We do not expose tracesDir in the API, so do not allow options to accidentally override it.
|
||||||
|
const tracesDir = this._defaultContextOptions?.tracesDir;
|
||||||
const context = APIRequestContext.from((await this._playwright._channel.newRequest({
|
const context = APIRequestContext.from((await this._playwright._channel.newRequest({
|
||||||
...options,
|
...options,
|
||||||
extraHTTPHeaders: options.extraHTTPHeaders ? headersObjectToArray(options.extraHTTPHeaders) : undefined,
|
extraHTTPHeaders: options.extraHTTPHeaders ? headersObjectToArray(options.extraHTTPHeaders) : undefined,
|
||||||
storageState,
|
storageState,
|
||||||
|
tracesDir,
|
||||||
})).request);
|
})).request);
|
||||||
this._contexts.add(context);
|
this._contexts.add(context);
|
||||||
context._request = this;
|
context._request = this;
|
||||||
|
context._tracing._tracesDir = tracesDir;
|
||||||
await this._onDidCreateContext?.(context);
|
await this._onDidCreateContext?.(context);
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ import { ChannelOwner } from './channelOwner';
|
||||||
export class Tracing extends ChannelOwner<channels.TracingChannel> implements api.Tracing {
|
export class Tracing extends ChannelOwner<channels.TracingChannel> implements api.Tracing {
|
||||||
private _includeSources = false;
|
private _includeSources = false;
|
||||||
private _metadataCollector: channels.ClientSideCallMetadata[] = [];
|
private _metadataCollector: channels.ClientSideCallMetadata[] = [];
|
||||||
|
_tracesDir: string | undefined;
|
||||||
|
|
||||||
static from(channel: channels.TracingChannel): Tracing {
|
static from(channel: channels.TracingChannel): Tracing {
|
||||||
return (channel as any)._object;
|
return (channel as any)._object;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import type { APIRequestContext, BrowserContext, BrowserContextOptions, LaunchOptions, Page, Tracing, Video } from 'playwright-core';
|
import type { APIRequestContext, BrowserContext, BrowserContextOptions, LaunchOptions, Page, Tracing, Video } from 'playwright-core';
|
||||||
import type { BrowserType as BrowserTypeImpl } from 'playwright-core/lib/client/browserType';
|
|
||||||
import * as playwrightLibrary from 'playwright-core';
|
import * as playwrightLibrary from 'playwright-core';
|
||||||
import { createGuid, debugMode, removeFolders, addInternalStackPrefix, mergeTraceFiles, saveTraceFile } from 'playwright-core/lib/utils';
|
import { createGuid, debugMode, removeFolders, addInternalStackPrefix, mergeTraceFiles, saveTraceFile } from 'playwright-core/lib/utils';
|
||||||
import type { Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, ScreenshotMode, TestInfo, TestType, TraceMode, VideoMode } from '../types/test';
|
import type { Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, ScreenshotMode, TestInfo, TestType, TraceMode, VideoMode } from '../types/test';
|
||||||
|
|
@ -102,13 +101,13 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
|
||||||
options.tracesDir = path.join(_artifactsDir(), 'traces');
|
options.tracesDir = path.join(_artifactsDir(), 'traces');
|
||||||
|
|
||||||
for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit]) {
|
for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit]) {
|
||||||
(browserType as BrowserTypeImpl)._defaultLaunchOptions = options;
|
(browserType as any)._defaultLaunchOptions = options;
|
||||||
(browserType as BrowserTypeImpl)._defaultConnectOptions = connectOptions;
|
(browserType as any)._defaultConnectOptions = connectOptions;
|
||||||
}
|
}
|
||||||
await use(options);
|
await use(options);
|
||||||
for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit]) {
|
for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit]) {
|
||||||
(browserType as BrowserTypeImpl)._defaultLaunchOptions = undefined;
|
(browserType as any)._defaultLaunchOptions = undefined;
|
||||||
(browserType as BrowserTypeImpl)._defaultConnectOptions = undefined;
|
(browserType as any)._defaultConnectOptions = undefined;
|
||||||
}
|
}
|
||||||
}, { scope: 'worker', auto: true }],
|
}, { scope: 'worker', auto: true }],
|
||||||
|
|
||||||
|
|
@ -386,6 +385,7 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
|
||||||
{
|
{
|
||||||
(playwright.request as any)._onDidCreateContext = onDidCreateRequestContext;
|
(playwright.request as any)._onDidCreateContext = onDidCreateRequestContext;
|
||||||
(playwright.request as any)._onWillCloseContext = onWillCloseRequestContext;
|
(playwright.request as any)._onWillCloseContext = onWillCloseRequestContext;
|
||||||
|
(playwright.request as any)._defaultContextOptions = _combinedContextOptions;
|
||||||
const existingApiRequests: APIRequestContext[] = Array.from((playwright.request as any)._contexts as Set<APIRequestContext>);
|
const existingApiRequests: APIRequestContext[] = Array.from((playwright.request as any)._contexts as Set<APIRequestContext>);
|
||||||
await Promise.all(existingApiRequests.map(onDidCreateRequestContext));
|
await Promise.all(existingApiRequests.map(onDidCreateRequestContext));
|
||||||
}
|
}
|
||||||
|
|
@ -422,6 +422,7 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
|
||||||
const leftoverApiRequests: APIRequestContext[] = Array.from((playwright.request as any)._contexts as Set<APIRequestContext>);
|
const leftoverApiRequests: APIRequestContext[] = Array.from((playwright.request as any)._contexts as Set<APIRequestContext>);
|
||||||
(playwright.request as any)._onDidCreateContext = undefined;
|
(playwright.request as any)._onDidCreateContext = undefined;
|
||||||
(playwright.request as any)._onWillCloseContext = undefined;
|
(playwright.request as any)._onWillCloseContext = undefined;
|
||||||
|
(playwright.request as any)._defaultContextOptions = undefined;
|
||||||
testInfoImpl._onTestFailureImmediateCallbacks.delete(screenshotOnTestFailure);
|
testInfoImpl._onTestFailureImmediateCallbacks.delete(screenshotOnTestFailure);
|
||||||
|
|
||||||
// 5. Collect artifacts from any non-closed contexts.
|
// 5. Collect artifacts from any non-closed contexts.
|
||||||
|
|
@ -555,12 +556,11 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
|
||||||
await use(page);
|
await use(page);
|
||||||
},
|
},
|
||||||
|
|
||||||
request: async ({ playwright, _combinedContextOptions }, use) => {
|
request: async ({ playwright }, use) => {
|
||||||
const request = await playwright.request.newContext(_combinedContextOptions);
|
const request = await playwright.request.newContext();
|
||||||
await use(request);
|
await use(request);
|
||||||
await request.dispose();
|
await request.dispose();
|
||||||
}
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue