From aaac9923fddfd782e3fb573a71787bb77b8f40a8 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Tue, 25 Feb 2025 11:33:15 -0800 Subject: [PATCH] fix: disable global timeout when debugging (#34922) --- packages/playwright/src/common/config.ts | 2 +- tests/playwright-test/timeout.spec.ts | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.ts index 4e266110fd..4ebc900872 100644 --- a/packages/playwright/src/common/config.ts +++ b/packages/playwright/src/common/config.ts @@ -92,7 +92,7 @@ export class FullConfigInternal { fullyParallel: takeFirst(configCLIOverrides.fullyParallel, userConfig.fullyParallel, false), globalSetup: this.globalSetups[0] ?? null, globalTeardown: this.globalTeardowns[0] ?? null, - globalTimeout: takeFirst(configCLIOverrides.globalTimeout, userConfig.globalTimeout, 0), + globalTimeout: takeFirst(configCLIOverrides.debug ? 0 : undefined, configCLIOverrides.globalTimeout, userConfig.globalTimeout, 0), grep: takeFirst(userConfig.grep, defaultGrep), grepInvert: takeFirst(userConfig.grepInvert, null), maxFailures: takeFirst(configCLIOverrides.debug ? 1 : undefined, configCLIOverrides.maxFailures, userConfig.maxFailures, 0), diff --git a/tests/playwright-test/timeout.spec.ts b/tests/playwright-test/timeout.spec.ts index cb4e365b4b..9d6001078d 100644 --- a/tests/playwright-test/timeout.spec.ts +++ b/tests/playwright-test/timeout.spec.ts @@ -164,6 +164,26 @@ test('should ignore test.setTimeout when debugging', async ({ runInlineTest }) = expect(result.passed).toBe(1); }); +test('should ignore globalTimeout when debugging', { + annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34911' }, +}, async ({ runInlineTest }) => { + const result = await runInlineTest({ + 'playwright.config.ts': ` + export default { + globalTimeout: 100, + }; + `, + 'a.spec.ts': ` + import { test, expect } from '@playwright/test'; + test('my test', async ({ }) => { + await new Promise(f => setTimeout(f, 2000)); + }); + ` + }, { debug: true }); + expect(result.exitCode).toBe(0); + expect(result.passed).toBe(1); +}); + test('should respect fixture timeout', async ({ runInlineTest }) => { const result = await runInlineTest({ 'a.spec.ts': `