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_setup_page): escape locations when passing to test runner (#37601)

Dmitry Gozman6a6ec8a33b94
diff --git a/packages/playwright/src/mcp/test/testTools.ts b/packages/playwright/src/mcp/test/testTools.ts
index 420b3dc8a3..e22a2f9e2b 100644
--- a/packages/playwright/src/mcp/test/testTools.ts
+++ b/packages/playwright/src/mcp/test/testTools.ts
@@ -17,7 +17,7 @@
import fs from 'fs';
import path from 'path';
-import { noColors } from 'playwright-core/lib/utils';
+import { noColors, escapeRegExp } from 'playwright-core/lib/utils';
import { z } from '../sdk/bundle';
import { terminalScreen } from '../../reporters/base';
@@ -169,7 +169,7 @@ ${seedFileContent}
const result = await testRunner.runTests(reporter, {
headed: !context.options?.headless,
- locations: [seedFile],
+ locations: ['/' + escapeRegExp(seedFile) + '/'],
projects: params.project ? [params.project] : undefined,
timeout: 0,
workers: 1,