Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: use paths relative to root in test tools (#37591)
Pavel Feldman5b51d6c13da0
diff --git a/packages/playwright/src/mcp/test/testBackend.ts b/packages/playwright/src/mcp/test/testBackend.tsindex b1151044a2..a1c64052e0 100644--- a/packages/playwright/src/mcp/test/testBackend.ts+++ b/packages/playwright/src/mcp/test/testBackend.ts@@ -35,14 +35,15 @@ export class TestServerBackend implements mcp.ServerBackend {}async initialize(server: mcp.Server, clientInfo: mcp.ClientInfo): Promise<void> {+ const rootPath = mcp.firstRootPath(clientInfo);+if (this._configOption) {- this._context.setConfigLocation(resolveConfigLocation(this._configOption));+ this._context.initialize(rootPath, resolveConfigLocation(this._configOption));return;}- const rootPath = mcp.firstRootPath(clientInfo);if (rootPath) {- this._context.setConfigLocation(resolveConfigLocation(rootPath));+ this._context.initialize(rootPath, resolveConfigLocation(rootPath));return;}diff --git a/packages/playwright/src/mcp/test/testContext.ts b/packages/playwright/src/mcp/test/testContext.tsindex b740482ed0..08904527ca 100644--- a/packages/playwright/src/mcp/test/testContext.ts+++ b/packages/playwright/src/mcp/test/testContext.ts@@ -22,13 +22,15 @@ export class TestContext {private _testRunner: TestRunner | undefined;readonly options?: { muteConsole?: boolean, headless?: boolean };configLocation!: ConfigLocation;+ rootPath!: string;constructor(options?: { muteConsole?: boolean, headless?: boolean }) {this.options = options;}- setConfigLocation(configLocation: ConfigLocation) {+ initialize(rootPath: string | undefined, configLocation: ConfigLocation) {this.configLocation = configLocation;+ this.rootPath = rootPath || configLocation.configDir;}async createTestRunner(): Promise<TestRunner> {diff --git a/packages/playwright/src/mcp/test/testTools.ts b/packages/playwright/src/mcp/test/testTools.tsindex 57e4662c68..420b3dc8a3 100644--- a/packages/playwright/src/mcp/test/testTools.ts+++ b/packages/playwright/src/mcp/test/testTools.ts@@ -161,7 +161,7 @@ test.describe('Test group', () => {const seedFileContent = await fs.promises.readFile(seedFile, 'utf8');progress({ message: `### Seed test-File: ${seedFile}+File: ${path.relative(context.rootPath, seedFile)}\`\`\`ts${seedFileContent}\`\`\`diff --git a/tests/mcp/test-setup-page.spec.ts b/tests/mcp/test-setup-page.spec.tsindex cb34d60835..19afd4340d 100644--- a/tests/mcp/test-setup-page.spec.ts+++ b/tests/mcp/test-setup-page.spec.ts@@ -41,7 +41,7 @@ test('test_setup_page', async ({ startClient }) => {},});- expect(response).toHaveTextResponse(expect.stringContaining(`### Seed test\nFile: `));+ expect(response).toHaveTextResponse(expect.stringContaining(`### Seed test\nFile: a.test.ts`));expect(response).toHaveTextResponse(expect.stringContaining(`### Paused at end of test. ready for interaction### Page state