From 6c039dedbdeb2edd0d7f378c0d6510bb25034b82 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Thu, 19 Sep 2024 15:30:06 +0100 Subject: [PATCH] fix(test runner): page.pause() should enable debug mode --- .../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!'); +});