Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/playwright/src/agents/generateAgents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
for (const agent of agents)
await writeFile(`.claude/agents/${agent.name}.md`, ClaudeGenerator.agentSpec(agent), '🤖', 'agent definition');

const mcpServer = process.platform === 'win32'
? { command: 'cmd', args: ['/c', 'npx', 'playwright', 'run-test-mcp-server'] }

Check failure on line 49 in packages/playwright/src/agents/generateAgents.ts

View workflow job for this annotation

GitHub Actions / docs & lint

Expected indentation of 6 spaces but found 8
: { command: 'npx', args: ['playwright', 'run-test-mcp-server'] };

Check failure on line 50 in packages/playwright/src/agents/generateAgents.ts

View workflow job for this annotation

GitHub Actions / docs & lint

Expected indentation of 6 spaces but found 8
await writeFile('.mcp.json', JSON.stringify({
mcpServers: {
'playwright-test': {
command: 'npx',
args: ['playwright', 'run-test-mcp-server'],
}
'playwright-test': mcpServer,
}
}, null, 2), '🔧', 'mcp configuration');

Expand Down
18 changes: 18 additions & 0 deletions tests/mcp/init-agents.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,21 @@
});
expect(fs.existsSync(path.join(baseDir, 'custom', 'bar', 'e2e', 'seed.spec.ts'))).toBe(true);
});

test('claude generates correct mcp config', async ({ }) => {
const baseDir = await writeFiles({
'playwright.config.ts': `module.exports = {};`,
});

await runInitAgents({ cwd: baseDir, args: ['--loop', 'claude'] });

const mcpJson = JSON.parse(fs.readFileSync(path.join(baseDir, '.mcp.json'), 'utf-8'));
if (process.platform === 'win32') {
expect(mcpJson.mcpServers['playwright-test'].command).toBe('cmd');
expect(mcpJson.mcpServers['playwright-test'].args).toEqual(['/c', 'npx', 'playwright', 'run-test-mcp-server']);
} else {
expect(mcpJson.mcpServers['playwright-test'].command).toBe('npx');
expect(mcpJson.mcpServers['playwright-test'].args).toEqual(['playwright', 'run-test-mcp-server']);
}
});

Check failure on line 92 in tests/mcp/init-agents.spec.ts

View workflow job for this annotation

GitHub Actions / docs & lint

Too many blank lines at the end of file. Max of 0 allowed
Loading