From f96b4870302bb39df2f8c10b152d03b0411093fe Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Fri, 20 Sep 2024 03:21:38 -0700 Subject: [PATCH] cherry-pick(#32714): fix(test runner): page.pause() should enable debug mode (#32722) Fixes #32706. --- .../playwright/src/worker/timeoutManager.ts | 2 ++ tests/playwright-test/playwright.spec.ts | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/packages/playwright/src/worker/timeoutManager.ts b/packages/playwright/src/worker/timeoutManager.ts index 71b853c463392..ef7665a6504f0 100644 --- a/packages/playwright/src/worker/timeoutManager.ts +++ b/packages/playwright/src/worker/timeoutManager.ts @@ -60,6 +60,8 @@ export class TimeoutManager { setIgnoreTimeouts() { this._ignoreTimeouts = true; + if (this._running) + this._updateTimeout(this._running); } interrupt() { diff --git a/tests/playwright-test/playwright.spec.ts b/tests/playwright-test/playwright.spec.ts index faaa069950c29..8cd83c40b14a7 100644 --- a/tests/playwright-test/playwright.spec.ts +++ b/tests/playwright-test/playwright.spec.ts @@ -872,3 +872,25 @@ test('should allow dynamic import in evaluate', async ({ runInlineTest, server } expect(result.exitCode).toBe(0); expect(result.passed).toBe(1); }); + +test('page.pause() should disable test timeout', async ({ runInlineTest }) => { + const result = await runInlineTest({ + 'a.test.ts': ` + import { test, expect } from '@playwright/test'; + + test('test', async ({ page }) => { + test.setTimeout(2000); + + await Promise.race([ + page.pause(), + new Promise(f => setTimeout(f, 3000)), + ]); + + console.log('success!'); + }); + `, + }, { headed: true }); + expect(result.exitCode).toBe(0); + expect(result.passed).toBe(1); + expect(result.output).toContain('success!'); +});