apply
This commit is contained in:
parent
f90e1c575d
commit
c7b95f1dbd
|
|
@ -67,7 +67,6 @@ export class BrowserType extends ChannelOwner<channels.BrowserTypeChannel> imple
|
||||||
options = { ...this._playwright._defaultLaunchOptions, ...options };
|
options = { ...this._playwright._defaultLaunchOptions, ...options };
|
||||||
const launchOptions: channels.BrowserTypeLaunchParams = {
|
const launchOptions: channels.BrowserTypeLaunchParams = {
|
||||||
...options,
|
...options,
|
||||||
tracesDir: options.tracesDir ?? this._playwright._defaultTracesDir,
|
|
||||||
ignoreDefaultArgs: Array.isArray(options.ignoreDefaultArgs) ? options.ignoreDefaultArgs : undefined,
|
ignoreDefaultArgs: Array.isArray(options.ignoreDefaultArgs) ? options.ignoreDefaultArgs : undefined,
|
||||||
ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs),
|
ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs),
|
||||||
env: options.env ? envObjectToArray(options.env) : undefined,
|
env: options.env ? envObjectToArray(options.env) : undefined,
|
||||||
|
|
|
||||||
|
|
@ -74,12 +74,12 @@ export class APIRequest implements api.APIRequest {
|
||||||
...options,
|
...options,
|
||||||
extraHTTPHeaders: options.extraHTTPHeaders ? headersObjectToArray(options.extraHTTPHeaders) : undefined,
|
extraHTTPHeaders: options.extraHTTPHeaders ? headersObjectToArray(options.extraHTTPHeaders) : undefined,
|
||||||
storageState,
|
storageState,
|
||||||
tracesDir: this._playwright._defaultTracesDir,
|
tracesDir: this._playwright._defaultLaunchOptions?.tracesDir, // We do not expose tracesDir in the API, so do not allow options to accidentally override it.
|
||||||
clientCertificates: await toClientCertificatesProtocol(options.clientCertificates),
|
clientCertificates: await toClientCertificatesProtocol(options.clientCertificates),
|
||||||
})).request);
|
})).request);
|
||||||
this._contexts.add(context);
|
this._contexts.add(context);
|
||||||
context._request = this;
|
context._request = this;
|
||||||
context._tracing._tracesDir = this._playwright._defaultTracesDir;
|
context._tracing._tracesDir = this._playwright._defaultLaunchOptions?.tracesDir;
|
||||||
await context._instrumentation.runAfterCreateRequestContext(context);
|
await context._instrumentation.runAfterCreateRequestContext(context);
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ export class Playwright extends ChannelOwner<channels.PlaywrightChannel> {
|
||||||
_defaultContextOptions?: BrowserContextOptions;
|
_defaultContextOptions?: BrowserContextOptions;
|
||||||
_defaultContextTimeout?: number;
|
_defaultContextTimeout?: number;
|
||||||
_defaultContextNavigationTimeout?: number;
|
_defaultContextNavigationTimeout?: number;
|
||||||
_defaultTracesDir?: string;
|
|
||||||
|
|
||||||
constructor(parent: ChannelOwner, type: string, guid: string, initializer: channels.PlaywrightInitializer) {
|
constructor(parent: ChannelOwner, type: string, guid: string, initializer: channels.PlaywrightInitializer) {
|
||||||
super(parent, type, guid, initializer);
|
super(parent, type, guid, initializer);
|
||||||
|
|
|
||||||
|
|
@ -83,11 +83,11 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
|
||||||
options.headless = headless;
|
options.headless = headless;
|
||||||
if (channel !== undefined)
|
if (channel !== undefined)
|
||||||
options.channel = channel;
|
options.channel = channel;
|
||||||
playwright._defaultTracesDir = tracing().tracesDir();
|
|
||||||
playwright._defaultLaunchOptions = options;
|
playwright._defaultLaunchOptions = options;
|
||||||
|
playwright._defaultLaunchOptions.tracesDir = tracing().tracesDir();
|
||||||
await use(options);
|
await use(options);
|
||||||
playwright._defaultLaunchOptions = undefined;
|
playwright._defaultLaunchOptions = undefined;
|
||||||
playwright._defaultTracesDir = undefined;
|
|
||||||
}, { scope: 'worker', auto: true, box: true }],
|
}, { scope: 'worker', auto: true, box: true }],
|
||||||
|
|
||||||
browser: [async ({ playwright, browserName, _browserOptions, connectOptions, _reuseContext }, use, testInfo) => {
|
browser: [async ({ playwright, browserName, _browserOptions, connectOptions, _reuseContext }, use, testInfo) => {
|
||||||
|
|
@ -234,12 +234,10 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
|
||||||
playwright._defaultContextOptions = _combinedContextOptions;
|
playwright._defaultContextOptions = _combinedContextOptions;
|
||||||
playwright._defaultContextTimeout = actionTimeout || 0;
|
playwright._defaultContextTimeout = actionTimeout || 0;
|
||||||
playwright._defaultContextNavigationTimeout = navigationTimeout || 0;
|
playwright._defaultContextNavigationTimeout = navigationTimeout || 0;
|
||||||
playwright._defaultTracesDir = tracing().tracesDir();
|
|
||||||
await use();
|
await use();
|
||||||
playwright._defaultContextOptions = undefined;
|
playwright._defaultContextOptions = undefined;
|
||||||
playwright._defaultContextTimeout = undefined;
|
playwright._defaultContextTimeout = undefined;
|
||||||
playwright._defaultContextNavigationTimeout = undefined;
|
playwright._defaultContextNavigationTimeout = undefined;
|
||||||
playwright._defaultTracesDir = undefined;
|
|
||||||
}, { auto: 'all-hooks-included', title: 'context configuration', box: true } as any],
|
}, { auto: 'all-hooks-included', title: 'context configuration', box: true } as any],
|
||||||
|
|
||||||
_setupArtifacts: [async ({ playwright, screenshot }, use, testInfo) => {
|
_setupArtifacts: [async ({ playwright, screenshot }, use, testInfo) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue