Skip to content

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

test: fix more tests (#38597)

Pavel Feldmand810ea863d9a
diff --git a/tests/mcp/autowait.spec.ts b/tests/mcp/autowait.spec.ts
index f64d2ecaa9..d37b6fd6cb 100644
--- a/tests/mcp/autowait.spec.ts
+++ b/tests/mcp/autowait.spec.ts
@@ -16,7 +16,7 @@
import { test, expect } from './fixtures';
-test('racy navigation destroys context', async ({ client, server, mcpBrowser }) => {
+test('racy navigation destroys context', async ({ client, server }) => {
server.setContent('/', `
<button onclick='setTimeout(() => window.location = "about:blank", 100)'>Submit</button>
`, 'text/html');
diff --git a/tests/mcp/fixtures.ts b/tests/mcp/fixtures.ts
index 352e7f9ab4..8860a0251a 100644
--- a/tests/mcp/fixtures.ts
+++ b/tests/mcp/fixtures.ts
@@ -56,6 +56,7 @@ export type StartClient = (options?: {
roots?: { name: string, uri: string }[],
rootsResponseDelay?: number,
env?: NodeJS.ProcessEnv,
+ noTimeoutForTest?: boolean,
}) => Promise<{ client: Client, stderr: () => string }>;
@@ -107,6 +108,8 @@ export const test = serverTest.extend<TestFixtures & TestOptions, WorkerFixtures
await fs.promises.writeFile(configFile, JSON.stringify(options.config, null, 2));
args.push(`--config=${path.relative(configDir, configFile)}`);
}
+ if (!options?.noTimeoutForTest)
+ args.push('--timeout-action=10000');
}
if (options?.args)
diff --git a/tests/mcp/timeouts.spec.ts b/tests/mcp/timeouts.spec.ts
index 57c4598121..467f9fb611 100644
--- a/tests/mcp/timeouts.spec.ts
+++ b/tests/mcp/timeouts.spec.ts
@@ -16,7 +16,8 @@
import { test, expect } from './fixtures';
-test('action timeout (default)', async ({ client, server }) => {
+test('action timeout (default)', async ({ server, startClient }) => {
+ const { client } = await startClient({ noTimeoutForTest: true });
server.setContent('/', `
<!DOCTYPE html>
<html>
diff --git a/tests/playwright-test/playwright.spec.ts b/tests/playwright-test/playwright.spec.ts
index c00cb3587a..666a5b6007 100644
--- a/tests/playwright-test/playwright.spec.ts
+++ b/tests/playwright-test/playwright.spec.ts
@@ -890,7 +890,7 @@ test('page.pause() should disable test timeout', async ({ runInlineTest }) => {
console.log('success!');
});
`,
- }, { headed: true });
+ }, { headed: true }); // This needs to be headed otherwise entire worker is gone.
expect(result.exitCode).toBe(0);
expect(result.passed).toBe(1);
expect(result.output).toContain('success!');