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

This commit is contained in:
Pavel Feldman 2023-03-19 12:04:45 -07:00 committed by GitHub
parent 8a65cf9aac
commit f151c45c91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 5 deletions

View File

@ -75,7 +75,7 @@ export abstract class BrowserType extends SdkObject {
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);
const controller = new ProgressController(metadata, this);
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.');
if (args.find(arg => !arg.startsWith('-')))
throw new Error('Arguments can not specify page to be opened');
const chromeArguments = [...chromiumSwitches];
const chromeArguments = options.ignoreChromiumSwitches ? [] : [...chromiumSwitches];
if (os.platform() === 'darwin') {
// See https://github.com/microsoft/playwright/issues/7362

View File

@ -129,7 +129,10 @@ export class RecorderApp extends EventEmitter implements IRecorderApp {
args,
noDefaultViewport: true,
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),
useWebSocket: !!process.env.PWTEST_RECORDER_PORT,
handleSIGINT,

View File

@ -86,7 +86,10 @@ export async function showTraceViewer(traceUrls: string[], browserName: string,
channel: findChromiumChannel(traceViewerPlaywright.options.sdkLanguage),
args,
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,
colorScheme: 'no-override',
useWebSocket: isUnderTest(),

View File

@ -149,7 +149,7 @@ export type NormalizedContinueOverrides = {
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;