cherry-pick(#21782): chore: do not pass chromium args when running carlo-alike apps

This commit is contained in:
Pavel Feldman 2023-03-19 12:04:45 -07:00 committed by Pavel
parent 82cd1789b2
commit ec76a817ed
5 changed files with 11 additions and 5 deletions

View file

@ -75,7 +75,7 @@ export abstract class BrowserType extends SdkObject {
return browser; return browser;
} }
async launchPersistentContext(metadata: CallMetadata, userDataDir: string, options: channels.BrowserTypeLaunchPersistentContextOptions & { useWebSocket?: boolean }): Promise<BrowserContext> { async launchPersistentContext(metadata: CallMetadata, userDataDir: string, options: channels.BrowserTypeLaunchPersistentContextOptions & { useWebSocket?: boolean, ignoreChromiumSwitches?: boolean }): Promise<BrowserContext> {
options = this._validateLaunchOptions(options); options = this._validateLaunchOptions(options);
const controller = new ProgressController(metadata, this); const controller = new ProgressController(metadata, this);
const persistent: channels.BrowserNewContextParams = options; const persistent: channels.BrowserNewContextParams = options;

View file

@ -283,7 +283,7 @@ export class Chromium extends BrowserType {
throw new Error('Playwright manages remote debugging connection itself.'); throw new Error('Playwright manages remote debugging connection itself.');
if (args.find(arg => !arg.startsWith('-'))) if (args.find(arg => !arg.startsWith('-')))
throw new Error('Arguments can not specify page to be opened'); throw new Error('Arguments can not specify page to be opened');
const chromeArguments = [...chromiumSwitches]; const chromeArguments = options.ignoreChromiumSwitches ? [] : [...chromiumSwitches];
if (os.platform() === 'darwin') { if (os.platform() === 'darwin') {
// See https://github.com/microsoft/playwright/issues/7362 // See https://github.com/microsoft/playwright/issues/7362

View file

@ -129,7 +129,10 @@ export class RecorderApp extends EventEmitter implements IRecorderApp {
args, args,
noDefaultViewport: true, noDefaultViewport: true,
colorScheme: 'no-override', colorScheme: 'no-override',
ignoreDefaultArgs: ['--enable-automation'], // Moving the mouse while starting Chromium on macOS kills the mouse.
// There is no exact switch that we can blame, but removing all reduces the
// probability of this happening by a couple of orders.
ignoreChromiumSwitches: true,
headless: !!process.env.PWTEST_CLI_HEADLESS || (isUnderTest() && !headed), headless: !!process.env.PWTEST_CLI_HEADLESS || (isUnderTest() && !headed),
useWebSocket: !!process.env.PWTEST_RECORDER_PORT, useWebSocket: !!process.env.PWTEST_RECORDER_PORT,
handleSIGINT, handleSIGINT,

View file

@ -86,7 +86,10 @@ export async function showTraceViewer(traceUrls: string[], browserName: string,
channel: findChromiumChannel(traceViewerPlaywright.options.sdkLanguage), channel: findChromiumChannel(traceViewerPlaywright.options.sdkLanguage),
args, args,
noDefaultViewport: true, noDefaultViewport: true,
ignoreDefaultArgs: ['--enable-automation'], // Moving the mouse while starting Chromium on macOS kills the mouse.
// There is no exact switch that we can blame, but removing all reduces the
// probability of this happening by a couple of orders.
ignoreChromiumSwitches: true,
headless, headless,
colorScheme: 'no-override', colorScheme: 'no-override',
useWebSocket: isUnderTest(), useWebSocket: isUnderTest(),

View file

@ -149,7 +149,7 @@ export type NormalizedContinueOverrides = {
export type EmulatedSize = { viewport: Size, screen: Size }; export type EmulatedSize = { viewport: Size, screen: Size };
export type LaunchOptions = channels.BrowserTypeLaunchOptions & { useWebSocket?: boolean }; export type LaunchOptions = channels.BrowserTypeLaunchOptions & { useWebSocket?: boolean, ignoreChromiumSwitches?: boolean };
export type ProtocolLogger = (direction: 'send' | 'receive', message: object) => void; export type ProtocolLogger = (direction: 'send' | 'receive', message: object) => void;