Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: avoid headed tests in headless mode (#39141)
Yury Semikhatsky8f4007c33304
diff --git a/tests/library/headful.spec.ts b/tests/library/headful.spec.tsindex 38923a4131..5226f2ea35 100644--- a/tests/library/headful.spec.ts+++ b/tests/library/headful.spec.ts@@ -18,7 +18,7 @@ import { compare } from 'playwright-core/lib/server/utils/image_tools/compare';import { PNG } from 'playwright-core/lib/utilsBundle';import { expect, playwrightTest as it } from '../config/browserTest';-it.use({ headless: false });+it.skip(({ headless }) => headless, 'avoid popping windows in headless mode');it.skip(({ channel }) => channel === 'chromium-headless-shell' || channel === 'chromium-tip-of-tree-headless-shell', 'shell is never headed');it('should have default url when launching browser @smoke', async ({ launchPersistent }) => {diff --git a/tests/mcp/cli-config.spec.ts b/tests/mcp/cli-config.spec.tsindex e6dab49b34..ea23728110 100644--- a/tests/mcp/cli-config.spec.ts+++ b/tests/mcp/cli-config.spec.ts@@ -48,6 +48,47 @@ test('config-print prints merged config', async ({ cli }) => {expect(output).toContain('"browser"');});+test('config-print prints merged config from file, env and cli', async ({ cli, server }, testInfo) => {+ // Config file provides viewport and timeouts.+ const fileConfig = {+ browser: {+ contextOptions: {+ viewport: { width: 800, height: 600 },+ },+ },+ timeouts: {+ action: 10000,+ navigation: 30000,+ },+ };+ await fs.promises.writeFile(testInfo.outputPath('playwright-cli.json'), JSON.stringify(fileConfig, null, 2));++ // Env var overrides navigation timeout (30000 from file → 45000 from env).+ const env = { PLAYWRIGHT_MCP_TIMEOUT_NAVIGATION: '45000' };++ // CLI arg: --in-memory sets browser.isolated = true.+ await cli('open', '--in-memory', server.PREFIX, { env });++ // Query the resolved config from the running daemon.+ const { output } = await cli('config-print', { env });+ const configBegin = output.indexOf('{');+ expect(configBegin).not.toBe(-1);+ const config = JSON.parse(output.slice(configBegin));++ // From Playwright cli defaults.+ expect(config.browser.launchOptions.headless).toBe(true);++ // From config file.+ expect(config.browser.contextOptions.viewport).toEqual({ width: 800, height: 600 });+ expect(config.timeouts.action).toBe(10000);++ // Env var overrides file value.+ expect(config.timeouts.navigation).toBe(45000);++ // From CLI arg (--in-memory).+ expect(config.browser.isolated).toBe(true);+});+test('isolated', async ({ cli, server }, testInfo) => {const config = {browser: {