summaryrefslogtreecommitdiffstats
path: root/remote/test/puppeteer/packages/puppeteer-core/src/node
diff options
context:
space:
mode:
Diffstat (limited to 'remote/test/puppeteer/packages/puppeteer-core/src/node')
-rw-r--r--remote/test/puppeteer/packages/puppeteer-core/src/node/ChromeLauncher.ts24
-rw-r--r--remote/test/puppeteer/packages/puppeteer-core/src/node/FirefoxLauncher.ts10
-rw-r--r--remote/test/puppeteer/packages/puppeteer-core/src/node/LaunchOptions.ts13
-rw-r--r--remote/test/puppeteer/packages/puppeteer-core/src/node/ProductLauncher.ts6
-rw-r--r--remote/test/puppeteer/packages/puppeteer-core/src/node/PuppeteerNode.ts5
5 files changed, 26 insertions, 32 deletions
diff --git a/remote/test/puppeteer/packages/puppeteer-core/src/node/ChromeLauncher.ts b/remote/test/puppeteer/packages/puppeteer-core/src/node/ChromeLauncher.ts
index 51d5a19983..0cec3de9ae 100644
--- a/remote/test/puppeteer/packages/puppeteer-core/src/node/ChromeLauncher.ts
+++ b/remote/test/puppeteer/packages/puppeteer-core/src/node/ChromeLauncher.ts
@@ -36,25 +36,6 @@ export class ChromeLauncher extends ProductLauncher {
}
override launch(options: PuppeteerNodeLaunchOptions = {}): Promise<Browser> {
- const headless = options.headless ?? true;
- if (
- headless === true &&
- this.puppeteer.configuration.logLevel === 'warn' &&
- !Boolean(process.env['PUPPETEER_DISABLE_HEADLESS_WARNING'])
- ) {
- console.warn(
- [
- '\x1B[1m\x1B[43m\x1B[30m',
- 'Puppeteer old Headless deprecation warning:\x1B[0m\x1B[33m',
- ' In the near future `headless: true` will default to the new Headless mode',
- ' for Chrome instead of the old Headless implementation. For more',
- ' information, please see https://developer.chrome.com/articles/new-headless/.',
- ' Consider opting in early by passing `headless: "new"` to `puppeteer.launch()`',
- ' If you encounter any bugs, please report them to https://github.com/puppeteer/puppeteer/issues/new/choose.\x1B[0m\n',
- ].join('\n ')
- );
- }
-
if (
this.puppeteer.configuration.logLevel === 'warn' &&
process.platform === 'darwin' &&
@@ -231,6 +212,7 @@ export class ChromeLauncher extends ProductLauncher {
'--disable-sync',
'--enable-automation',
'--export-tagged-pdf',
+ '--generate-pdf-document-outline',
'--force-color-profile=srgb',
'--metrics-recording-only',
'--no-first-run',
@@ -253,7 +235,7 @@ export class ChromeLauncher extends ProductLauncher {
}
if (headless) {
chromeArguments.push(
- headless === 'new' ? '--headless=new' : '--headless',
+ headless === 'shell' ? '--headless' : '--headless=new',
'--hide-scrollbars',
'--mute-audio'
);
@@ -271,7 +253,7 @@ export class ChromeLauncher extends ProductLauncher {
override executablePath(
channel?: ChromeReleaseChannel,
- headless?: boolean | 'new'
+ headless?: boolean | 'shell'
): string {
if (channel) {
return computeSystemExecutablePath({
diff --git a/remote/test/puppeteer/packages/puppeteer-core/src/node/FirefoxLauncher.ts b/remote/test/puppeteer/packages/puppeteer-core/src/node/FirefoxLauncher.ts
index eb4f375fc7..1af09192ec 100644
--- a/remote/test/puppeteer/packages/puppeteer-core/src/node/FirefoxLauncher.ts
+++ b/remote/test/puppeteer/packages/puppeteer-core/src/node/FirefoxLauncher.ts
@@ -43,12 +43,20 @@ export class FirefoxLauncher extends ProductLauncher {
return {
...extraPrefsFirefox,
...(protocol === 'webDriverBiDi'
- ? {}
+ ? {
+ // Only enable the WebDriver BiDi protocol
+ 'remote.active-protocols': 1,
+ }
: {
// Do not close the window when the last tab gets closed
'browser.tabs.closeWindowWithLastTab': false,
+ // Prevent various error message on the console
+ // jest-puppeteer asserts that no error message is emitted by the console
+ 'network.cookie.cookieBehavior': 0,
// Temporarily force disable BFCache in parent (https://bit.ly/bug-1732263)
'fission.bfcacheInParent': false,
+ // Only enable the CDP protocol
+ 'remote.active-protocols': 2,
}),
// Force all web content to use a single content process. TODO: remove
// this once Firefox supports mouse event dispatch from the main frame
diff --git a/remote/test/puppeteer/packages/puppeteer-core/src/node/LaunchOptions.ts b/remote/test/puppeteer/packages/puppeteer-core/src/node/LaunchOptions.ts
index 28e0b595df..d7717e45c5 100644
--- a/remote/test/puppeteer/packages/puppeteer-core/src/node/LaunchOptions.ts
+++ b/remote/test/puppeteer/packages/puppeteer-core/src/node/LaunchOptions.ts
@@ -17,13 +17,18 @@ export interface BrowserLaunchArgumentOptions {
* Whether to run the browser in headless mode.
*
* @remarks
- * In the future `headless: true` will be equivalent to `headless: 'new'`.
- * You can read more about the change {@link https://developer.chrome.com/articles/new-headless/ | here}.
- * Consider opting in early by setting the value to `"new"`.
+ *
+ * - `true` launches the browser in the
+ * {@link https://developer.chrome.com/articles/new-headless/ | new headless}
+ * mode.
+ *
+ * - `'shell'` launches
+ * {@link https://developer.chrome.com/blog/chrome-headless-shell | shell}
+ * known as the old headless mode.
*
* @defaultValue `true`
*/
- headless?: boolean | 'new';
+ headless?: boolean | 'shell';
/**
* Path to a user data directory.
* {@link https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/user_data_dir.md | see the Chromium docs}
diff --git a/remote/test/puppeteer/packages/puppeteer-core/src/node/ProductLauncher.ts b/remote/test/puppeteer/packages/puppeteer-core/src/node/ProductLauncher.ts
index ab3432cd3a..2da07e8f7c 100644
--- a/remote/test/puppeteer/packages/puppeteer-core/src/node/ProductLauncher.ts
+++ b/remote/test/puppeteer/packages/puppeteer-core/src/node/ProductLauncher.ts
@@ -393,7 +393,7 @@ export abstract class ProductLauncher {
/**
* @internal
*/
- protected resolveExecutablePath(headless?: boolean | 'new'): string {
+ protected resolveExecutablePath(headless?: boolean | 'shell'): string {
let executablePath = this.puppeteer.configuration.executablePath;
if (executablePath) {
if (!existsSync(executablePath)) {
@@ -404,10 +404,10 @@ export abstract class ProductLauncher {
return executablePath;
}
- function productToBrowser(product?: Product, headless?: boolean | 'new') {
+ function productToBrowser(product?: Product, headless?: boolean | 'shell') {
switch (product) {
case 'chrome':
- if (headless === true) {
+ if (headless === 'shell') {
return InstalledBrowser.CHROMEHEADLESSSHELL;
}
return InstalledBrowser.CHROME;
diff --git a/remote/test/puppeteer/packages/puppeteer-core/src/node/PuppeteerNode.ts b/remote/test/puppeteer/packages/puppeteer-core/src/node/PuppeteerNode.ts
index e50e09acdb..726ee24cbb 100644
--- a/remote/test/puppeteer/packages/puppeteer-core/src/node/PuppeteerNode.ts
+++ b/remote/test/puppeteer/packages/puppeteer-core/src/node/PuppeteerNode.ts
@@ -223,7 +223,7 @@ export class PuppeteerNode extends Puppeteer {
* @internal
*/
get defaultDownloadPath(): string | undefined {
- return this.configuration.downloadPath ?? this.configuration.cacheDirectory;
+ return this.configuration.cacheDirectory;
}
/**
@@ -283,8 +283,7 @@ export class PuppeteerNode extends Puppeteer {
throw new Error('The current platform is not supported.');
}
- const cacheDir =
- this.configuration.downloadPath ?? this.configuration.cacheDirectory!;
+ const cacheDir = this.configuration.cacheDirectory!;
const installedBrowsers = await getInstalledBrowsers({
cacheDir,
});