mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: expose channel name literals for types (#5922)
This commit is contained in:
parent
f70eaf4ff3
commit
543582b4ca
@ -179,17 +179,9 @@ Whether to run browser in headless mode. More details for
|
|||||||
[`option: devtools`] option is `true`.
|
[`option: devtools`] option is `true`.
|
||||||
|
|
||||||
### option: BrowserType.launch.channel
|
### option: BrowserType.launch.channel
|
||||||
- `channel` <[string]>
|
- `channel` <[BrowserChannel]<"chrome"|"chrome-beta"|"chrome-dev"|"chrome-canary"|"msedge"|"msedge-beta"|"msedge-dev"|"msedge-canary">>
|
||||||
|
|
||||||
Chromium distribution channel, one of
|
Browser distribution channel.
|
||||||
* chrome
|
|
||||||
* chrome-beta
|
|
||||||
* chrome-dev
|
|
||||||
* chrome-canary
|
|
||||||
* msedge
|
|
||||||
* msedge-beta
|
|
||||||
* msedge-dev
|
|
||||||
* msedge-canary
|
|
||||||
|
|
||||||
### option: BrowserType.launch.executablePath
|
### option: BrowserType.launch.executablePath
|
||||||
- `executablePath` <[path]>
|
- `executablePath` <[path]>
|
||||||
@ -300,17 +292,9 @@ Whether to run browser in headless mode. More details for
|
|||||||
[`option: devtools`] option is `true`.
|
[`option: devtools`] option is `true`.
|
||||||
|
|
||||||
### option: BrowserType.launchPersistentContext.channel
|
### option: BrowserType.launchPersistentContext.channel
|
||||||
- `channel` <[string]>
|
- `channel` <[BrowserChannel]<"chrome"|"chrome-beta"|"chrome-dev"|"chrome-canary"|"msedge"|"msedge-beta"|"msedge-dev"|"msedge-canary">>
|
||||||
|
|
||||||
Chromium distribution channel, one of
|
Browser distribution channel.
|
||||||
* chrome
|
|
||||||
* chrome-beta
|
|
||||||
* chrome-dev
|
|
||||||
* chrome-canary
|
|
||||||
* msedge
|
|
||||||
* msedge-beta
|
|
||||||
* msedge-dev
|
|
||||||
* msedge-canary
|
|
||||||
|
|
||||||
### option: BrowserType.launchPersistentContext.executablePath
|
### option: BrowserType.launchPersistentContext.executablePath
|
||||||
- `executablePath` <[path]>
|
- `executablePath` <[path]>
|
||||||
|
|||||||
@ -211,7 +211,7 @@ async function launchContext(options: Options, headless: boolean): Promise<{ bro
|
|||||||
const browserType = lookupBrowserType(options);
|
const browserType = lookupBrowserType(options);
|
||||||
const launchOptions: LaunchOptions = { headless };
|
const launchOptions: LaunchOptions = { headless };
|
||||||
if (options.channel)
|
if (options.channel)
|
||||||
launchOptions.channel = options.channel;
|
launchOptions.channel = options.channel as any;
|
||||||
|
|
||||||
const contextOptions: BrowserContextOptions =
|
const contextOptions: BrowserContextOptions =
|
||||||
// Copy the device descriptor since we have to compare and modify the options.
|
// Copy the device descriptor since we have to compare and modify the options.
|
||||||
|
|||||||
@ -217,7 +217,7 @@ export interface BrowserTypeChannel extends Channel {
|
|||||||
connectOverCDP(params: BrowserTypeConnectOverCDPParams, metadata?: Metadata): Promise<BrowserTypeConnectOverCDPResult>;
|
connectOverCDP(params: BrowserTypeConnectOverCDPParams, metadata?: Metadata): Promise<BrowserTypeConnectOverCDPResult>;
|
||||||
}
|
}
|
||||||
export type BrowserTypeLaunchParams = {
|
export type BrowserTypeLaunchParams = {
|
||||||
channel?: string,
|
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary',
|
||||||
executablePath?: string,
|
executablePath?: string,
|
||||||
args?: string[],
|
args?: string[],
|
||||||
ignoreAllDefaultArgs?: boolean,
|
ignoreAllDefaultArgs?: boolean,
|
||||||
@ -241,7 +241,7 @@ export type BrowserTypeLaunchParams = {
|
|||||||
slowMo?: number,
|
slowMo?: number,
|
||||||
};
|
};
|
||||||
export type BrowserTypeLaunchOptions = {
|
export type BrowserTypeLaunchOptions = {
|
||||||
channel?: string,
|
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary',
|
||||||
executablePath?: string,
|
executablePath?: string,
|
||||||
args?: string[],
|
args?: string[],
|
||||||
ignoreAllDefaultArgs?: boolean,
|
ignoreAllDefaultArgs?: boolean,
|
||||||
@ -268,7 +268,7 @@ export type BrowserTypeLaunchResult = {
|
|||||||
browser: BrowserChannel,
|
browser: BrowserChannel,
|
||||||
};
|
};
|
||||||
export type BrowserTypeLaunchPersistentContextParams = {
|
export type BrowserTypeLaunchPersistentContextParams = {
|
||||||
channel?: string,
|
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary',
|
||||||
userDataDir: string,
|
userDataDir: string,
|
||||||
sdkLanguage: string,
|
sdkLanguage: string,
|
||||||
executablePath?: string,
|
executablePath?: string,
|
||||||
@ -334,7 +334,7 @@ export type BrowserTypeLaunchPersistentContextParams = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
export type BrowserTypeLaunchPersistentContextOptions = {
|
export type BrowserTypeLaunchPersistentContextOptions = {
|
||||||
channel?: string,
|
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary',
|
||||||
executablePath?: string,
|
executablePath?: string,
|
||||||
args?: string[],
|
args?: string[],
|
||||||
ignoreAllDefaultArgs?: boolean,
|
ignoreAllDefaultArgs?: boolean,
|
||||||
|
|||||||
@ -300,7 +300,17 @@ BrowserType:
|
|||||||
|
|
||||||
launch:
|
launch:
|
||||||
parameters:
|
parameters:
|
||||||
channel: string?
|
channel:
|
||||||
|
type: enum?
|
||||||
|
literals:
|
||||||
|
- chrome
|
||||||
|
- chrome-beta
|
||||||
|
- chrome-dev
|
||||||
|
- chrome-canary
|
||||||
|
- msedge
|
||||||
|
- msedge-beta
|
||||||
|
- msedge-dev
|
||||||
|
- msedge-canary
|
||||||
executablePath: string?
|
executablePath: string?
|
||||||
args:
|
args:
|
||||||
type: array?
|
type: array?
|
||||||
@ -334,7 +344,17 @@ BrowserType:
|
|||||||
|
|
||||||
launchPersistentContext:
|
launchPersistentContext:
|
||||||
parameters:
|
parameters:
|
||||||
channel: string?
|
channel:
|
||||||
|
type: enum?
|
||||||
|
literals:
|
||||||
|
- chrome
|
||||||
|
- chrome-beta
|
||||||
|
- chrome-dev
|
||||||
|
- chrome-canary
|
||||||
|
- msedge
|
||||||
|
- msedge-beta
|
||||||
|
- msedge-dev
|
||||||
|
- msedge-canary
|
||||||
userDataDir: string
|
userDataDir: string
|
||||||
sdkLanguage: string
|
sdkLanguage: string
|
||||||
executablePath: string?
|
executablePath: string?
|
||||||
|
|||||||
@ -154,7 +154,7 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
|
|||||||
contentScript: tOptional(tBoolean),
|
contentScript: tOptional(tBoolean),
|
||||||
});
|
});
|
||||||
scheme.BrowserTypeLaunchParams = tObject({
|
scheme.BrowserTypeLaunchParams = tObject({
|
||||||
channel: tOptional(tString),
|
channel: tOptional(tEnum(['chrome', 'chrome-beta', 'chrome-dev', 'chrome-canary', 'msedge', 'msedge-beta', 'msedge-dev', 'msedge-canary'])),
|
||||||
executablePath: tOptional(tString),
|
executablePath: tOptional(tString),
|
||||||
args: tOptional(tArray(tString)),
|
args: tOptional(tArray(tString)),
|
||||||
ignoreAllDefaultArgs: tOptional(tBoolean),
|
ignoreAllDefaultArgs: tOptional(tBoolean),
|
||||||
@ -178,7 +178,7 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
|
|||||||
slowMo: tOptional(tNumber),
|
slowMo: tOptional(tNumber),
|
||||||
});
|
});
|
||||||
scheme.BrowserTypeLaunchPersistentContextParams = tObject({
|
scheme.BrowserTypeLaunchPersistentContextParams = tObject({
|
||||||
channel: tOptional(tString),
|
channel: tOptional(tEnum(['chrome', 'chrome-beta', 'chrome-dev', 'chrome-canary', 'msedge', 'msedge-beta', 'msedge-dev', 'msedge-canary'])),
|
||||||
userDataDir: tString,
|
userDataDir: tString,
|
||||||
sdkLanguage: tString,
|
sdkLanguage: tString,
|
||||||
executablePath: tOptional(tString),
|
executablePath: tOptional(tString),
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export type PlaywrightOptions = {
|
|||||||
export type BrowserOptions = PlaywrightOptions & {
|
export type BrowserOptions = PlaywrightOptions & {
|
||||||
name: string,
|
name: string,
|
||||||
isChromium: boolean,
|
isChromium: boolean,
|
||||||
channel?: string,
|
channel?: types.BrowserChannel,
|
||||||
downloadsPath?: string,
|
downloadsPath?: string,
|
||||||
headful?: boolean,
|
headful?: boolean,
|
||||||
persistent?: types.BrowserContextOptions, // Undefined means no persistent context.
|
persistent?: types.BrowserContextOptions, // Undefined means no persistent context.
|
||||||
|
|||||||
@ -249,8 +249,10 @@ export type BrowserContextOptions = {
|
|||||||
|
|
||||||
export type EnvArray = { name: string, value: string }[];
|
export type EnvArray = { name: string, value: string }[];
|
||||||
|
|
||||||
|
export type BrowserChannel = 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary';
|
||||||
|
|
||||||
type LaunchOptionsBase = {
|
type LaunchOptionsBase = {
|
||||||
channel?: string,
|
channel?: BrowserChannel,
|
||||||
executablePath?: string,
|
executablePath?: string,
|
||||||
args?: string[],
|
args?: string[],
|
||||||
ignoreDefaultArgs?: string[],
|
ignoreDefaultArgs?: string[],
|
||||||
|
|||||||
@ -94,7 +94,7 @@ fixtures.browserOptions.override(async ({ browserName, headful, slowMo, browserC
|
|||||||
if (executablePath)
|
if (executablePath)
|
||||||
console.error(`Using executable at ${executablePath}`);
|
console.error(`Using executable at ${executablePath}`);
|
||||||
await run({
|
await run({
|
||||||
channel: browserChannel,
|
channel: browserChannel as any,
|
||||||
executablePath,
|
executablePath,
|
||||||
handleSIGINT: false,
|
handleSIGINT: false,
|
||||||
slowMo,
|
slowMo,
|
||||||
|
|||||||
@ -103,7 +103,7 @@ fixtures.browserOptions.init(async ({ headful, slowMo, browserChannel }, run) =>
|
|||||||
handleSIGINT: false,
|
handleSIGINT: false,
|
||||||
slowMo,
|
slowMo,
|
||||||
headless: !headful,
|
headless: !headful,
|
||||||
channel: browserChannel,
|
channel: browserChannel as any,
|
||||||
});
|
});
|
||||||
}, { scope: 'worker' });
|
}, { scope: 'worker' });
|
||||||
|
|
||||||
|
|||||||
24
types/types.d.ts
vendored
24
types/types.d.ts
vendored
@ -6357,17 +6357,9 @@ export interface BrowserType<Browser> {
|
|||||||
bypassCSP?: boolean;
|
bypassCSP?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chromium distribution channel, one of
|
* Browser distribution channel.
|
||||||
* - chrome
|
|
||||||
* - chrome-beta
|
|
||||||
* - chrome-dev
|
|
||||||
* - chrome-canary
|
|
||||||
* - msedge
|
|
||||||
* - msedge-beta
|
|
||||||
* - msedge-dev
|
|
||||||
* - msedge-canary
|
|
||||||
*/
|
*/
|
||||||
channel?: string;
|
channel?: "chrome"|"chrome-beta"|"chrome-dev"|"chrome-canary"|"msedge"|"msedge-beta"|"msedge-dev"|"msedge-canary";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable Chromium sandboxing. Defaults to `true`.
|
* Enable Chromium sandboxing. Defaults to `true`.
|
||||||
@ -10659,17 +10651,9 @@ export interface LaunchOptions {
|
|||||||
args?: Array<string>;
|
args?: Array<string>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chromium distribution channel, one of
|
* Browser distribution channel.
|
||||||
* - chrome
|
|
||||||
* - chrome-beta
|
|
||||||
* - chrome-dev
|
|
||||||
* - chrome-canary
|
|
||||||
* - msedge
|
|
||||||
* - msedge-beta
|
|
||||||
* - msedge-dev
|
|
||||||
* - msedge-canary
|
|
||||||
*/
|
*/
|
||||||
channel?: string;
|
channel?: "chrome"|"chrome-beta"|"chrome-dev"|"chrome-canary"|"msedge"|"msedge-beta"|"msedge-dev"|"msedge-canary";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable Chromium sandboxing. Defaults to `false`.
|
* Enable Chromium sandboxing. Defaults to `false`.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user