Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: try the new CDPScreenshotNewSurface feature on cr-tot (#36092)

Dmitry Gozman14dfb291eeea
diff --git a/packages/playwright-core/src/server/chromium/chromium.ts b/packages/playwright-core/src/server/chromium/chromium.ts
index 288170a786..8e74b6e02d 100644
--- a/packages/playwright-core/src/server/chromium/chromium.ts
+++ b/packages/playwright-core/src/server/chromium/chromium.ts
@@ -295,7 +295,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(options.assistantMode)];
+ const chromeArguments = [...chromiumSwitches(options.assistantMode, options.channel)];
if (os.platform() === 'darwin') {
// See https://github.com/microsoft/playwright/issues/7362
diff --git a/packages/playwright-core/src/server/chromium/chromiumSwitches.ts b/packages/playwright-core/src/server/chromium/chromiumSwitches.ts
index d064ddbe4c..cf609c57cb 100644
--- a/packages/playwright-core/src/server/chromium/chromiumSwitches.ts
+++ b/packages/playwright-core/src/server/chromium/chromiumSwitches.ts
@@ -50,7 +50,7 @@ const disabledFeatures = (assistantMode?: boolean) => [
assistantMode ? 'AutomationControlled' : '',
].filter(Boolean);
-export const chromiumSwitches = (assistantMode?: boolean) => [
+export const chromiumSwitches = (assistantMode?: boolean, channel?: string) => [
'--disable-field-trial-config', // https://source.chromium.org/chromium/chromium/src/+/main:testing/variations/README.md
'--disable-background-networking',
'--disable-background-timer-throttling',
@@ -65,6 +65,7 @@ export const chromiumSwitches = (assistantMode?: boolean) => [
'--disable-dev-shm-usage',
'--disable-extensions',
'--disable-features=' + disabledFeatures(assistantMode).join(','),
+ channel === 'chromium-tip-of-tree' ? '--enable-features=CDPScreenshotNewSurface' : '',
'--allow-pre-commit-input',
'--disable-hang-monitor',
'--disable-ipc-flooding-protection',
diff --git a/tests/library/emulation-focus.spec.ts b/tests/library/emulation-focus.spec.ts
index 90cbdb6016..5af6cc7d15 100644
--- a/tests/library/emulation-focus.spec.ts
+++ b/tests/library/emulation-focus.spec.ts
@@ -101,11 +101,11 @@ it('should change document.activeElement', async ({ page, server }) => {
expect(active).toEqual(['INPUT', 'TEXTAREA']);
});
-it('should not affect screenshots', async ({ page, server, browserName, headless, isWindows, isLinux, isHeadlessShell }) => {
+it('should not affect screenshots', async ({ page, server, browserName, headless, isWindows, isLinux, isHeadlessShell, channel }) => {
it.skip(browserName === 'webkit' && isWindows && !headless, 'WebKit/Windows/headed has a larger minimal viewport. See https://github.com/microsoft/playwright/issues/22616');
it.skip(browserName === 'webkit' && isLinux && !headless, 'WebKit headed has a larger minimal viewport on gtk4.');
it.skip(browserName === 'firefox' && !headless, 'Firefox headed produces a different image');
- it.fixme(browserName === 'chromium' && !isHeadlessShell, 'https://github.com/microsoft/playwright/issues/33330');
+ it.fixme(browserName === 'chromium' && !isHeadlessShell && channel !== 'chromium-tip-of-tree', 'https://github.com/microsoft/playwright/issues/33330');
const page2 = await page.context().newPage();
await Promise.all([
diff --git a/tests/library/screenshot.spec.ts b/tests/library/screenshot.spec.ts
index 89a81c3c4c..98d8c96b60 100644
--- a/tests/library/screenshot.spec.ts
+++ b/tests/library/screenshot.spec.ts
@@ -22,8 +22,8 @@ import { verifyViewport } from '../config/utils';
browserTest.describe('page screenshot', () => {
browserTest.skip(({ browserName, headless }) => browserName === 'firefox' && !headless, 'Firefox headed produces a different image.');
- browserTest('should run in parallel in multiple pages', async ({ server, contextFactory, browserName, isHeadlessShell }) => {
- browserTest.fixme(browserName === 'chromium' && !isHeadlessShell, 'https://github.com/microsoft/playwright/issues/33330');
+ browserTest('should run in parallel in multiple pages', async ({ server, contextFactory, browserName, isHeadlessShell, channel }) => {
+ browserTest.fixme(browserName === 'chromium' && !isHeadlessShell && channel !== 'chromium-tip-of-tree', 'https://github.com/microsoft/playwright/issues/33330');
const context = await contextFactory();
const N = 5;