Skip to content

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

chore(testserver): allow overriding timeout (#37294)

Simon Knott7cbda37ab00f
diff --git a/packages/playwright/src/isomorphic/testServerInterface.ts b/packages/playwright/src/isomorphic/testServerInterface.ts
index 66136bab2e..0761f6cdfb 100644
--- a/packages/playwright/src/isomorphic/testServerInterface.ts
+++ b/packages/playwright/src/isomorphic/testServerInterface.ts
@@ -102,6 +102,7 @@ export interface TestServerInterface {
projects?: string[];
reuseContext?: boolean;
connectWsEndpoint?: string;
+ timeout?: number;
}): Promise<{
status: reporterTypes.FullResult['status'];
}>;
diff --git a/tests/playwright-test/test-server.spec.ts b/tests/playwright-test/test-server.spec.ts
index 157989c47e..5e0c3f030c 100644
--- a/tests/playwright-test/test-server.spec.ts
+++ b/tests/playwright-test/test-server.spec.ts
@@ -227,3 +227,18 @@ test('clear cache', async ({ startTestServer, writeFiles }) => {
await testServerConnection.clearCache({});
expect((await testServerConnection.runGlobalTeardown({})).status).toBe('passed');
});
+
+test('timeout override', async ({ startTestServer, writeFiles }) => {
+ const testServerConnection = await startTestServer();
+ await testServerConnection.initialize({});
+ await writeFiles({
+ 'a.test.ts': `
+ import { test, expect } from '@playwright/test';
+ test('foo', () => {
+ expect(test.info().timeout).toEqual(42);
+ });
+ `,
+ });
+
+ expect(await testServerConnection.runTests({ timeout: 42 })).toEqual({ status: 'passed' });
+});