Skip to content

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

Revert "fix(playwright-test): prohibit async functions passed to describe (#14538)" (#14591)

Andrey Lushnikov8801f7974231
diff --git a/packages/playwright-test/src/testType.ts b/packages/playwright-test/src/testType.ts
index 649fd8fb0a..0d8c918f99 100644
--- a/packages/playwright-test/src/testType.ts
+++ b/packages/playwright-test/src/testType.ts
@@ -129,9 +129,7 @@ export class TestTypeImpl {
}
setCurrentlyLoadingFileSuite(child);
- const result = fn();
- if (result instanceof Promise)
- throw errorWithLocation(location, 'describe cannot use async functions as callbacks');
+ fn();
setCurrentlyLoadingFileSuite(suite);
}
diff --git a/tests/playwright-test/runner.spec.ts b/tests/playwright-test/runner.spec.ts
index a7892de8dc..3d01b77917 100644
--- a/tests/playwright-test/runner.spec.ts
+++ b/tests/playwright-test/runner.spec.ts
@@ -48,17 +48,6 @@ test('it should enforce unique test names based on the describe block name', asy
expect(result.output).toContain(` - tests${path.sep}example.spec.js:8`);
});
-test('it should prohibit async functions in test.describe', async ({ runInlineTest }) => {
- const result = await runInlineTest({
- 'tests/example.spec.js': `
- const { test } = pwt;
- test.describe('hello', async () => { test('my world', () => {}) });
- `
- });
- expect(result.exitCode).toBe(1);
- expect(result.output).toContain('describe cannot use async functions as callbacks');
-});
-
test('it should not allow multiple tests with the same name in multiple files', async ({ runInlineTest }) => {
const result = await runInlineTest({
'tests/example1.spec.js': `