Skip to content

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

fix(test runner): mention fixture in worker teardown timeout error message (#15499)

Dmitry Gozman894ead519872
diff --git a/packages/playwright-test/src/timeoutManager.ts b/packages/playwright-test/src/timeoutManager.ts
index 5b9826bc01..6cdca9b590 100644
--- a/packages/playwright-test/src/timeoutManager.ts
+++ b/packages/playwright-test/src/timeoutManager.ts
@@ -107,10 +107,11 @@ export class TimeoutManager {
let message = '';
const timeout = this._currentSlot().timeout;
switch (this._runnable.type) {
- case 'test':
+ case 'test': {
const fixtureSuffix = this._fixture ? ` while ${this._fixture.title}` : '';
message = `Test timeout of ${timeout}ms exceeded${fixtureSuffix}.`;
break;
+ }
case 'afterEach':
case 'beforeEach':
message = `Test timeout of ${timeout}ms exceeded while running "${this._runnable.type}" hook.`;
@@ -119,9 +120,11 @@ export class TimeoutManager {
case 'afterAll':
message = `"${this._runnable.type}" hook timeout of ${timeout}ms exceeded.`;
break;
- case 'teardown':
- message = `Worker teardown timeout of ${timeout}ms exceeded.`;
+ case 'teardown': {
+ const fixtureSuffix = this._fixture ? ` while ${this._fixture.title}` : '';
+ message = `Worker teardown timeout of ${timeout}ms exceeded${fixtureSuffix}.`;
break;
+ }
case 'skip':
case 'slow':
case 'fixme':
diff --git a/tests/playwright-test/fixture-errors.spec.ts b/tests/playwright-test/fixture-errors.spec.ts
index 661deede08..11e23fb92a 100644
--- a/tests/playwright-test/fixture-errors.spec.ts
+++ b/tests/playwright-test/fixture-errors.spec.ts
@@ -55,7 +55,7 @@ test('should handle worker fixture timeout', async ({ runInlineTest }) => {
`
}, { timeout: 500 });
expect(result.exitCode).toBe(1);
- expect(result.output).toContain('Worker teardown timeout of 500ms exceeded.');
+ expect(result.output).toContain('Worker teardown timeout of 500ms exceeded while tearing down "timeout".');
});
test('should handle worker fixture error', async ({ runInlineTest }) => {
@@ -529,7 +529,7 @@ test('should report worker fixture teardown with debug info', async ({ runInline
'a.spec.ts:12:9 › good18',
'a.spec.ts:12:9 › good19',
'',
- 'Worker teardown timeout of 1000ms exceeded.',
+ 'Worker teardown timeout of 1000ms exceeded while tearing down "fixture".',
].join('\n'));
});