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: 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
|
||||
* chrome
|
||||
* chrome-beta
|
||||
* chrome-dev
|
||||
* chrome-canary
|
||||
* msedge
|
||||
* msedge-beta
|
||||
* msedge-dev
|
||||
* msedge-canary
|
||||
Browser distribution channel.
|
||||
|
||||
### option: BrowserType.launch.executablePath
|
||||
- `executablePath` <[path]>
|
||||
@ -300,17 +292,9 @@ Whether to run browser in headless mode. More details for
|
||||
[`option: devtools`] option is `true`.
|
||||
|
||||
### 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
|
||||
* chrome
|
||||
* chrome-beta
|
||||
* chrome-dev
|
||||
* chrome-canary
|
||||
* msedge
|
||||
* msedge-beta
|
||||
* msedge-dev
|
||||
* msedge-canary
|
||||
Browser distribution channel.
|
||||
|
||||
### option: BrowserType.launchPersistentContext.executablePath
|
||||
- `executablePath` <[path]>
|
||||
|
||||
@ -211,7 +211,7 @@ async function launchContext(options: Options, headless: boolean): Promise<{ bro
|
||||
const browserType = lookupBrowserType(options);
|
||||
const launchOptions: LaunchOptions = { headless };
|
||||
if (options.channel)
|
||||
launchOptions.channel = options.channel;
|
||||
launchOptions.channel = options.channel as any;
|
||||
|
||||
const contextOptions: BrowserContextOptions =
|
||||
// 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>;
|
||||
}
|
||||
export type BrowserTypeLaunchParams = {
|
||||
channel?: string,
|
||||
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary',
|
||||
executablePath?: string,
|
||||
args?: string[],
|
||||
ignoreAllDefaultArgs?: boolean,
|
||||
@ -241,7 +241,7 @@ export type BrowserTypeLaunchParams = {
|
||||
slowMo?: number,
|
||||
};
|
||||
export type BrowserTypeLaunchOptions = {
|
||||
channel?: string,
|
||||
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary',
|
||||
executablePath?: string,
|
||||
args?: string[],
|
||||
ignoreAllDefaultArgs?: boolean,
|
||||
@ -268,7 +268,7 @@ export type BrowserTypeLaunchResult = {
|
||||
browser: BrowserChannel,
|
||||
};
|
||||
export type BrowserTypeLaunchPersistentContextParams = {
|
||||
channel?: string,
|
||||
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary',
|
||||
userDataDir: string,
|
||||
sdkLanguage: string,
|
||||
executablePath?: string,
|
||||
@ -334,7 +334,7 @@ export type BrowserTypeLaunchPersistentContextParams = {
|
||||
},
|
||||
};
|
||||
export type BrowserTypeLaunchPersistentContextOptions = {
|
||||
channel?: string,
|
||||
channel?: 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary',
|
||||
executablePath?: string,
|
||||
args?: string[],
|
||||
ignoreAllDefaultArgs?: boolean,
|
||||
|
||||
@ -300,7 +300,17 @@ BrowserType:
|
||||
|
||||
launch:
|
||||
parameters:
|
||||
channel: string?
|
||||
channel:
|
||||
type: enum?
|
||||
literals:
|
||||
- chrome
|
||||
- chrome-beta
|
||||
- chrome-dev
|
||||
- chrome-canary
|
||||
- msedge
|
||||
- msedge-beta
|
||||
- msedge-dev
|
||||
- msedge-canary
|
||||
executablePath: string?
|
||||
args:
|
||||
type: array?
|
||||
@ -334,7 +344,17 @@ BrowserType:
|
||||
|
||||
launchPersistentContext:
|
||||
parameters:
|
||||
channel: string?
|
||||
channel:
|
||||
type: enum?
|
||||
literals:
|
||||
- chrome
|
||||
- chrome-beta
|
||||
- chrome-dev
|
||||
- chrome-canary
|
||||
- msedge
|
||||
- msedge-beta
|
||||
- msedge-dev
|
||||
- msedge-canary
|
||||
userDataDir: string
|
||||
sdkLanguage: string
|
||||
executablePath: string?
|
||||
|
||||
@ -154,7 +154,7 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
|
||||
contentScript: tOptional(tBoolean),
|
||||
});
|
||||
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),
|
||||
args: tOptional(tArray(tString)),
|
||||
ignoreAllDefaultArgs: tOptional(tBoolean),
|
||||
@ -178,7 +178,7 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
|
||||
slowMo: tOptional(tNumber),
|
||||
});
|
||||
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,
|
||||
sdkLanguage: tString,
|
||||
executablePath: tOptional(tString),
|
||||
|
||||
@ -39,7 +39,7 @@ export type PlaywrightOptions = {
|
||||
export type BrowserOptions = PlaywrightOptions & {
|
||||
name: string,
|
||||
isChromium: boolean,
|
||||
channel?: string,
|
||||
channel?: types.BrowserChannel,
|
||||
downloadsPath?: string,
|
||||
headful?: boolean,
|
||||
persistent?: types.BrowserContextOptions, // Undefined means no persistent context.
|
||||
|
||||
@ -249,8 +249,10 @@ export type BrowserContextOptions = {
|
||||
|
||||
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 = {
|
||||
channel?: string,
|
||||
channel?: BrowserChannel,
|
||||
executablePath?: string,
|
||||
args?: string[],
|
||||
ignoreDefaultArgs?: string[],
|
||||
|
||||
@ -94,7 +94,7 @@ fixtures.browserOptions.override(async ({ browserName, headful, slowMo, browserC
|
||||
if (executablePath)
|
||||
console.error(`Using executable at ${executablePath}`);
|
||||
await run({
|
||||
channel: browserChannel,
|
||||
channel: browserChannel as any,
|
||||
executablePath,
|
||||
handleSIGINT: false,
|
||||
slowMo,
|
||||
|
||||
@ -103,7 +103,7 @@ fixtures.browserOptions.init(async ({ headful, slowMo, browserChannel }, run) =>
|
||||
handleSIGINT: false,
|
||||
slowMo,
|
||||
headless: !headful,
|
||||
channel: browserChannel,
|
||||
channel: browserChannel as any,
|
||||
});
|
||||
}, { scope: 'worker' });
|
||||
|
||||
|
||||
24
types/types.d.ts
vendored
24
types/types.d.ts
vendored
@ -6357,17 +6357,9 @@ export interface BrowserType<Browser> {
|
||||
bypassCSP?: boolean;
|
||||
|
||||
/**
|
||||
* Chromium distribution channel, one of
|
||||
* - chrome
|
||||
* - chrome-beta
|
||||
* - chrome-dev
|
||||
* - chrome-canary
|
||||
* - msedge
|
||||
* - msedge-beta
|
||||
* - msedge-dev
|
||||
* - msedge-canary
|
||||
* Browser distribution channel.
|
||||
*/
|
||||
channel?: string;
|
||||
channel?: "chrome"|"chrome-beta"|"chrome-dev"|"chrome-canary"|"msedge"|"msedge-beta"|"msedge-dev"|"msedge-canary";
|
||||
|
||||
/**
|
||||
* Enable Chromium sandboxing. Defaults to `true`.
|
||||
@ -10659,17 +10651,9 @@ export interface LaunchOptions {
|
||||
args?: Array<string>;
|
||||
|
||||
/**
|
||||
* Chromium distribution channel, one of
|
||||
* - chrome
|
||||
* - chrome-beta
|
||||
* - chrome-dev
|
||||
* - chrome-canary
|
||||
* - msedge
|
||||
* - msedge-beta
|
||||
* - msedge-dev
|
||||
* - msedge-canary
|
||||
* Browser distribution channel.
|
||||
*/
|
||||
channel?: string;
|
||||
channel?: "chrome"|"chrome-beta"|"chrome-dev"|"chrome-canary"|"msedge"|"msedge-beta"|"msedge-dev"|"msedge-canary";
|
||||
|
||||
/**
|
||||
* Enable Chromium sandboxing. Defaults to `false`.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user