Skip to content

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

fix: disable global timeout when debugging (#34922)

Yury Semikhatskyaaac9923fddf
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': `