Skip to content

Commit

Permalink
cherry-pick(#32714): fix(test runner): page.pause() should enable deb…
Browse files Browse the repository at this point in the history
…ug mode (#32722)

Fixes #32706.
  • Loading branch information
dgozman committed Sep 20, 2024
1 parent 937424f commit f96b487
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/playwright/src/worker/timeoutManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export class TimeoutManager {

setIgnoreTimeouts() {
this._ignoreTimeouts = true;
if (this._running)
this._updateTimeout(this._running);
}

interrupt() {
Expand Down
22 changes: 22 additions & 0 deletions tests/playwright-test/playwright.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
});

0 comments on commit f96b487

Please sign in to comment.